udp

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UDP_READ_MAX                    = 64 * 1024
	UDP_PACKET_BUFFER               = 64 * 1024
	UDP_PACKET_BUFFER_CHUNKED_LIMIT = 48 * 1024
	UDP_PACKET_CHANNEL_MAX          = 2048
	UDP_PACKET_FLUSH_TIMEOUT        = 10 * 1000

	UDP_PACKET_HEADER_SIZE = 9
	// typ pos 0
	UDP_PACKET_HEADER_TYPE_POS = 0
	// ver pos 1
	UDP_PACKET_HEADER_VER_POS = 1
	// len pos 5
	UDP_PACKET_HEADER_LEN_POS = 5

	UDP_PACKET_SQL_MAX_SIZE = 32768
)

Variables

This section is empty.

Functions

func UdpShutdown

func UdpShutdown()

Types

type UdpClient

type UdpClient struct {
	// contains filtered or unexported fields
}

func GetUdpClient

func GetUdpClient(opts ...UdpClientOption) *UdpClient

func (*UdpClient) AddCount added in v0.0.15

func (this *UdpClient) AddCount(packCount, chanCount, sendCount, flushErrCount, errCount int, reset bool)

func (*UdpClient) ApplyConfig added in v0.0.15

func (this *UdpClient) ApplyConfig(conf config.Config)

implements common.ConfigObserver

func (*UdpClient) Close

func (this *UdpClient) Close()

func (*UdpClient) GetLocalAddr

func (this *UdpClient) GetLocalAddr() net.Addr

func (*UdpClient) Send

func (this *UdpClient) Send(p udp.UdpPack)

func (*UdpClient) SendRelay

func (this *UdpClient) SendRelay(p pack.Pack, flush bool)

func (*UdpClient) Shutdown

func (this *UdpClient) Shutdown()

type UdpClientOption added in v0.0.15

type UdpClientOption interface {
	// contains filtered or unexported methods
}

func WithConfigObserver added in v0.0.15

func WithConfigObserver(obj *config.ConfigObserver) UdpClientOption

func WithContext added in v0.0.15

func WithContext(ctx context.Context, cancel context.CancelFunc) UdpClientOption

func WithLogger added in v0.0.15

func WithLogger(logger logger.Logger) UdpClientOption

func WithUdpServer added in v0.0.15

func WithUdpServer(host string, port int) UdpClientOption

type UdpData

type UdpData struct {
	Type  byte
	Ver   int32
	Data  []byte
	Flush bool
}

Jump to

Keyboard shortcuts

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