udp

package
v0.0.0-...-928a51f Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2022 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewListener

func NewListener(conn net.PacketConn, addr net.Addr, backlog, dataQueueSize, dataBufferSize int, ttl time.Duration, logger logger.Logger) net.Listener

Types

type Conn

type Conn struct {
	net.PacketConn
	// contains filtered or unexported fields
}

Conn is a server side connection for UDP client peer, it implements net.Conn and net.PacketConn.

func NewConn

func NewConn(c net.PacketConn, localAddr, remoteAddr net.Addr, queueSize int) *Conn

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) IsIdle

func (c *Conn) IsIdle() bool

func (*Conn) LocalAddr

func (c *Conn) LocalAddr() net.Addr

func (*Conn) Read

func (c *Conn) Read(b []byte) (n int, err error)

func (*Conn) ReadFrom

func (c *Conn) ReadFrom(b []byte) (n int, addr net.Addr, err error)

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

func (*Conn) SetIdle

func (c *Conn) SetIdle(idle bool)

func (*Conn) Write

func (c *Conn) Write(b []byte) (n int, err error)

func (*Conn) WriteQueue

func (c *Conn) WriteQueue(b []byte) error

type ConnPool

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

func NewConnPool

func NewConnPool(ttl time.Duration) *ConnPool

func (*ConnPool) Close

func (p *ConnPool) Close()

func (*ConnPool) Delete

func (p *ConnPool) Delete(key any)

func (*ConnPool) Get

func (p *ConnPool) Get(key any) (c *Conn, ok bool)

func (*ConnPool) Set

func (p *ConnPool) Set(key any, c *Conn)

func (*ConnPool) WithLogger

func (p *ConnPool) WithLogger(logger logger.Logger) *ConnPool

Jump to

Keyboard shortcuts

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