forward

package
v0.0.0-...-26ee22c Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 8 Imported by: 0

README

placeholder

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

View Source
const (
	UDP_RECV_COUNT int = 1
)

Variables

This section is empty.

Functions

func AddressClone

func AddressClone(addr *net.UDPAddr) *net.UDPAddr

func AddressParse

func AddressParse(addr *net.UDPAddr, ip string, port int)

func AddressResolve

func AddressResolve(address string) *net.UDPAddr

func AddressSet

func AddressSet(dst *net.UDPAddr, src *net.UDPAddr) *net.UDPAddr

func AddressString

func AddressString(addr *net.UDPAddr) string

func EncryptRC4

func EncryptRC4(dst []byte, src []byte, key []byte) bool

func HexDump

func HexDump(p []byte, char_visible bool, limit int) string

Types

type UdpClient

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

udp session

func NewUdpClient

func NewUdpClient() *UdpClient

func (*UdpClient) Close

func (self *UdpClient) Close()

func (*UdpClient) Open

func (self *UdpClient) Open(srcAddr *net.UDPAddr, dstAddr *net.UDPAddr) error

func (*UdpClient) SendTo

func (self *UdpClient) SendTo(data []byte) error

func (*UdpClient) SetCallback

func (self *UdpClient) SetCallback(receiver func(client *UdpClient, data []byte) error)

func (*UdpClient) SetCloser

func (self *UdpClient) SetCloser(closer func(client *UdpClient))

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) Open

func (self *UdpForward) Open(srcAddr *net.UDPAddr, dstAddr *net.UDPAddr, mask string) error

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) Clear

func (self *UdpMetric) Clear()

func (*UdpMetric) Clone

func (self *UdpMetric) Clone() *UdpMetric

func (*UdpMetric) IncPacketDropped

func (self *UdpMetric) IncPacketDropped()

func (*UdpMetric) IncPacketReceived

func (self *UdpMetric) IncPacketReceived()

func (*UdpMetric) IncPacketSent

func (self *UdpMetric) IncPacketSent()

func (*UdpMetric) String

func (self *UdpMetric) String() string

type UdpSocket

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

basic udp socket implementation

func NewUdpSocket

func NewUdpSocket() *UdpSocket

func (*UdpSocket) Close

func (self *UdpSocket) Close()

func (*UdpSocket) GetMetric

func (self *UdpSocket) GetMetric() *UdpMetric

func (*UdpSocket) IsClosing

func (self *UdpSocket) IsClosing() bool

func (*UdpSocket) Open

func (self *UdpSocket) Open(addr *net.UDPAddr, count int) error

func (*UdpSocket) SendBatch

func (self *UdpSocket) SendBatch(data [][]byte, addr []*net.UDPAddr) int

func (*UdpSocket) SendTo

func (self *UdpSocket) SendTo(data []byte, addr *net.UDPAddr) int

func (*UdpSocket) SetCallback

func (self *UdpSocket) SetCallback(receiver func(data []byte, addr *net.UDPAddr) error)

func (*UdpSocket) SetLogError

func (self *UdpSocket) SetLogError(logger *log.Logger)

func (*UdpSocket) SetLogPacket

func (self *UdpSocket) SetLogPacket(logger *log.Logger)

func (*UdpSocket) SetOption

func (self *UdpSocket) SetOption(option int, value interface{}) error

Jump to

Keyboard shortcuts

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