Documentation ¶
Index ¶
- Constants
- Variables
- func Dnat(data []byte, dst string)
- func InitInnerNetConfig(innerNetDataDto innerNet.SlaveInnerNetDataDto) error
- func Snat(data []byte, src string)
- func StartServer(innerNetDataDto innerNet.SlaveInnerNetDataDto) (err error)
- func StopServer() error
- type Dhcp
- type LoginManager
- func (lm *LoginManager) GetUser(client string) *User
- func (lm *LoginManager) Login(client string, protocol string, token string, conn net.Conn) error
- func (lm *LoginManager) Logout(client string)
- func (lm *LoginManager) Start()
- func (lm *LoginManager) StartClient(client string, conn net.Conn)
- func (lm *LoginManager) Stop()
- type TcpServer
- type User
Constants ¶
View Source
const Mtu = 1500
Variables ¶
View Source
var READBUFFERSIZE = 65535
View Source
var USERCHANBUFFERSIZE = 1024
View Source
var UserPrivileges []*innerNet.InnerNetPrivilegeDto
Functions ¶
func InitInnerNetConfig ¶
func InitInnerNetConfig(innerNetDataDto innerNet.SlaveInnerNetDataDto) error
func StartServer ¶
func StartServer(innerNetDataDto innerNet.SlaveInnerNetDataDto) (err error)
func StopServer ¶
func StopServer() error
Types ¶
type Dhcp ¶
type Dhcp struct { InnerNetDataDto *innerNet.SlaveInnerNetDataDto Ip uint32 Mask uint32 UsedIps map[uint32]bool }
func NewDhcp ¶
func NewDhcp(vpnDataDto *innerNet.SlaveInnerNetDataDto) *Dhcp
type LoginManager ¶
type LoginManager struct { //key: clientProtocol:clientIP:clientPort value: key for AES Users map[string]*User Tokens map[string]innerNet.InnerNetUserDto InnerNetDataDto *innerNet.SlaveInnerNetDataDto TunServer *iface.TunServer DhcpServer *Dhcp Mutex sync.Mutex }
todo: add sync.Mutx for Users change
func NewLoginManager ¶
func NewLoginManager(innerNetDataDto innerNet.SlaveInnerNetDataDto) (*LoginManager, error)
func (*LoginManager) GetUser ¶
func (lm *LoginManager) GetUser(client string) *User
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)
func (*LoginManager) Stop ¶
func (lm *LoginManager) Stop()
type TcpServer ¶
type TcpServer struct { Addr string InnerNetDataDto *innerNet.SlaveInnerNetDataDto TcpListener net.Listener LoginManager *LoginManager }
func NewTcpServer ¶
func NewTcpServer(innerNetDataDto innerNet.SlaveInnerNetDataDto, loginManager *LoginManager) (*TcpServer, error)
Click to show internal directories.
Click to hide internal directories.