udpx

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package udpx Create on 2023/8/5 @author xuzhuoxi

Index

Constants

View Source
const (
	UDPBuffLength = 4096
)

Variables

View Source
var UdpDataBlockHandler = bytex.NewDefaultDataBlockHandler()

Functions

func GetUDPAddr

func GetUDPAddr(network string, address string) (*net.UDPAddr, error)

func UDPAddrEqual

func UDPAddrEqual(addr1 *net.UDPAddr, addr2 *net.UDPAddr) bool

Types

type IUDPClient

type IUDPClient interface {
	netx.ISockClient
}

func NewUDP4DialClient

func NewUDP4DialClient() IUDPClient

func NewUDP4ListenClient

func NewUDP4ListenClient() IUDPClient

func NewUDP6DialClient

func NewUDP6DialClient() IUDPClient

func NewUDP6ListenClient

func NewUDP6ListenClient() IUDPClient

func NewUDPDialClient

func NewUDPDialClient() IUDPClient

func NewUDPListenClient

func NewUDPListenClient() IUDPClient

type IUDPServer

type IUDPServer interface {
	netx.ISockServer
	eventx.IEventDispatcher
}

func NewUDP4Server

func NewUDP4Server() IUDPServer

func NewUDP6Server

func NewUDP6Server() IUDPServer

func NewUDPServer

func NewUDPServer() IUDPServer

type UDPConnAdapter

type UDPConnAdapter struct {
	ReadWriter *net.UDPConn
}

func (*UDPConnAdapter) ReadBytes

func (rw *UDPConnAdapter) ReadBytes(bytes []byte) (n int, address string, err error)

func (*UDPConnAdapter) RemoteAddress

func (rw *UDPConnAdapter) RemoteAddress() string

func (*UDPConnAdapter) WriteBytes

func (rw *UDPConnAdapter) WriteBytes(bytes []byte, rAddress ...string) (n int, err error)

type UDPDialClient

type UDPDialClient struct {
	netx.SockClientBase
}

func (*UDPDialClient) CloseClient

func (c *UDPDialClient) CloseClient() error

func (*UDPDialClient) OpenClient

func (c *UDPDialClient) OpenClient(params netx.SockParams) error

type UDPListenClient

type UDPListenClient struct {
	netx.SockClientBase
}

func (*UDPListenClient) CloseClient

func (c *UDPListenClient) CloseClient() error

func (*UDPListenClient) OpenClient

func (c *UDPListenClient) OpenClient(params netx.SockParams) error

type UDPServer

type UDPServer struct {
	eventx.EventDispatcher
	netx.SockServerBase
	lang.ChannelLimitNone
	// contains filtered or unexported fields
}

func (*UDPServer) CloseConnection

func (s *UDPServer) CloseConnection(address string) (err error, ok bool)

func (*UDPServer) Connections

func (s *UDPServer) Connections() int

func (*UDPServer) FindConnection added in v1.0.4

func (s *UDPServer) FindConnection(address string) (conn netx.IServerConn, ok bool)

func (*UDPServer) SendBytesTo

func (s *UDPServer) SendBytesTo(bytes []byte, rAddress ...string) error

func (*UDPServer) SendPackTo

func (s *UDPServer) SendPackTo(pack []byte, rAddress ...string) error

func (*UDPServer) SetMaxConn added in v1.0.4

func (s *UDPServer) SetMaxConn(max int)

func (*UDPServer) StartServer

func (s *UDPServer) StartServer(params netx.SockParams) error

func (*UDPServer) StopServer

func (s *UDPServer) StopServer() error

type UdpSockConn added in v1.0.4

type UdpSockConn struct {
	Address string
	SRProxy netx.IPackSendReceiver
}

func (*UdpSockConn) ClientAddress added in v1.0.4

func (o *UdpSockConn) ClientAddress() string

func (*UdpSockConn) CloseConn added in v1.0.4

func (o *UdpSockConn) CloseConn() error

func (*UdpSockConn) SendBytes added in v1.0.4

func (o *UdpSockConn) SendBytes(bytes []byte) error

func (*UdpSockConn) SendPack added in v1.0.4

func (o *UdpSockConn) SendPack(data []byte) error

Jump to

Keyboard shortcuts

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