server

package
v0.0.0-...-b4be9a7 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UPool map[string]*UClient

Functions

func HandleKeepalive

func HandleKeepalive(ipAddr, raddr string, svc *Server) error

func Run

func Run(cCtx *cli.Context) error

Types

type EpEntry

type EpEntry struct {
	User   string
	Addr   string
	Iface  string
	IP     string
	TX_PKT uint64
	RX_PKT uint64
	TX     string
	RX     string
	Login  string
}

type Server

type Server struct {
	*config.ServerConfig

	UsedIP  []int
	IPStart net.IP
	IPCount int
	MLock   sync.Mutex
	Routes  map[string]string // Nexthop username as key, user ipv4 addr as value
	// contains filtered or unexported fields
}

func NewServer

func NewServer() *Server

func (*Server) CreateClientForAddr

func (svc *Server) CreateClientForAddr(addr *net.UDPAddr, conn *net.UDPConn, username string) (*UClient, error)

func (*Server) GetRouteEntries

func (svc *Server) GetRouteEntries() map[string]string

func (*Server) GetRouteStreams

func (svc *Server) GetRouteStreams() []byte

func (*Server) GetRoutes

func (svc *Server) GetRoutes() string

func (*Server) HandleSignal

func (svc *Server) HandleSignal(sigChan chan os.Signal)

func (*Server) IPForUser

func (svc *Server) IPForUser(username string) (net.IP, error)

func (*Server) IPFromIdx

func (svc *Server) IPFromIdx(idx int) net.IP

func (*Server) IPIdxInPool

func (svc *Server) IPIdxInPool(idx int) bool

func (*Server) IPInPool

func (svc *Server) IPInPool(ip net.IP) bool

func (*Server) IdxFromIP

func (svc *Server) IdxFromIP(ip net.IP) int

func (*Server) InitRoutes

func (svc *Server) InitRoutes()

func (*Server) ListenAndServe

func (svc *Server) ListenAndServe() error

func (*Server) MulticastRoutes

func (svc *Server) MulticastRoutes() error

func (*Server) OfferIPToClient

func (svc *Server) OfferIPToClient(conn *net.UDPConn, ip string, raddr *net.UDPAddr) error

func (*Server) ParseDHCPRange

func (svc *Server) ParseDHCPRange() error

func (*Server) PopIPFromPool

func (svc *Server) PopIPFromPool() (net.IP, error)

func (*Server) ReleaseIP

func (svc *Server) ReleaseIP(ip net.IP)

func (*Server) SendResponse

func (svc *Server) SendResponse(conn *net.UDPConn, code uint16, raddr *net.UDPAddr)

func (*Server) SetupLan

func (svc *Server) SetupLan() error

func (*Server) Teardown

func (svc *Server) Teardown()

func (*Server) UpdateRoutes

func (svc *Server) UpdateRoutes(nexthop, ip string)

type UClient

type UClient struct {
	Conn       *net.UDPConn
	RAddr      *net.UDPAddr
	Iface      *water.Interface
	NetToIface chan *packet.VLPkt
	Once       sync.Once
	User       string
	IP         net.IP
	Login      string
	Beat       chan string
	CloseChan  chan string
	Svc        *Server
}

func (*UClient) Close

func (client *UClient) Close()

func (*UClient) Countdown

func (client *UClient) Countdown()

func (*UClient) Handle

func (client *UClient) Handle()

func (*UClient) HandleOnce

func (client *UClient) HandleOnce()

Jump to

Keyboard shortcuts

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