common

package
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2019 License: MIT Imports: 6 Imported by: 6

Documentation

Index

Constants

View Source
const (
	CODE_SUCCESS       = 10000
	CODE_REGISTER_FAIL = 10001
	CODE_FAIL          = 99999
)
View Source
const (
	C2C_DATA = byte(0x00)

	C2S_DATA = byte(0x01)
	S2C_DATA = byte(0x02)

	C2S_HEARTBEAT = byte(0x03)
	S2C_HEARTBEAT = byte(0x04)

	C2S_AUTHORIZE = byte(0x05)
	S2C_AUTHORIZE = byte(0x06)
)

S => gtund(gtun server) C => gtun(gtun client)

View Source
const (
	S2G_REGISTER = iota
	G2S_REGISTER

	S2G_HEARTBEAT
	G2S_HEARTBEAT

	S2G_UPDATE_CLIENT_COUNT
	G2S_UPDATE_CLIENT_COUNT
)

S => gtund(gtun server) G => god

View Source
const (
	MAX_PAYLOAD = 1<<16 - 1
)

Variables

This section is empty.

Functions

func Decode

func Decode(conn net.Conn) (byte, []byte, error)

func Encode

func Encode(cmd byte, payload []byte) ([]byte, error)

func OSID

func OSID(goos string) int

func Response

func Response(data interface{}, err error) []byte

func Version

func Version() string

Types

type C2GRegister

type C2GRegister struct {
	IsWindows bool   `json:"is_windows"`
	AuthToken string `json:"auth_token"`
}

type C2SAuthorize

type C2SAuthorize struct {
	Version string `json:"version"`
	OS      int    `json:"os"`
	Key     string `json:"key"`
}

type G2CRegister

type G2CRegister struct {
	ServerAddress string `json:"server_address"`
}

type G2SRgister

type G2SRgister struct {
	GtundAddress string `json:"gtund_addr"`
}

type ResponseBody

type ResponseBody struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

type S2CAuthorize

type S2CAuthorize struct {
	Status         string   `json:"status"`
	AccessIP       string   `json:"access_ip"`
	Nameservers    []string `json:"nameservers"`
	Gateway        string   `json:"gateway"`
	RouteScriptUrl string   `json:"route_script_url"`
}

type S2GRegister

type S2GRegister struct {
	PublicIP       string `json:"public_ip"`
	Port           int    `json:"listen_port"`
	CIDR           string `json:"cidr"`
	Token          string `json:"token"`
	Count          int    `json:"count"`
	MaxClientCount int    `json:"max_client_count"`
	IsWindows      bool   `json:"is_windows"`
	Name           string `json:"name"`
}

type S2GUpdate

type S2GUpdate struct {
	Count int `json:"count"`
}

Jump to

Keyboard shortcuts

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