udp

package
v3.11.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadUDPMsg added in v1.24.4

func ReadUDPMsg(conn *net.UDPConn, payload []byte, oob []byte) (int, int, int, *net.UDPAddr, error)

func RetrieveOriginalDest added in v1.24.2

func RetrieveOriginalDest(oob []byte) net.Destination

func SetOriginalDestOptions added in v1.24.2

func SetOriginalDestOptions(fd int) error

func TransmitSocket

func TransmitSocket(src net.Addr, dst net.Addr) (net.Conn, error)

Currently, Only IPv4 Forge is supported

Types

type Dispatcher

type Dispatcher struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewDispatcher

func NewDispatcher(dispatcher core.Dispatcher) *Dispatcher

func (*Dispatcher) Dispatch

func (v *Dispatcher) Dispatch(ctx context.Context, destination net.Destination, payload *buf.Buffer, callback ResponseCallback)

func (*Dispatcher) RemoveRay

func (v *Dispatcher) RemoveRay(dest net.Destination)

type Hub

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

func ListenUDP

func ListenUDP(address net.Address, port net.Port, callback PayloadHandler, options ...HubOption) (*Hub, error)

func (*Hub) Addr

func (h *Hub) Addr() net.Addr

Addr implements net.Listener.

func (*Hub) Close

func (h *Hub) Close() error

Close implements net.Listener.

func (*Hub) WriteTo

func (h *Hub) WriteTo(payload []byte, dest net.Destination) (int, error)

type HubOption

type HubOption func(h *Hub)

func HubCapacity

func HubCapacity(cap int) HubOption

func HubReceiveOriginalDestination

func HubReceiveOriginalDestination(r bool) HubOption

type Payload

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

Payload represents a single UDP payload.

type PayloadHandler

type PayloadHandler func(payload *buf.Buffer, source net.Destination, originalDest net.Destination)

PayloadHandler is function to handle Payload.

type ResponseCallback

type ResponseCallback func(payload *buf.Buffer)

Jump to

Keyboard shortcuts

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