server

package
v0.0.0-...-b9f95b1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2017 License: MIT Imports: 11 Imported by: 1

Documentation

Overview

Package server UDP server

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromIPPort

func FromIPPort(ip string, port int) *net.UDPAddr

FromIPPort is a quick helper to create an UDPAddr object

Types

type Connection

type Connection struct {
	Target    *net.UDPConn
	Client    *net.UDPAddr
	Terminate chan bool

	LastClientActivity time.Time
}

type Server

type Server struct {
	Terminate chan bool

	Config *config.Server
	Addr   *net.UDPAddr
	Conn   *net.UDPConn

	ConnectionPool map[uint32]Connection

	PassUpstream *upstream.Upstream
	PassHost     *net.UDPAddr
	PassPort     int
	// contains filtered or unexported fields
}

func MustNewServer

func MustNewServer(cfg *config.Server, upstreams []*upstream.Upstream) *Server

func NewServer

func NewServer(cfg *config.Server, upstreams []*upstream.Upstream) (*Server, error)

func (*Server) HandleClient

func (m *Server) HandleClient(hash uint32, from *net.UDPAddr, to *net.UDPAddr, data []byte) error

func (*Server) ListenTarget

func (m *Server) ListenTarget(hash uint32, c Connection)

ListenTarget listens to incoming data returned by a target and bounces it back to the client

func (*Server) LoadBalanceUDP

func (m *Server) LoadBalanceUDP()

func (*Server) MustStart

func (m *Server) MustStart()

func (*Server) Start

func (m *Server) Start() error

func (*Server) Stop

func (m *Server) Stop()

Jump to

Keyboard shortcuts

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