Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrTooManyConnections = errors.New("too many connections")
ErrTooManyConnections is returned the current number of connections exceeds the limit.
Functions ¶
This section is empty.
Types ¶
type ConnPool ¶ added in v0.3.0
A ConnPool maintains multiple connections to different remote peers and re-uses these connections when sending multiple message to the peer. If a connection to a peer does not exist when a message is sent, then it is established. When there are multiple Clients, they should all use a shared ConnPool, and therefore all implementations must be safe for concurrent use.
func NewConnPool ¶ added in v0.3.0
func NewConnPool(options ConnPoolOptions, logger logrus.FieldLogger, handshaker handshake.Handshaker) ConnPool
NewConnPool returns a ConnPool with no existing connections. It is safe for concurrent use.
type ConnPoolOptions ¶ added in v0.3.0
type ConnPoolOptions struct { Timeout time.Duration // Timeout when dialing new connections. TimeToLive time.Duration // Time-to-live for connections. MaxConnections int // Max connections allowed. }
ConnPoolOptions are used to parameterise the behaviour of a ConnPool.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(options ServerOptions, logger logrus.FieldLogger, handshaker handshake.Handshaker) *Server
func (*Server) Run ¶ added in v0.2.3
func (server *Server) Run(ctx context.Context, messages protocol.MessageSender)
Run the server until the context is done. The server will continuously listen for new connections, spawning each one into a background goroutine so that it can be handled concurrently.