udpc

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitConn added in v0.3.9

func InitConn(ctx contextx.Context, lAddr *net.UDPAddr, f Handle) error

func LocalAddr added in v0.2.4

func LocalAddr() net.Addr

func SendBinaryMsg

func SendBinaryMsg(addr *net.UDPAddr, data []byte) error

func SendTextMsg

func SendTextMsg(addr *net.UDPAddr, data []byte) error

Types

type Client added in v0.2.5

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

func New added in v0.2.5

func New(ctx contextx.Context, opfs ...func(opt *ClientOption)) (*Client, error)

func (*Client) Close added in v0.2.5

func (c *Client) Close()

func (*Client) SendBinaryMsg added in v0.2.5

func (c *Client) SendBinaryMsg(data []byte) error

func (*Client) SendTextMsg added in v0.2.5

func (c *Client) SendTextMsg(data []byte) error

type ClientOption added in v0.2.5

type ClientOption struct {
	MaxPkgSize   int
	WriteTimeout time.Duration
	OnMsgHandle  RespHandle
	SrcAddr      *net.UDPAddr
	TargetAddr   *net.UDPAddr
}

type Handle added in v0.3.9

type Handle func(rAddr *net.UDPAddr, msgType udpx.MsgType, payload []byte)

type Option added in v0.3.9

type Option struct {
	RAddr        *net.UDPAddr
	MaxPkgSize   int
	WriteTimeout time.Duration
}

type RespHandle

type RespHandle func(msgType udpx.MsgType, data []byte)

type SetConfig added in v0.3.9

type SetConfig func(maxPkgSize int)

Jump to

Keyboard shortcuts

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