Struct crust::Service [] [src]

pub struct Service<UID: Uid> { /* fields omitted */ }

A structure representing all the Crust services. This is the main object through which crust is used.

Methods

impl<UID: Uid> Service<UID>
[src]

[src]

Construct a service. event_tx is the sending half of the channel which crust will send notifications on.

[src]

Constructs a service with the given config. User needs to create an asynchronous channel, and provide the sender half to this method. Receiver will receive all Events from this library.

[src]

Allow (or disallow) peers from bootstrapping off us.

[src]

Initialises Service Discovery module and starts listening for responses to our beacon broadcasts.

[src]

Enable (or disable) listening and responding to peers searching for us. This can be used to allow others to discover us on the local network.

[src]

Return the ip address of the peer.

[src]

Returns whether the given peer's IP is in the config file's hard-coded contacts list.

[src]

Check if we have peers on LAN

[src]

Start the bootstrapping procedure. It will auto terminate after indicating success or failure via the event channel.

[src]

Stop the bootstraping procedure explicitly

[src]

Starts accepting TCP connections. This is persistant until it errors out or is stopped explicitly.

[src]

Stops Listener explicitly and stops accepting TCP connections.

[src]

Connect to a peer. To call this method you must follow these steps: * Generate a PrivConnectionInfo via Service::prepare_connection_info. * Create a PubConnectionInfo via PrivConnectionInfo::to_pub_connection_info. * Swap PubConnectionInfos out-of-band with the peer you are connecting to. * Call Service::connect using your PrivConnectionInfo and the PubConnectionInfo obtained from the peer

[src]

Disconnect from the given peer and returns whether there was a connection at all.

[src]

Send data to a peer.

[src]

Generate connection info. The connection info is returned via the ConnectionInfoPrepared event on the event channel. Calling this method is the first step of connecting to another peer, see Service::connect for more info.

[src]

Check if we are connected to the given peer

[src]

Returns our ID.