Documentation ¶
Overview ¶
=====================================================================
UdpClient.go -
Created by skywind on 2024/11/17 Last Modified: 2024/11/17 05:47:05
=====================================================================
=====================================================================
UdpForward.go -
Created by skywind on 2024/11/18 Last Modified: 2024/11/18 17:19:16
=====================================================================
=====================================================================
UdpMetric.go -
Last Modified: 2024/11/17 01:12:26
=====================================================================
=====================================================================
UdpSocket.go - UdpSocket implementation ¶
Last Modified: 2024/07/15 10:25:24
=====================================================================
=====================================================================
utils.go -
Created by skywind on 2024/11/17 Last Modified: 2024/11/17 01:12:48
=====================================================================
Index ¶
- Constants
- func AddressClone(addr *net.UDPAddr) *net.UDPAddr
- func AddressParse(addr *net.UDPAddr, ip string, port int)
- func AddressResolve(address string) *net.UDPAddr
- func AddressSet(dst *net.UDPAddr, src *net.UDPAddr) *net.UDPAddr
- func AddressString(addr *net.UDPAddr) string
- func EncryptRC4(dst []byte, src []byte, key []byte) bool
- func HexDump(p []byte, char_visible bool, limit int) string
- type UdpClient
- func (self *UdpClient) Close()
- func (self *UdpClient) Open(srcAddr *net.UDPAddr, dstAddr *net.UDPAddr) error
- func (self *UdpClient) SendTo(data []byte) error
- func (self *UdpClient) SetCallback(receiver func(client *UdpClient, data []byte) error)
- func (self *UdpClient) SetCloser(closer func(client *UdpClient))
- type UdpForward
- type UdpMetric
- type UdpSocket
- func (self *UdpSocket) Close()
- func (self *UdpSocket) GetMetric() *UdpMetric
- func (self *UdpSocket) IsClosing() bool
- func (self *UdpSocket) Open(addr *net.UDPAddr, count int) error
- func (self *UdpSocket) SendBatch(data [][]byte, addr []*net.UDPAddr) int
- func (self *UdpSocket) SendTo(data []byte, addr *net.UDPAddr) int
- func (self *UdpSocket) SetCallback(receiver func(data []byte, addr *net.UDPAddr) error)
- func (self *UdpSocket) SetLogError(logger *log.Logger)
- func (self *UdpSocket) SetLogPacket(logger *log.Logger)
- func (self *UdpSocket) SetOption(option int, value interface{}) error
Constants ¶
const (
UDP_RECV_COUNT int = 1
)
Variables ¶
This section is empty.
Functions ¶
func AddressResolve ¶
func AddressString ¶
Types ¶
type UdpClient ¶
type UdpClient struct {
// contains filtered or unexported fields
}
udp session
func NewUdpClient ¶
func NewUdpClient() *UdpClient
func (*UdpClient) SetCallback ¶
type UdpForward ¶
type UdpForward struct {
// contains filtered or unexported fields
}
udp forward
func NewUdpForward ¶
func NewUdpForward() *UdpForward
func (*UdpForward) Close ¶
func (self *UdpForward) Close()
func (*UdpForward) SetLogger ¶
func (self *UdpForward) SetLogger(logger *log.Logger)
func (*UdpForward) SetMark ¶
func (self *UdpForward) SetMark(mark uint32)
type UdpMetric ¶
type UdpMetric struct { PacketReceived atomic.Int64 // packet received PacketSent atomic.Int64 // packet sent PacketDropped atomic.Int64 // error received }
func (*UdpMetric) IncPacketDropped ¶
func (self *UdpMetric) IncPacketDropped()
func (*UdpMetric) IncPacketReceived ¶
func (self *UdpMetric) IncPacketReceived()
func (*UdpMetric) IncPacketSent ¶
func (self *UdpMetric) IncPacketSent()
type UdpSocket ¶
type UdpSocket struct {
// contains filtered or unexported fields
}
basic udp socket implementation
func NewUdpSocket ¶
func NewUdpSocket() *UdpSocket