Libp2p.Swarm (libp2p_elixir v0.9.0)
Minimal Swarm runtime for the libp2p subset we implement.
Responsibilities:
- start/stop TCP listeners
- dial peers
- supervise connections (each connection owns its socket + yamux session)
- notify on inbound streams for protocol routing
Protocol routing is implemented in later steps (Identify/Gossipsub/ReqResp).
Summary
Functions
Returns a specification to start this module under a supervisor.
Dial a peer at {ip, port}.
Start listening on {ip, port}.
Types
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec dial(t(), :inet.ip_address(), :inet.port_number()) :: {:ok, pid()} | {:error, term()}
Dial a peer at {ip, port}.
@spec dial(t(), :inet.ip_address(), :inet.port_number(), keyword()) :: {:ok, pid()} | {:error, term()}
@spec listen(t(), :inet.ip_address(), :inet.port_number()) :: {:ok, Libp2p.Transport.Tcp.socket()} | {:error, term()}
Start listening on {ip, port}.
@spec start_link(keyword()) :: GenServer.on_start()