pub struct AptosNetTransport<TTransport> { /* private fields */ }
Expand description

The common AptosNet Transport.

The base transport layer is pluggable, so long as it provides a reliable, ordered, connection-oriented, byte-stream abstraction (e.g., TCP). We currently use either MemoryTransport or TcpTransport as this base layer.

Inbound and outbound connections are first established with the base_transport and then negotiate a secure, authenticated transport layer (currently Noise protocol). Finally, we negotiate common supported application protocols with the Handshake protocol.

Implementations

Dial a peer at addr. If the addr is not supported or formatted correctly, return Err. Otherwise, return a Future that resolves to Err if there was some issue dialing the peer and Ok with a fully upgraded connection to that peer if our dial was successful.

Dialing NetworkAddress format

We parse the dial address like:

/<base_transport> + /noise-ik/<pubkey>/handshake/<version>

If the base transport is MemoryTransport, then /<base_transport> is:

/memory/<port>

If the base transport is TcpTransport, then /<base_transport> is:

/ip4/<ipaddr>/tcp/<port> or /ip6/<ipaddr>/tcp/<port> or /dns/<ipaddr>/tcp/<port> or /dns4/<ipaddr>/tcp/<port> or /dns6/<ipaddr>/tcp/<port>

Listen on address addr. If the addr is not supported or formatted correctly, return Err. Otherwise, return a Stream of fully upgraded inbound connections and the dialer’s observed network address.

Listening NetworkAddress format

When listening, we only expect the base transport format. For example, if the base transport is MemoryTransport, then we expect:

/memory/<port>

If the base transport is TcpTransport, then we expect:

/ip4/<ipaddr>/tcp/<port> or /ip6/<ipaddr>/tcp/<port>

Trait Implementations

The result of establishing a connection. Read more

The Error type of errors which can happen while establishing a connection.

A pending Output for an inbound connection, obtained from the Listener stream. Read more

A pending Output for an outbound connection, obtained from dialing stream. Read more

A stream of Inbound connections and the address of the dialer. Read more

Dials the given NetworkAddress, returning a future for a pending outbound connection.

Listens on the given NetworkAddress, returning a stream of incoming connections. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

Turns a Transport into an abstract boxed transport.

Applies a function producing an asynchronous result to every connection created by this transport. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more