Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection interface {
fmt.Stringer
Start(router *router.Router)
Disconnect()
IsConnected() bool
IsOutbound() bool
SetOnDisconnectedHandler(onDisconnectedHandler OnDisconnectedHandler)
SetOnInvalidMessageHandler(onInvalidMessageHandler OnInvalidMessageHandler)
Address() *net.TCPAddr
}
Connection represents a server connection.
type OnConnectedHandler ¶
type OnConnectedHandler func(connection Connection) error
OnConnectedHandler is a function that is to be called once a new Connection is successfully established.
type OnDisconnectedHandler ¶
type OnDisconnectedHandler func()
OnDisconnectedHandler is a function that is to be called once a Connection has been disconnected.
type OnInvalidMessageHandler ¶
type OnInvalidMessageHandler func(err error)
OnInvalidMessageHandler is a function that is to be called when an invalid message (cannot be parsed/doesn't have a route) was received from a connection.
type P2PServer ¶
type P2PServer interface {
Server
Connect(address string) (Connection, error)
}
P2PServer represents a p2p server.
type Server ¶
type Server interface {
Start() error
Stop() error
SetOnConnectedHandler(onConnectedHandler OnConnectedHandler)
}
Server represents a server.
Click to show internal directories.
Click to hide internal directories.