Documentation ¶
Index ¶
Constants ¶
const ChanBuffer = 10
ChanBuffer is the size of the buffer in the Conn Chan
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct { Peer *peer.Peer Addr *ma.Multiaddr Conn net.Conn Closed chan bool Outgoing *msgio.Chan Incoming *msgio.Chan }
Conn represents a connection to another Peer (IPFS Node).
type Message ¶
type Message struct { // To or from, depending on direction. Peer *peer.Peer // Opaque data Data []byte }
Message represents a packet of information sent to or received from a particular Peer.
type Swarm ¶
type Swarm struct { Chan *Chan // contains filtered or unexported fields }
Swarm is a connection muxer, allowing connections to other peers to be opened and closed, while still using the same Chan for all communication. The Chan sends/receives Messages, which note the destination or source Peer.
func (*Swarm) Dial ¶
Dial connects to a peer.
The idea is that the client of Swarm does not need to know what network the connection will happen over. Swarm can use whichever it choses. This allows us to use various transport protocols, do NAT traversal/relay, etc. to achive connection.
For now, Dial uses only TCP. This will be extended.