udp

package
v0.19.31 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtocolNumber int = 17
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientConn

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

func NewClientConn

func NewClientConn(interceptAddr string, dev io.ReadWriter) (*ClientConn, error)

func (*ClientConn) WriteTo

func (conn *ClientConn) WriteTo(payload []byte, addr net.Addr) (int, error)

type TunUDPManager

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

func NewManager

func NewManager(dev io.ReadWriter) *TunUDPManager

func (*TunUDPManager) CreateEvent

func (manager *TunUDPManager) CreateEvent(srcIP, dstIP net.IP, pdu []byte, release func()) udp_vconn.Event

func (*TunUDPManager) RegisterService

func (manager *TunUDPManager) RegisterService(service *entities.Service, interceptIP net.IP)

func (*TunUDPManager) UnregisterService

func (manager *TunUDPManager) UnregisterService(service string)

type UDP

type UDP []byte

func (UDP) CalculateChecksum

func (b UDP) CalculateChecksum() uint16

func (UDP) Checksum

func (b UDP) Checksum() uint16

Checksum returns the "checksum" field of the tcp header.

func (UDP) DestinationPort

func (b UDP) DestinationPort() uint16

DestinationPort returns the "destination port" field of the udp header.

func (UDP) Encode

func (b UDP) Encode(fields *udpFields)

Encode encodes all the fields of the udp header.

func (UDP) Length

func (b UDP) Length() uint16

SequenceNumber returns the "sequence number" field of the udp header.

func (UDP) Payload

func (b UDP) Payload() []byte

Payload returns the data in the tcp packet.

func (UDP) SetChecksum

func (b UDP) SetChecksum(checksum uint16)

SetChecksum sets the checksum field of the tcp header.

func (UDP) SetDestinationPort

func (b UDP) SetDestinationPort(port uint16)

SetDestinationPort sets the "destination port" field of the tcp header.

func (UDP) SetSourcePort

func (b UDP) SetSourcePort(port uint16)

SetSourcePort sets the "source port" field of the tcp header.

func (UDP) SourcePort

func (b UDP) SourcePort() uint16

SourcePort returns the "source port" field of the udp header.

Jump to

Keyboard shortcuts

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