types

package
v0.0.0-...-db8bf72 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callbacks

type Callbacks struct {
	OnConnectionOpen  func(connection Session)
	OnConnectionClose func(connection Session)

	OnStreamOpenCallback  func(stream Stream)
	OnStreamCloseCallback func(stream Stream, error int)
}

type ClientSession

type ClientSession interface {
	OpenStream() Stream

	Session
}

type Options

type Options interface {
	Get() (bool, string, string, string, string, uint64)
}

type Packet

type Packet struct {
	Streamid   uint64
	Data       []byte
	DataLen    int
	RetAddress *net.UDPAddr
}

func (*Packet) Address

func (p *Packet) Address() (string, int)

func (*Packet) Crc64

func (p *Packet) Crc64() uint64

type ServerConnection

type ServerConnection interface {
	// Accept waits for and returns the next connection to the listener.
	Accept() (Stream, error)

	Session
}

type ServerSession

type ServerSession interface {
	// Accept waits for and returns the next connection to the listener.
	Accept() (ServerConnection, error)

	Session
}

type Session

type Session interface {
	ID() uint64

	OnStreamOpen(uint64)
	OnStreamClose(uint64, int)

	GetStream(uint64) Stream

	StreamPacket(*Packet)

	// Addr returns the listener's network address.
	Addr() net.Addr

	// Close closes the listener.
	// Any blocked Accept operations will be unblocked and return errors.
	Close() error
}

type Stream

type Stream interface {
	net.Conn

	ID() uint64

	OnOpened()
	OnReceived([]byte, int)
	OnClosed() error
}

Jump to

Keyboard shortcuts

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