Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var READBUFFERSIZE = 65535
View Source
var UDPCHANBUFFERSIZE = 1024
View Source
var USERCHANBUFFERSIZE = 1024
Functions ¶
Types ¶
type LoginManager ¶
type LoginManager struct { //key: clientProtocol:clientIP:clientPort value: key for AES Users map[string]*User Tokens map[string]bool Cfg *config.Config TunServer *tun.TunServer DhcpServer *Dhcp Mutex sync.Mutex }
todo: add sync.Mutx for Users change
func NewLoginManager ¶
func NewLoginManager(cfg *config.Config) (*LoginManager, error)
func (*LoginManager) GetUser ¶
func (lm *LoginManager) GetUser(client string) *User
func (*LoginManager) Login ¶
func (lm *LoginManager) Login(client string, protocol string, token string) error
func (*LoginManager) Logout ¶
func (lm *LoginManager) Logout(client string)
func (*LoginManager) Start ¶
func (lm *LoginManager) Start()
func (*LoginManager) StartClient ¶
func (lm *LoginManager) StartClient(client string, conn net.Conn)
type PTcpServer ¶
type PTcpServer struct { Addr string Cfg *config.Config PTcpListener net.Listener LoginManager *LoginManager }
func NewPTcpServer ¶
func NewPTcpServer(cfg *config.Config, loginManager *LoginManager) (*PTcpServer, error)
func (*PTcpServer) Start ¶
func (ts *PTcpServer) Start()
func (*PTcpServer) Stop ¶
func (ts *PTcpServer) Stop()
type TcpServer ¶
type TcpServer struct { Addr string Cfg *config.Config TcpListener net.Listener LoginManager *LoginManager }
func NewTcpServer ¶
func NewTcpServer(cfg *config.Config, loginManager *LoginManager) (*TcpServer, error)
type UdpServer ¶
type UdpServer struct { Addr string UdpConn *net.UDPConn LoginManager *LoginManager TunToConnChan chan string ConnToTunChan chan string RouteMap *cache.Cache }
func NewUdpServer ¶
func NewUdpServer(cfg *config.Config, loginManager *LoginManager) (*UdpServer, error)
Click to show internal directories.
Click to hide internal directories.