Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MultiaddrNetMatch ¶
func MultiaddrNetMatch(tgt ma.Multiaddr, srcs []ma.Multiaddr) ma.Multiaddr
MultiaddrNetMatch returns the first Multiaddr found to match network.
func MultiaddrProtocolsMatch ¶
func MultiaddrProtocolsMatch(a, b ma.Multiaddr) bool
MultiaddrProtocolsMatch returns whether two multiaddrs match in protocol stacks.
func ReleaseBuffer ¶
func ReleaseBuffer(b []byte)
ReleaseBuffer puts the given byte array back into the buffer pool, first verifying that it is the correct size
Types ¶
type Conn ¶
type Conn interface {
PeerConn
// ID is an identifier unique to this connection.
ID() string
// can't just say "net.Conn" cause we have duplicate methods.
LocalAddr() net.Addr
RemoteAddr() net.Addr
SetDeadline(t time.Time) error
SetReadDeadline(t time.Time) error
SetWriteDeadline(t time.Time) error
msgio.Reader
msgio.Writer
}
Conn is a generic message-based Peer-to-Peer connection.
type Dialer ¶
type Dialer struct {
// Dialer is an optional manet.Dialer to use.
Dialer manet.Dialer
// LocalPeer is the identity of the local Peer.
LocalPeer peer.ID
// LocalAddrs is a set of local addresses to use.
LocalAddrs []ma.Multiaddr
// PrivateKey used to initialize a secure connection.
// Warning: if PrivateKey is nil, connection will not be secured.
PrivateKey ic.PrivKey
}
Dialer is an object that can open connections. We could have a "convenience" Dial function as before, but it would have many arguments, as dialing is no longer simple (need a peerstore, a local peer, a context, a network, etc)
type Listener ¶
type Listener interface {
// Accept waits for and returns the next connection to the listener.
Accept() (net.Conn, error)
// Addr is the local address
Addr() net.Addr
// Multiaddr is the local multiaddr address
Multiaddr() ma.Multiaddr
// LocalPeer is the identity of the local Peer.
LocalPeer() peer.ID
// Close closes the listener.
// Any blocked Accept operations will be unblocked and return errors.
Close() error
}
Listener is an object that can accept connections. It matches net.Listener
type PeerConn ¶
type PeerConn interface {
io.Closer
// LocalPeer (this side) ID, PrivateKey, and Address
LocalPeer() peer.ID
LocalPrivateKey() ic.PrivKey
LocalMultiaddr() ma.Multiaddr
// RemotePeer ID, PublicKey, and Address
RemotePeer() peer.ID
RemotePublicKey() ic.PubKey
RemoteMultiaddr() ma.Multiaddr
}
Click to show internal directories.
Click to hide internal directories.