Documentation ¶
Overview ¶
Package udpproxy provides an API for proxying UDP messages.
Index ¶
- type Backend
- type Frontend
- func (fe *Frontend) AddBackend(name, addr string) (*Backend, error)
- func (fe *Frontend) ClearTouch()
- func (fe *Frontend) Close()
- func (fe *Frontend) Multicast(msg []byte, sender *net.UDPAddr)
- func (fe *Frontend) RemoveUntouched()
- func (fe *Frontend) RoundRobin(msg []byte, sender *net.UDPAddr)
- func (fe *Frontend) Serve()
- func (fe *Frontend) String() string
- type Proxy
- type Scheduler
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct { Name string Addr *net.UDPAddr MessageSentCount uint MessageRecvCount uint Responder chan []byte Touched bool }
Backend is the UDP backend
func NewBackend ¶
NewBackend spawns a new UDP backend.
func (*Backend) CreateConnection ¶
CreateConnection spawnes a new UDP connection for given Backend.
type Frontend ¶
type Frontend struct { Name string Conn *net.UDPConn Scheduler Scheduler Backends []*Backend ResponseTimeout time.Duration }
Frontend represents a UDP frontend
func NewFrontend ¶
NewFrontend spawns a new UDP frontend.
func (*Frontend) AddBackend ¶
AddBackend extends given UDP Frontend with a new backend.
func (*Frontend) ClearTouch ¶
func (fe *Frontend) ClearTouch()
ClearTouch clears out any touch-flags on all backends to this frontend.
func (*Frontend) Close ¶
func (fe *Frontend) Close()
Close releases underlying sockets to given UDP frontend.
func (*Frontend) RemoveUntouched ¶
func (fe *Frontend) RemoveUntouched()
RemoveUntouched kills all backends that haven't been touched with Touch().
func (*Frontend) RoundRobin ¶
RoundRobin sends the given message in round-robin fasion to exactly one backend.
type Proxy ¶
type Proxy struct { // listen on downstreams and pass them upstream Frontends map[string]*Frontend // contains filtered or unexported fields }
Proxy represents a generic UDP proxy for many UDP frontends
func (*Proxy) AddFrontend ¶
AddFrontend does what it says ;-)
func (*Proxy) AddOrReplaceFrontend ¶
AddOrReplaceFrontend does what it says. ;-)