sockets

package
v0.0.0-...-9ead31d Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const UndeterminedProtocolVersion = 0

Variables

View Source
var ErrCommandNotSupported = errors.New("command not supported by peer")

Functions

This section is empty.

Types

type CommandHandler

type CommandHandler func(command *commands.IncomingCommand) error

type EventPusher

type EventPusher = func(evt string)

type PacketHandler

type PacketHandler interface {
	HandlePacket(socket *Socket, packet []byte) (bool, error)
	RegisterSocket(socket *Socket)
	UnregisterSocket(socket *Socket)
}

type Socket

type Socket struct {
	AssignedIP net.IP

	Metadata map[string]interface{}
	// contains filtered or unexported fields
}

func MakeSocket

func MakeSocket(logger *log.Logger, adapter adapters.SocketAdapter, iface *iface.WaterInterfaceWrapper, ifaceManaged bool, eventPusher EventPusher) *Socket

func (*Socket) AddCommandHandler

func (s *Socket) AddCommandHandler(command string, handler CommandHandler)

func (*Socket) Close

func (s *Socket) Close()

func (*Socket) CloseError

func (s *Socket) CloseError(err error)

func (*Socket) ConfigurePing

func (s *Socket) ConfigurePing(pingInterval time.Duration, pingTimeout time.Duration)

func (*Socket) GetAdapter

func (s *Socket) GetAdapter() adapters.SocketAdapter

func (*Socket) GetInterfaceIfManaged

func (s *Socket) GetInterfaceIfManaged() *iface.WaterInterfaceWrapper

func (*Socket) HandleInitPacketFragmentation

func (s *Socket) HandleInitPacketFragmentation(enabled bool)

func (*Socket) IsFeatureEnabled

func (s *Socket) IsFeatureEnabled(feature features.Feature) bool

func (*Socket) IsLocalFeature

func (s *Socket) IsLocalFeature(feature features.Feature) bool

func (*Socket) LocalAddr

func (s *Socket) LocalAddr() net.Addr

func (*Socket) MakeAndSendCommand

func (s *Socket) MakeAndSendCommand(parameters commands.CommandParameters) error

func (*Socket) RemoteAddr

func (s *Socket) RemoteAddr() net.Addr

func (*Socket) SendMessage

func (s *Socket) SendMessage(msgType string, message string) error

func (*Socket) Serve

func (s *Socket) Serve()

func (*Socket) SetInterface

func (s *Socket) SetInterface(iface *iface.WaterInterfaceWrapper) error

func (*Socket) SetLocalFeature

func (s *Socket) SetLocalFeature(feature features.Feature, enabled bool)

func (*Socket) SetMTU

func (s *Socket) SetMTU(mtu int)

func (*Socket) SetPacketHandler

func (s *Socket) SetPacketHandler(packetHandler PacketHandler)

func (*Socket) Wait

func (s *Socket) Wait()

func (*Socket) WaitReady

func (s *Socket) WaitReady()

func (*Socket) WritePacket

func (s *Socket) WritePacket(data []byte) error

type SocketConfigurator

type SocketConfigurator interface {
	ConfigureSocket(sock *Socket) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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