Skip to main content

Crate ptrs

Crate ptrs 

Source
Expand description

§ptrs-gesher-core

License: MIT/Apache 2.0

Core traits and helpers for the ptrs-gesher pluggable transports framework.

This crate defines the transport-agnostic abstractions that every concrete transport (obfs4, webtunnel, etc.) implements:

  • ClientTransport / ServerTransport – connection-oriented trait pair that transforms an AsyncRead + AsyncWrite stream into an obfuscated tunnel.
  • ClientBuilder / ServerBuilder – configuration and construction of transport instances from key-value Args.
  • PluggableTransport – top-level trait tying builders and transports together.
  • Args – ordered multimap for PT parameters (cert=, iat-mode=, etc.).

§Status

Version 0.3.0 – not yet published to crates.io. Interface subject to change.

§Example

use ptrs::{Args, ClientBuilder as _};
use obfs4;

let mut args = Args::new();
args.add("cert", "AAAA...");
args.add("iat-mode", "0");

let mut builder = obfs4::ClientBuilder::default();
builder.options(&args)?;
let client = builder.build();
// client.establish(...) or client.wrap(...) to create the tunnel.

§Notes / Resources

§License

Dual-licensed under either:

  • Apache License, Version 2.0
  • MIT license

at your option.

Modules§

args
Key–value mappings for the representation of client and server options.
constants
PT-spec environment variable names and current protocol version.
orport
ORPort authentication and connection helpers.

Macros§

args
Create an Args object from a list of key-value pairs
debug
Debug-level logging (gated on test or debug feature).
debug_span
Debug-level span (gated on test or debug feature).
error
Error-level logging.
error_span
Error-level span.
info
Info-level logging.
info_span
Info-level span.
trace
Trace-level logging (gated on test or debug feature).
trace_span
Trace-level span (gated on test or debug feature).
warn
Warning-level logging.
warn_span
Warning-level span.

Structs§

Bindaddr
A combination of a method name and an address, as extracted from TOR_PT_SERVER_BINDADDR.
ClientInfo
Client-side PT configuration read from the environment.
ServerInfo
Tor OR Server Information

Enums§

Error
Errors that can occur during Pluggable Transport establishment.

Traits§

ClientBuilder
Client Transport Builder
ClientTransport
Client Transport
Conn
Creator1 defines a stream creator that could be applied to either the input stream feature or the resulting stream future making them composable.
ConnectExt
In concept this trait provides extended functionality that can be appled to the client / server traits for creating connections / pluggable transports. this is still in a TODO state.
PluggableTransport
Core trait for a pluggable transport, defining its builder types.
ServerBuilder
Server Transport builder interface
ServerTransport
Server Transport

Functions§

is_client
Determines if the current program should be running as a client or server by checking the TOR_PT_CLIENT_TRANSPORTS and TOR_PT_SERVER_TRANSPORTS environment variables.
make_state_dir
Get the state directory from env, create if it doesnt exist.
pt_should_exit_on_stdin_close
Feature #15435 adds a new env var for determining if Tor keeps stdin open for use in termination detection.
resolve_addr
Parse a host:port string into a SocketAddr, rejecting unspecified hosts and port 0.

Type Aliases§

FutureResult
Future containing a generic result. We use this for functions that take and/or return futures that will produce Read/Write tunnels once awaited.
TcpStreamFut
Future resolving to a TCP stream or its error.
UdpSocketFut
Future resolving to a UDP socket or its error.