Expand description
§ptrs-gesher-core
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 anAsyncRead + AsyncWritestream into an obfuscated tunnel.ClientBuilder/ServerBuilder– configuration and construction of transport instances from key-valueArgs.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
testordebugfeature). - debug_
span - Debug-level span (gated on
testordebugfeature). - error
- Error-level logging.
- error_
span - Error-level span.
- info
- Info-level logging.
- info_
span - Info-level span.
- trace
- Trace-level logging (gated on
testordebugfeature). - trace_
span - Trace-level span (gated on
testordebugfeature). - 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. - Client
Info - Client-side PT configuration read from the environment.
- Server
Info - Tor OR Server Information
Enums§
- Error
- Errors that can occur during Pluggable Transport establishment.
Traits§
- Client
Builder - Client Transport Builder
- Client
Transport - 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.
- Connect
Ext - 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.
- Pluggable
Transport - Core trait for a pluggable transport, defining its builder types.
- Server
Builder - Server Transport builder interface
- Server
Transport - Server Transport
Functions§
- is_
client - Determines if the current program should be running as a client or server
by checking the
TOR_PT_CLIENT_TRANSPORTSandTOR_PT_SERVER_TRANSPORTSenvironment 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:portstring into aSocketAddr, rejecting unspecified hosts and port 0.
Type Aliases§
- Future
Result - Future containing a generic result. We use this for functions that take and/or return futures that will produce Read/Write tunnels once awaited.
- TcpStream
Fut - Future resolving to a TCP stream or its error.
- UdpSocket
Fut - Future resolving to a UDP socket or its error.