server

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2024 License: ISC Imports: 3 Imported by: 0

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL