Documentation ¶
Index ¶
- Constants
- Variables
- func AesDecrypt(crypted, key []byte) ([]byte, error)
- func AesEncrypt(origData, key []byte) ([]byte, error)
- func ExecuteCommand(name string, args ...string) ([]byte, error)
- func GetHostByEndpoint(endpoint string) (string, error)
- func GetRemoteIPByEndpoint(endpoint string) (string, error)
- func PKCS7Padding(ciphertext []byte, blockSize int) []byte
- func PKCS7UnPadding(origData []byte) []byte
- func PanicHandler()
- func PanicHandlerExit()
- func ReadPacket(conn io.Reader) ([]byte, error)
- func RunCommand(name string, args ...string) error
- func SetLogger(elog *elog.EasyLogger)
- type Conn
- type DarwinNetworkManager
- type Http3Conn
- func (h3c *Http3Conn) Close(flag bool) error
- func (h3c *Http3Conn) Connect(endpoint string, user string, pwd string, ip string, sni string, ...) error
- func (h3c *Http3Conn) GetUpDownBytes() (uint64, uint64)
- func (h3c *Http3Conn) IsClosed() bool
- func (h3c *Http3Conn) Send(pkt []byte)
- func (h3c *Http3Conn) SetHandler(cmd uint16, handler func(PolePacket, Conn))
- func (h3c *Http3Conn) StartProcess()
- func (h3c *Http3Conn) String() string
- type IosTunFile
- type LinuxNetworkManager
- type NetworkManager
- type PolePacket
- type PoleVpnClient
- func (pc *PoleVpnClient) AskAllocIPAddress()
- func (pc *PoleVpnClient) AttachTunDevice(device *TunDevice)
- func (pc *PoleVpnClient) CloseConnect(flag bool)
- func (pc *PoleVpnClient) GetRemoteIP() string
- func (pc *PoleVpnClient) GetUpDownBytes() (uint64, uint64)
- func (pc *PoleVpnClient) HeartBeat()
- func (pc *PoleVpnClient) IsStoped() bool
- func (pc *PoleVpnClient) SendHeartBeat()
- func (pc *PoleVpnClient) SetEventHandler(handler func(int, *PoleVpnClient, *anyvalue.AnyValue))
- func (pc *PoleVpnClient) Start(endpoint string, user string, pwd string, sni string, skipVerifySSL bool, ...) error
- func (pc *PoleVpnClient) Stop()
- func (pc *PoleVpnClient) WaitStop()
- type TunDevice
- type TunIO
- type WebSocketConn
- func (wsc *WebSocketConn) Close(flag bool) error
- func (wsc *WebSocketConn) Connect(endpoint string, user string, pwd string, ip string, sni string, ...) error
- func (wsc *WebSocketConn) GetUpDownBytes() (uint64, uint64)
- func (wsc *WebSocketConn) IsClosed() bool
- func (wsc *WebSocketConn) Send(pkt []byte)
- func (wsc *WebSocketConn) SetHandler(cmd uint16, handler func(PolePacket, Conn))
- func (wsc *WebSocketConn) StartProcess()
- func (wsc *WebSocketConn) String() string
- type WindowsNetworkManager
Constants ¶
View Source
const ( CH_HTTP3_WRITE_SIZE = 100 HTTP3_HANDSHAKE_TIMEOUT = 5 )
View Source
const ( CMD_ALLOC_IPADDR = 0x1 CMD_S2C_IPDATA = 0x2 CMD_C2S_IPDATA = 0x3 CMD_HEART_BEAT = 0x4 CMD_CLIENT_CLOSED = 0x5 CMD_KICK_OUT = 0x6 CMD_USER_AUTH = 0x7 )
View Source
const ( POLE_CLIENT_INIT = 0 POLE_CLIENT_RUNING = 1 POLE_CLIENT_CLOSED = 2 POLE_CLIENT_RECONNETING = 3 )
View Source
const ( VERSION_IP_V4 = 4 VERSION_IP_V6 = 6 TUN_DEVICE_CH_WRITE_SIZE = 200 HEART_BEAT_INTERVAL = 10 RECONNECT_TIMES = 600000000 RECONNECT_INTERVAL = 5 WEBSOCKET_NO_HEARTBEAT_TIMES = 2 )
View Source
const ( CLIENT_EVENT_ADDRESS_ALLOCED = 1 CLIENT_EVENT_RECONNECTING = 2 CLIENT_EVENT_STARTED = 3 CLIENT_EVENT_STOPPED = 4 CLIENT_EVENT_ERROR = 5 CLIENT_EVENT_RECONNECTED = 6 )
View Source
const ( ERROR_LOGIN = "login" ERROR_NETWORK = "network" ERROR_UNKNOWN = "unknown" ERROR_IO = "io" ERROR_ALLOC = "alloc" )
View Source
const ( IP4_HEADER_LEN = 20 TCP_HEADER_LEN = 20 UDP_HEADER_LEN = 8 DNS_PORT = 53 MTU = 1504 )
View Source
const ( CH_WEBSOCKET_WRITE_SIZE = 100 WEBSOCKET_HANDSHAKE_TIMEOUT = 5 WEBSOCKET_READ_TIMEOUT = 30 WEBSOCKET_TCP_WRITE_BUFFER_SIZE = 524288 WEBSOCKET_TCP_READ_BUFFER_SIZE = 524288 )
View Source
const (
POLE_PACKET_HEADER_LEN = 4
)
Variables ¶
View Source
var AesKey = []byte{0x15, 0xfc, 0xf2, 0x66, 0x78, 0x10, 0x5a, 0x34, 0xef, 0x5e, 0xac, 0xcb, 0x6f, 0x78, 0x53, 0xdc}
View Source
var ErrConnectUnknown = errors.New("server unknown error")
View Source
var ErrIPNotExist = errors.New("reconnect ip is not exist")
View Source
var ErrLoginVerify = errors.New("login verify fail")
View Source
var ErrNetwork = errors.New("network error")
Functions ¶
func GetHostByEndpoint ¶
func GetRemoteIPByEndpoint ¶
func PKCS7Padding ¶
func PKCS7UnPadding ¶
func PanicHandler ¶
func PanicHandler()
func PanicHandlerExit ¶
func PanicHandlerExit()
func RunCommand ¶
func SetLogger ¶
func SetLogger(elog *elog.EasyLogger)
Types ¶
type Conn ¶
type Conn interface { Connect(endpoint string, user string, pwd string, ip string, sni string, skipVerifySSL bool, deviceType string, deviceId string, header http.Header) error Close(flag bool) error String() string IsClosed() bool SetHandler(cmd uint16, handler func(PolePacket, Conn)) Send(pkt []byte) StartProcess() GetUpDownBytes() (uint64, uint64) }
type DarwinNetworkManager ¶
type DarwinNetworkManager struct {
// contains filtered or unexported fields
}
func NewDarwinNetworkManager ¶
func NewDarwinNetworkManager() *DarwinNetworkManager
func (*DarwinNetworkManager) RefreshDefaultGateway ¶
func (nm *DarwinNetworkManager) RefreshDefaultGateway() error
func (*DarwinNetworkManager) RestoreNetwork ¶
func (nm *DarwinNetworkManager) RestoreNetwork()
func (*DarwinNetworkManager) SetNetwork ¶
type Http3Conn ¶
type Http3Conn struct {
// contains filtered or unexported fields
}
func NewHttp3Conn ¶
func NewHttp3Conn() *Http3Conn
func (*Http3Conn) GetUpDownBytes ¶
func (*Http3Conn) SetHandler ¶
func (h3c *Http3Conn) SetHandler(cmd uint16, handler func(PolePacket, Conn))
func (*Http3Conn) StartProcess ¶
func (h3c *Http3Conn) StartProcess()
type IosTunFile ¶
type IosTunFile struct { io.ReadWriteCloser // contains filtered or unexported fields }
func NewIosTunFile ¶
func NewIosTunFile(tun *os.File) *IosTunFile
func (*IosTunFile) Close ¶
func (itf *IosTunFile) Close() error
type LinuxNetworkManager ¶
type LinuxNetworkManager struct {
// contains filtered or unexported fields
}
func NewLinuxNetworkManager ¶
func NewLinuxNetworkManager() *LinuxNetworkManager
func (*LinuxNetworkManager) RefreshDefaultGateway ¶
func (nm *LinuxNetworkManager) RefreshDefaultGateway() error
func (*LinuxNetworkManager) RestoreNetwork ¶
func (nm *LinuxNetworkManager) RestoreNetwork()
func (*LinuxNetworkManager) SetNetwork ¶
type NetworkManager ¶
type PolePacket ¶
type PolePacket []byte
func (PolePacket) Cmd ¶
func (p PolePacket) Cmd() uint16
func (PolePacket) Len ¶
func (p PolePacket) Len() uint16
func (PolePacket) Payload ¶
func (p PolePacket) Payload() []byte
func (PolePacket) SetCmd ¶
func (p PolePacket) SetCmd(cmd uint16)
func (PolePacket) SetLen ¶
func (p PolePacket) SetLen(len uint16)
type PoleVpnClient ¶
type PoleVpnClient struct {
// contains filtered or unexported fields
}
func NewPoleVpnClient ¶
func NewPoleVpnClient() (*PoleVpnClient, error)
func (*PoleVpnClient) AskAllocIPAddress ¶
func (pc *PoleVpnClient) AskAllocIPAddress()
func (*PoleVpnClient) AttachTunDevice ¶
func (pc *PoleVpnClient) AttachTunDevice(device *TunDevice)
func (*PoleVpnClient) CloseConnect ¶
func (pc *PoleVpnClient) CloseConnect(flag bool)
func (*PoleVpnClient) GetRemoteIP ¶
func (pc *PoleVpnClient) GetRemoteIP() string
func (*PoleVpnClient) GetUpDownBytes ¶
func (pc *PoleVpnClient) GetUpDownBytes() (uint64, uint64)
func (*PoleVpnClient) HeartBeat ¶
func (pc *PoleVpnClient) HeartBeat()
func (*PoleVpnClient) IsStoped ¶
func (pc *PoleVpnClient) IsStoped() bool
func (*PoleVpnClient) SendHeartBeat ¶
func (pc *PoleVpnClient) SendHeartBeat()
func (*PoleVpnClient) SetEventHandler ¶
func (pc *PoleVpnClient) SetEventHandler(handler func(int, *PoleVpnClient, *anyvalue.AnyValue))
func (*PoleVpnClient) Stop ¶
func (pc *PoleVpnClient) Stop()
func (*PoleVpnClient) WaitStop ¶
func (pc *PoleVpnClient) WaitStop()
type TunDevice ¶
type TunDevice struct {
// contains filtered or unexported fields
}
func AttachTunDevice ¶
func AttachTunDeviceIos ¶
func NewTunDevice ¶
func (*TunDevice) GetInterface ¶
type TunIO ¶
type TunIO struct {
// contains filtered or unexported fields
}
func (*TunIO) AttachDevice ¶
func (*TunIO) SetPacketHandler ¶
func (*TunIO) StartProcess ¶
func (t *TunIO) StartProcess()
type WebSocketConn ¶
type WebSocketConn struct {
// contains filtered or unexported fields
}
func NewWebSocketConn ¶
func NewWebSocketConn() *WebSocketConn
func (*WebSocketConn) Close ¶
func (wsc *WebSocketConn) Close(flag bool) error
func (*WebSocketConn) GetUpDownBytes ¶
func (wsc *WebSocketConn) GetUpDownBytes() (uint64, uint64)
func (*WebSocketConn) IsClosed ¶
func (wsc *WebSocketConn) IsClosed() bool
func (*WebSocketConn) Send ¶
func (wsc *WebSocketConn) Send(pkt []byte)
func (*WebSocketConn) SetHandler ¶
func (wsc *WebSocketConn) SetHandler(cmd uint16, handler func(PolePacket, Conn))
func (*WebSocketConn) StartProcess ¶
func (wsc *WebSocketConn) StartProcess()
func (*WebSocketConn) String ¶
func (wsc *WebSocketConn) String() string
type WindowsNetworkManager ¶
type WindowsNetworkManager struct {
// contains filtered or unexported fields
}
func NewWindowsNetworkManager ¶
func NewWindowsNetworkManager() *WindowsNetworkManager
func (*WindowsNetworkManager) RefreshDefaultGateway ¶
func (nm *WindowsNetworkManager) RefreshDefaultGateway() error
func (*WindowsNetworkManager) RestoreNetwork ¶
func (nm *WindowsNetworkManager) RestoreNetwork()
func (*WindowsNetworkManager) SetNetwork ¶
Click to show internal directories.
Click to hide internal directories.