Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn represents an on-going session with a client, over UDP packets.
type Handler ¶
type Handler interface {
ServeUDP(conn *Conn)
}
Handler is the UDP counterpart of the usual HTTP handler.
type HandlerFunc ¶
type HandlerFunc func(conn *Conn)
The HandlerFunc type is an adapter to allow the use of ordinary functions as handlers.
func (HandlerFunc) ServeUDP ¶
func (f HandlerFunc) ServeUDP(conn *Conn)
ServeUDP implements the Handler interface for UDP.
type HandlerSwitcher ¶
type HandlerSwitcher struct {
// contains filtered or unexported fields
}
HandlerSwitcher is a switcher implementation of the Handler interface.
func (*HandlerSwitcher) ServeUDP ¶
func (s *HandlerSwitcher) ServeUDP(conn *Conn)
ServeUDP implements the Handler interface.
func (*HandlerSwitcher) Switch ¶
func (s *HandlerSwitcher) Switch(handler Handler)
Switch replaces s handler with the given handler.
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener augments a session-oriented Listener over a UDP PacketConn.
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy is a reverse-proxy implementation of the Handler interface.
type WRRLoadBalancer ¶
type WRRLoadBalancer struct {
// contains filtered or unexported fields
}
WRRLoadBalancer is a naive RoundRobin load balancer for UDP services.
func NewWRRLoadBalancer ¶
func NewWRRLoadBalancer() *WRRLoadBalancer
NewWRRLoadBalancer creates a new WRRLoadBalancer.
func (*WRRLoadBalancer) AddServer ¶
func (b *WRRLoadBalancer) AddServer(serverHandler Handler)
AddServer appends a handler to the existing list.
func (*WRRLoadBalancer) AddWeightedServer ¶
func (b *WRRLoadBalancer) AddWeightedServer(serverHandler Handler, weight *int)
AddWeightedServer appends a handler to the existing list with a weight.
func (*WRRLoadBalancer) ServeUDP ¶
func (b *WRRLoadBalancer) ServeUDP(conn *Conn)
ServeUDP forwards the connection to the right service.