udp

package
v2.5.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const HeaderLen = 8

Variables

This section is empty.

Functions

This section is empty.

Types

type Datagram

type Datagram interface {
	ip.Packet
	Header() Header
}

func DatagramFromData

func DatagramFromData(ipHdr ip.Header, data *buffer.Data) Datagram

func NewDatagram

func NewDatagram(ipPayloadLen int, src, dst net.IP) Datagram

type DatagramHandler

type DatagramHandler interface {
	tunnel.Handler
	HandleDatagram(ctx context.Context, dg Datagram)
}

func NewDnsInterceptor

func NewDnsInterceptor(toTun ip.Writer, id tunnel.ConnID, remove func(), dnsAddr *net.UDPAddr) (DatagramHandler, error)

NewDnsInterceptor returns a handler that exchanges messages directly with the given dnsConn instead of passing them on to the traffic-manager

func NewHandler

func NewHandler(stream tunnel.Stream, toTun ip.Writer, id tunnel.ConnID, remove func()) DatagramHandler
type Header []byte

The UDP datagram and its payload

func (Header) Checksum

func (u Header) Checksum() uint16

func (Header) DestinationPort

func (u Header) DestinationPort() uint16

func (Header) Packet

func (u Header) Packet() []byte

func (Header) Payload

func (u Header) Payload() []byte

func (Header) PayloadLen

func (u Header) PayloadLen() uint16

func (Header) SetChecksum

func (u Header) SetChecksum(ipHdr ip.Header)

func (Header) SetDestinationPort

func (u Header) SetDestinationPort(port uint16)

func (Header) SetPayloadLen

func (u Header) SetPayloadLen(l uint16)

func (Header) SetSourcePort

func (u Header) SetSourcePort(port uint16)

func (Header) SourcePort

func (u Header) SourcePort() uint16

func (Header) String

func (u Header) String() string

func (Header) TotalLen

func (u Header) TotalLen() uint16

Jump to

Keyboard shortcuts

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