Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrTimeout is returned when an expected incoming connection was not received in time. ErrTimeout = errors.New("accept timeout") // ErrDuplicateAccept is returned when the server already registered an accept request for that peer ID. ErrDuplicateAccept = errors.New("accept request for that peer already exists") // ErrClosed means that the server was shut down before a response could be received. ErrClosed = errors.New("server closed") // ErrInvalidHandshake is returned when no correct handshake could be established. ErrInvalidHandshake = errors.New("invalid handshake") // ErrNoGossip means that the given peer does not support the gossip service. ErrNoGossip = errors.New("peer does not have a gossip service") )
Functions ¶
This section is empty.
Types ¶
type ConnectPeerOption ¶ added in v0.6.2
type ConnectPeerOption func(conf *connectPeerConfig)
ConnectPeerOption defines an option for the DialPeer and AcceptPeer methods.
func WithNoDefaultTimeout ¶ added in v0.6.2
func WithNoDefaultTimeout() ConnectPeerOption
WithNoDefaultTimeout returns a ConnectPeerOption that disables the default timeout for dial or accept.
type TCP ¶
type TCP struct {
// contains filtered or unexported fields
}
TCP establishes verified incoming and outgoing TCP connections to other peers.
func ServeTCP ¶
func ServeTCP(local *peer.Local, listener *net.TCPListener, log *zap.SugaredLogger) *TCP
ServeTCP creates the object and starts listening for incoming connections.
func (*TCP) AcceptPeer ¶
func (t *TCP) AcceptPeer(ctx context.Context, p *peer.Peer, opts ...ConnectPeerOption) (net.Conn, error)
AcceptPeer awaits an incoming connection from the given peer. If the peer does not establish the connection or the handshake fails, an error is returned.
Click to show internal directories.
Click to hide internal directories.