Documentation
¶
Index ¶
- Variables
- type ListenErr
- type Swarm
- func (s *Swarm) Close() error
- func (s *Swarm) CloseConnection(p *peer.Peer) error
- func (s *Swarm) Dial(peer *peer.Peer) (*conn.Conn, error)
- func (s *Swarm) DialAddr(addr *ma.Multiaddr) (*conn.Conn, error)
- func (s *Swarm) Error(e error)
- func (s *Swarm) GetConnection(pid peer.ID) *conn.Conn
- func (s *Swarm) GetErrChan() chan error
Constants ¶
This section is empty.
Variables ¶
var ErrAlreadyOpen = errors.New("Error: Connection to this peer already open.")
ErrAlreadyOpen signals that a connection to a peer is already open.
Functions ¶
This section is empty.
Types ¶
type ListenErr ¶
type ListenErr struct {
Errors []error
}
ListenErr contains a set of errors mapping to each of the swarms addresses. Used to return multiple errors, as in listen.
type Swarm ¶
type Swarm struct { // Swarm includes a Pipe object. *msg.Pipe // 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) CloseConnection ¶
CloseConnection removes a given peer from swarm + closes the connection
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.
func (*Swarm) DialAddr ¶
DialAddr is for connecting to a peer when you know their addr but not their ID. Should only be used when sure that not connected to peer in question TODO(jbenet) merge with Dial? need way to patch back.
func (*Swarm) GetConnection ¶
GetConnection returns the connection in the swarm to given peer.ID
func (*Swarm) GetErrChan ¶
GetErrChan returns the errors chan.