udp

package
v2.13.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2017 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadUDPMsg

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

func RetrieveOriginalDest

func RetrieveOriginalDest(oob []byte) v2net.Destination

func SetOriginalDestOptions

func SetOriginalDestOptions(fd int) error

Types

type Connection

type Connection struct {
	net.UDPConn
}

func (*Connection) Reusable

func (v *Connection) Reusable() bool

func (*Connection) SetReusable

func (v *Connection) SetReusable(b bool)

type Hub

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

func ListenUDP

func ListenUDP(address v2net.Address, port v2net.Port, option ListenOption) (*Hub, error)

func (*Hub) Addr

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

func (*Hub) Close

func (v *Hub) Close()

func (*Hub) Connection

func (v *Hub) Connection() net.Conn

Connection return the net.Conn underneath this hub. Private: Visible for testing only

func (*Hub) Running

func (v *Hub) Running() bool

func (*Hub) WriteTo

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

type ListenOption

type ListenOption struct {
	Callback            PayloadHandler
	ReceiveOriginalDest bool
	Concurrency         int
}

type Payload

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

Payload represents a single UDP payload.

type PayloadHandler

type PayloadHandler func(*buf.Buffer, *proxy.SessionInfo)

PayloadHandler is function to handle Payload.

type PayloadQueue

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

PayloadQueue is a queue of Payload.

func NewPayloadQueue

func NewPayloadQueue(option ListenOption) *PayloadQueue

NewPayloadQueue returns a new PayloadQueue.

func (*PayloadQueue) Close

func (v *PayloadQueue) Close()

func (*PayloadQueue) Dequeue

func (v *PayloadQueue) Dequeue(queue <-chan Payload)

func (*PayloadQueue) Enqueue

func (v *PayloadQueue) Enqueue(payload Payload)

type ResponseCallback

type ResponseCallback func(destination v2net.Destination, payload *buf.Buffer)

type Server

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

func NewServer

func NewServer(packetDispatcher dispatcher.PacketDispatcher) *Server

func (*Server) Dispatch

func (v *Server) Dispatch(session *proxy.SessionInfo, payload *buf.Buffer, callback ResponseCallback)

func (*Server) RemoveRay

func (v *Server) RemoveRay(name string)

type TimedInboundRay

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

func NewTimedInboundRay

func NewTimedInboundRay(name string, inboundRay ray.InboundRay, server *Server) *TimedInboundRay

func (*TimedInboundRay) InboundInput

func (v *TimedInboundRay) InboundInput() ray.OutputStream

func (*TimedInboundRay) InboundOutput

func (v *TimedInboundRay) InboundOutput() ray.InputStream

func (*TimedInboundRay) Monitor

func (v *TimedInboundRay) Monitor()

func (*TimedInboundRay) Release

func (v *TimedInboundRay) Release()

Jump to

Keyboard shortcuts

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