core

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2023 License: GPL-3.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CODE_CLIENT_new_ping                      = 1
	CODE_CLIENT_ping                          = 20
	CODE_CLIENT_connect_tunnel_with_handshake = 28
)
View Source
const (
	META_DL_START = 6
	META_DL_END   = 8
)

Variables

View Source
var (
	PREV_DNS_IP [4]byte
	IS_UNIX     bool = false
)
View Source
var (
	EP_Version  byte
	EP_Protocol byte

	EP_DstIP [4]byte

	EP_IPv4HeaderLength byte
	EP_IPv4Header       []byte
	EP_TPHeader         []byte

	EP_SrcPort    [2]byte
	EP_DstPort    [2]byte
	EP_MappedPort *RP

	EP_NAT_IP [4]byte
	EP_NAT_OK bool

	EP_RST byte

	EP_DNS_Response         []byte
	EP_DNS_OK               bool
	EP_DNS_Port_Placeholder [2]byte
	EP_DNS_Packet           []byte

	// This IP gets over-written on connect
	EP_VPNSrcIP [4]byte

	EP_NEW_RST int
)
View Source
var (
	IP_Version  byte
	IP_Protocol byte

	IP_DstIP [4]byte
	IP_SrcIP [4]byte

	IP_IPv4HeaderLength byte
	IP_IPv4Header       []byte
	IP_TPHeader         []byte

	IP_SrcPort    [2]byte
	IP_DstPort    [2]byte
	IP_MappedPort *RP

	IP_NAT_IP [4]byte
	IP_NAT_OK bool

	// This IP gets over-written on connect
	// IP_VPNSrcIP [4]byte
	IP_InterfaceIP [4]byte
)
View Source
var (
	A            = new(Adapter)
	AS           = new(AdapterSettings)
	C            = new(Config)
	GLOBAL_STATE = new(State)
)
View Source
var (
	BUFFER_ERROR             bool
	IGNORE_NEXT_BUFFER_ERROR bool
)
View Source
var (
	TUNNEL_ADAPTER_NAME       = "NicelandVPN"
	TUNNEL_ADAPTER_ADDRESS    = "10.4.3.2"
	TUNNEL_ADAPTER_ADDRESS_IP = net.IP{10, 4, 3, 2}
)
View Source
var (
	CURRENT_UBBS    int    = 0
	CURRENT_DBBS    int    = 0
	EGRESS_PACKETS  uint64 = 0
	INGRESS_PACKETS uint64 = 0
)
View Source
var (
	TCP_MAP      = make(map[[4]byte]*IP)
	TCP_MAP_LOCK = sync.RWMutex{}
)

NETWORKING STUFF

View Source
var (
	UDP_MAP      = make(map[[4]byte]*IP)
	UDP_MAP_LOCK = sync.RWMutex{}
)
View Source
var (
	L           = new(Logs)
	LogQueue    = make(chan LogItem, 10000)
	TAG_ERROR   = "ERROR"
	TAG_GENERAL = "GENERAL"
	LogFile     *os.File
)
View Source
var BlockLists embed.FS
View Source
var DNSCapturMap = make(map[string]bool)
View Source
var DNSCaptureFile *os.File
View Source
var DNSWhitelist = make(map[string]bool)
View Source
var ENABLE_INSTERFACE = false
View Source
var GLOBAL_BLOCK_LIST = make(map[string]bool)
View Source
var LAST_PRIVATE_ACCESS_POINT_UPDATE = time.Now()
View Source
var LAST_ROUTER_AND_ACCESS_POINT_UPDATE = time.Now()
View Source
var LastConnectionAttemp = time.Now()

var LastRouterPing = time.Now()

View Source
var MIDBufferLength = 8
View Source
var NEXT_SERVER_REFRESH time.Time
View Source
var PREVDNS net.IP
View Source
var PRODUCTION = false
View Source
var PS_IFLIST []*PS_DEFAULT_ROUTES
View Source
var STATE_LOCK = sync.Mutex{}
View Source
var TCP_o0 [256]*O1
View Source
var UDP_o0 [256]*O1

Functions

func AddRoute

func AddRoute(IP string) (err error)

func AddRouteToTunnelInterface

func AddRouteToTunnelInterface(IP string) (err error)

func AdjustRoutersForTunneling

func AdjustRoutersForTunneling() (err error)

func AdminCheck

func AdminCheck()

func AutoReconnect

func AutoReconnect() (connected bool)

func BUILD_NAT_MAP added in v1.1.4

func BUILD_NAT_MAP(AP *AccessPoint) (err error)

func BackupSettingsToFile

func BackupSettingsToFile(NewDefault *CONNECTION_SETTINGS)

func BuildDomainBlocklist added in v1.1.4

func BuildDomainBlocklist()

func CalculateBandwidth

func CalculateBandwidth(MONITOR chan int)

func CaptureDNS added in v1.1.4

func CaptureDNS(domain string)

func ChangeDNS

func ChangeDNS() error

func ChangeDNSOnTunnelInterface

func ChangeDNSOnTunnelInterface() error

func ChangeDNSWhileConnected

func ChangeDNSWhileConnected() error

func CleanPortMap added in v1.1.4

func CleanPortMap(protoMap *[256]*O1, mapType string)

func CleanPorts added in v1.1.4

func CleanPorts(MONITOR chan int)

func CleanupOnClose

func CleanupOnClose()

func CleanupWithStateLock

func CleanupWithStateLock()

func ConnectToActiveRouter

func ConnectToActiveRouter(RoutingBuffer [8]byte) (TUNNEL net.Conn, err error)

func ControllerCustomDialer

func ControllerCustomDialer(ctx context.Context, network string, addr string) (net.Conn, error)

func CopySlice

func CopySlice(in []byte) (out []byte)

func CreateBaseFolder

func CreateBaseFolder()

func CreateErrorLog

func CreateErrorLog(Type string, Line ...interface{})

func CreateLog

func CreateLog(Type string, Line ...interface{})

func CreateMETABuffer

func CreateMETABuffer(CODE, GROUP, RID, SID, X1, X2 byte, DL uint16) (METAID [8]byte)

func CreateTunnelBuffer

func CreateTunnelBuffer() []byte

func DNSAMapping added in v1.1.4

func DNSAMapping(domain string) (IPS []net.IP, CNAME string)

func DNSCNameMapping added in v1.1.4

func DNSCNameMapping(domain string) (CNAME string)

func DNSTXTMapping added in v1.1.4

func DNSTXTMapping(domain string) (TXTS []string)

func Decrypt

func Decrypt(text, key []byte) (out []byte)

func DeleteRoute

func DeleteRoute(IP string, ignoreActiveRouter bool) (err error)

func DeleteTunnelInterfaceRoutes

func DeleteTunnelInterfaceRoutes(IP string) (err error)

func DisableIPv6

func DisableIPv6() error

func Disconnect

func Disconnect()

func DisconnectFromRouter

func DisconnectFromRouter(AdapterSettings *AdapterSettings)

func DownloadRoutersFromOnlineSource

func DownloadRoutersFromOnlineSource() ([][]byte, error)

func DumpLoadingLogs

func DumpLoadingLogs(L *Logs)

func EnablePacketRouting

func EnablePacketRouting() (err error)

func Encrypt

func Encrypt(text, key []byte) []byte

func ErrorLog

func ErrorLog(err interface{}, msgs ...interface{})

func FindAllInterfaces

func FindAllInterfaces() (IFList map[string]*INTERFACE_SETTINGS)

func FindDefaultInterfaceAndGatewayDuringStartup

func FindDefaultInterfaceAndGatewayDuringStartup() (err error)

func ForwardToController

func ForwardToController(FR *FORWARD_REQUEST) (interface{}, int, error)

func ForwardToRouter

func ForwardToRouter(FR *FORWARD_REQUEST) (interface{}, int, error)

func GET_FUNC

func GET_FUNC(skip int) string

func GenerateAEADFromPrivateKey

func GenerateAEADFromPrivateKey(PK *ecdsa.PrivateKey, R *OTK_REQUEST) (AEAD cipher.AEAD, err error)

func GenerateBaseFolderPath

func GenerateBaseFolderPath() string

func GetDomainAndSubDomain added in v1.1.4

func GetDomainAndSubDomain(domain string) (d, s string)

func GetIPv6Settings

func GetIPv6Settings(PotentialDefault *CONNECTION_SETTINGS)

func GetLowestLatencyRouter

func GetLowestLatencyRouter() (int, error)

func GetPrivateAccessPoints added in v1.1.4

func GetPrivateAccessPoints(FR *FORWARD_REQUEST) (interface{}, int, error)

func GetRoutersAndAccessPoints

func GetRoutersAndAccessPoints(FR *FORWARD_REQUEST) (interface{}, int, error)

func GetRoutersFromLocalFile

func GetRoutersFromLocalFile() ([][]byte, error)

func InitLogfile

func InitLogfile()

func InitPaths added in v1.1.4

func InitPaths()

func InitializeTunnelAdapter

func InitializeTunnelAdapter() (err error)

func InitializeTunnelInterface

func InitializeTunnelInterface() (err error)

func InstantlyClearPortMaps added in v1.1.4

func InstantlyClearPortMaps()

func InterfaceMaintenenceAndBackup

func InterfaceMaintenenceAndBackup()

func IsDNSQuery added in v1.1.4

func IsDNSQuery(UDPData []byte) bool

func IsDomainAllowed added in v1.1.4

func IsDomainAllowed(domain string) bool

func LaunchPreperation

func LaunchPreperation() (err error)

func LoadBlockLists added in v1.1.4

func LoadBlockLists()

func LoadConfig

func LoadConfig()

func LoadDNSWhitelist added in v1.1.4

func LoadDNSWhitelist() (err error)

func LoadFileIntoMap added in v1.1.4

func LoadFileIntoMap(path string) (list map[string]bool, err error)

func LoadRoutersUnAuthenticated added in v1.1.5

func LoadRoutersUnAuthenticated() (interface{}, int, error)

func LocalhostCustomDialer

func LocalhostCustomDialer(ctx context.Context, network, addr string) (net.Conn, error)

func Log

func Log(lines ...interface{})

func OpenProxyTunnelToRouter

func OpenProxyTunnelToRouter(ctx context.Context) (TCP_CONN net.Conn, err error)

func ParseRoutersFromRawDataToMemory

func ParseRoutersFromRawDataToMemory(lines [][]byte) (count int)

func PingAllRouters

func PingAllRouters()

func PingRouter

func PingRouter(IP string) (*ping.Statistics, error)

func PrepareState

func PrepareState()

func PrintDNS

func PrintDNS() (error, []byte)

func PrintInterfaces

func PrintInterfaces() (error, []byte)

func PrintRouters

func PrintRouters() (error, []byte)

func ProcessEgressDNSQuery added in v1.1.4

func ProcessEgressDNSQuery(UDPData []byte) (DNSResponse []byte, shouldProcess bool)

func ProcessEgressPacket added in v1.1.4

func ProcessEgressPacket(p *[]byte) (sendRemote bool, sendLocal bool)

func ProcessIngressDNSQuery added in v1.1.4

func ProcessIngressDNSQuery(TPHeader []byte) bool

func ProcessIngressPacket added in v1.1.4

func ProcessIngressPacket(packet []byte) bool

func ReadFromLocalSocket added in v1.1.4

func ReadFromLocalSocket(MONITOR chan int)

func ReadFromRouterSocket

func ReadFromRouterSocket(MONITOR chan int)

func ReadMIDAndDataFromBuffer

func ReadMIDAndDataFromBuffer(CONN net.Conn, TunnelBuffer []byte) (n int, DL int, err error)

func RecalculateAndReplaceIPv4HeaderChecksum added in v1.1.4

func RecalculateAndReplaceIPv4HeaderChecksum(bytes []byte)

func RecalculateAndReplaceTransportChecksum added in v1.1.4

func RecalculateAndReplaceTransportChecksum(IPv4Header []byte, TPPacket []byte)

func RecoverAndLogToFile

func RecoverAndLogToFile()

func RefreshRouterList

func RefreshRouterList() (err error)

func ResetAfterFailedConnectionAttempt

func ResetAfterFailedConnectionAttempt()

func ResetEverything

func ResetEverything()

func RestoreDNS

func RestoreDNS(force bool)

func RestoreIPv6

func RestoreIPv6()

func RestoreSettingsFromFile

func RestoreSettingsFromFile(PotentialDefault *CONNECTION_SETTINGS)

func SaveConfig

func SaveConfig() (err error)

func SendRawBytesToLocalhostProxy

func SendRawBytesToLocalhostProxy(method string, route string, data []byte, timeoutMS int) ([]byte, int, error)

func SendRequestToControllerProxy

func SendRequestToControllerProxy(method string, route string, data interface{}, domain string, timeoutMS int) ([]byte, int, error)

func SendRequestToLocalhostProxy

func SendRequestToLocalhostProxy(method string, route string, data interface{}, timeoutMS int) ([]byte, int, error)

func SetActiveRouter

func SetActiveRouter(index int)

func SetConfig

func SetConfig(SF *CONFIG_FORM) error

func SetGlobalStateAsDisconnected

func SetGlobalStateAsDisconnected()

func SetInterfaceStateToDown

func SetInterfaceStateToDown() (err error)

func SetInterfaceStateToUp

func SetInterfaceStateToUp() (err error)

func SetRouterFile

func SetRouterFile(path string) error

func StartCapturing added in v1.1.4

func StartCapturing()

func StartLogQueueProcessor

func StartLogQueueProcessor(MONITOR chan int)

func StartService

func StartService(MONITOR chan int)

func StateMaintenance

func StateMaintenance(MONITOR chan int)

func StopCapturing added in v1.1.4

func StopCapturing(path string) (err error)

func SwitchRouter

func SwitchRouter(Tag string) (code int, err error)

func VerifyAndBackupSettings

func VerifyAndBackupSettings(PotentialDefault *CONNECTION_SETTINGS) (err error)

Types

type AP_GEO_DB

type AP_GEO_DB struct {
	Updated     time.Time `json:"Updated" bson:"U"`
	IPV         string    `bson:"IPV" json:"-"`
	Country     string    `bson:"Country" json:"Country"`
	CountryFull string    `bson:"CountryFull" json:"CountryFull"`
	City        string    `bson:"City" json:"City"`
	// ASN     string `bson:"ASN" json:"ASN"`
	ISP   string `bson:"ISP" json:"-"`
	Proxy bool   `bson:"Proxy" json:"Proxy"`
	Tor   bool   `bson:"Tor" json:"Tor"`
}

type AccessPoint

type AccessPoint struct {
	ID primitive.ObjectID `json:"_id,omitempty" bson:"_id"`

	UID primitive.ObjectID `json:"-" bson:"UID"`
	Tag string             `json:"Tag" bson:"T"`

	GROUP    uint8  `json:"GROUP" bson:"G"`
	ROUTERID uint8  `json:"ROUTERID" bson:"RID"`
	DEVICEID uint8  `json:"DEVICEID" bson:"DID"`
	IP       string `json:"IP" bson:"IP"`

	Access             []*DeviceUserRegistration `json:"Access" bson:"A"`
	Updated            time.Time                 `json:"Updated" bson:"U"`
	InternetAccess     bool                      `json:"InternetAccess" bson:"I"`
	LocalNetworkAccess bool                      `json:"LocalNetworkAccess" bson:"LA"`
	Public             bool                      `json:"Public" bson:"P"`

	Online     bool       `json:"Online" bson:"O"`
	LastOnline time.Time  `json:"LastOnline" bson:"LO"`
	GEO        *AP_GEO_DB `json:"GEO,omitempty" bson:"GEO"`

	AvailableSlots int `json:"AvailableSlots" bson:"-"`
	Slots          int `json:"Slots" bson:"-"`
	AvailableMbps  int `json:"AvailableMbps" bson:"ABS"`
	UserMbps       int `json:"UserMbps" bson:"UB"`

	Country     string `json:"Country" bson:"Country"`
	CountryFull string `json:"CountryFull" bson:"CountryFull"`
	// MIGHT USE
	NAT             []*DeviceNatRegistration          `json:"NAT" bson:"NAT"`
	BlockedNetworks []string                          `json:"BlockedNetworks" bson:"BlockedNetworks"`
	DNS             map[string]*DeviceDNSRegistration `json:"DNS" bson:"DNS"`
	DNSWhiteList    bool                              `json:"DNSWhiteList" bson:"DNSWhiteList"`

	Router *ROUTER `json:"Router"`

	NAT_CACHE         map[[4]byte][4]byte `json:"-"`
	REVERSE_NAT_CACHE map[[4]byte][4]byte `json:"-"`
}

func GetActiveAccessPointFromActiveSession added in v1.1.4

func GetActiveAccessPointFromActiveSession() *AccessPoint

type Adapter

type Adapter struct {
	Interface *water.Interface
}

func (*Adapter) Close

func (A *Adapter) Close() (err error)

func (*Adapter) Uninstall

func (A *Adapter) Uninstall() (err error)

type AdapterSettings

type AdapterSettings struct {
	// SleepTrigger bool
	Session *CLIENT_SESSION

	TCPTunnelSocket net.Conn

	RoutingBuffer [8]byte
	PingBuffer    [8]byte

	StartPort uint16
	EndPort   uint16

	AEAD cipher.AEAD

	AP *AccessPoint
}

type CHACHA_RESPONSE

type CHACHA_RESPONSE struct {
	X      *big.Int
	Y      *big.Int
	CHACHA []byte
}

type CLIENT_SESSION

type CLIENT_SESSION struct {
	Created time.Time
	CONTROLLER_SESSION
	PrivateKey        *ecdsa.PrivateKey `json:"-"`
	StartPort         uint16
	EndPort           uint16
	VPNIP             []byte
	ClientKeyResponse []byte `json:"CKR"`
}

func Connect

func Connect(NS *CONTROLLER_SESSION_REQUEST, initializeRouting bool) (S *CLIENT_SESSION, code int, err error)

func ConnectToAccessPoint

func ConnectToAccessPoint(NS *CONTROLLER_SESSION_REQUEST, startRouting bool) (S *CLIENT_SESSION, code int, errm error)

type CONFIG_FORM

type CONFIG_FORM struct {
	DNS1                      string                      `json:"DNS1"`
	DNS2                      string                      `json:"DNS2"`
	ManualRouter              bool                        `json:"ManualRouter"`
	Region                    string                      `json:"Region"`
	Version                   string                      `json:"Version"`
	RouterFilePath            string                      `json:"RouterFilePath"`
	DebugLogging              bool                        `json:"DebugLogging"`
	AutoReconnect             bool                        `json:"AutoReconnect"`
	KillSwitch                bool                        `json:"KillSwitch"`
	PrevSession               *CONTROLLER_SESSION_REQUEST `json:"PrevSlot"`
	DisableIPv6OnConnect      bool                        `json:"DisableIPv6OnConnect"`
	CloseConnectionsOnConnect bool                        `json:"CloseConnectionsOnConnect"`
	CustomDNS                 bool                        `json:"CustomDNS"`
}

type CONNECTION_SETTINGS

type CONNECTION_SETTINGS struct {
	DNS1          string
	DNS2          string
	AutoDNS       bool
	IP6Method     string
	IPV6Enabled   bool
	IFName        string
	DefaultRouter string
	AdapterName   string
}
var MAC_CONNECTION_SETTINGS *CONNECTION_SETTINGS

func FindDefaultInterfaceAndGateway

func FindDefaultInterfaceAndGateway() (POTENTIAL_DEFAULT *CONNECTION_SETTINGS, err error)

type CONTROLLER_SESSION

type CONTROLLER_SESSION struct {
	UserID primitive.ObjectID `bson:"UID"`
	ID     primitive.ObjectID `bson:"_id"`

	Permanent bool `bson:"P"`
	Count     int  `bson:"C"`
	SLOTID    int  `bson:"SLOTID"`

	GROUP     uint8 `bson:"G"`
	ROUTERID  uint8 `bson:"RID"`
	SESSIONID uint8 `bson:"SID"`

	XGROUP    uint8 `bson:"XG"`
	XROUTERID uint8 `bson:"XRID"`
	DEVICEID  uint8 `bson:"APID"`

	Assigned     time.Time `bson:"A"`
	ShouldDelete bool      `bson:"-"`
}

type CONTROLLER_SESSION_REQUEST

type CONTROLLER_SESSION_REQUEST struct {
	UserID primitive.ObjectID
	ID     primitive.ObjectID

	DeviceToken string `json:",omitempty"`

	SLOTID int
	Type   string `json:",omitempty"`

	Permanent bool `json:",omitempty"`
	Count     int  `json:",omitempty"`

	GROUP     uint8 `json:"GROUP"`
	ROUTERID  uint8 `json:"ROUTERID"`
	SESSIONID uint8 `json:"SESSIONID"`

	XGROUP    uint8 `json:"XGROUP"`
	XROUTERID uint8 `json:"XROUTERID"`
	DEVICEID  uint8 `json:"DEVICEID"`

	// QUICK CONNECT
	Country string `json:",omitempty"`

	TempKey *OTK_REQUEST
}

type CONTROLL_PUBLIC_DEVCE_RESPONSE

type CONTROLL_PUBLIC_DEVCE_RESPONSE struct {
	Routers      []*ROUTER
	AccessPoints []*AccessPoint
}

type Config

type Config struct {
	AutoReconnect  bool
	KillSwitch     bool
	DNS1           string
	DNS1Bytes      [4]byte
	DNSIP          net.IP
	DNS2           string
	ManualRouter   bool
	DebugLogging   bool
	Version        string
	RouterFilePath string

	DomainWhitelist           string
	EnabledBlockLists         []string
	LogBlockedDomains         bool
	DisableIPv6OnConnect      bool
	CloseConnectionsOnConnect bool
	CustomDNS                 bool

	PrevSession *CONTROLLER_SESSION_REQUEST `json:"-"`
}

type DEBUG_OUT

type DEBUG_OUT struct {
	Lines []string
	File  string
}

type DEVICE_TOKEN added in v1.1.5

type DEVICE_TOKEN struct {
	DT      string    `bson:"DT"`
	N       string    `bson:"N"`
	Created time.Time `bson:"C"`
}

Device token struct need for the login respons from user scruct

type DeviceDNSRegistration added in v1.1.4

type DeviceDNSRegistration struct {
	Wildcard bool     `json:"Wildcard" bson:"Wildcard"`
	IP       []string `json:"IP" bson:"IP"`
	TXT      []string `json:"TXT" bson:"TXT"`
	CNAME    string   `json:"CNAME" bson:"CNAME"`
}

type DeviceNatRegistration added in v1.1.4

type DeviceNatRegistration struct {
	Tag     string `json:"Tag" bson:"T"`
	Network string `json:"Network" bson:"N"`
	Nat     string `json:"Nat" bson:"L"`
}

type DeviceUserRegistration added in v1.1.4

type DeviceUserRegistration struct {
	UID primitive.ObjectID `json:"UID" bson:"UID"`
	Tag string             `json:"Tag" bson:"T"`
}

type FORWARD_REQUEST

type FORWARD_REQUEST struct {
	Path    string
	Method  string
	Timeout int
	// Data     []byte
	JSONData interface{}
}

type GENERAL_LOGS_RESPONSE

type GENERAL_LOGS_RESPONSE struct {
	Lines []string
}

type GeneralLogResponse

type GeneralLogResponse struct {
	Content  []string
	Time     []string
	Function []string
	Color    []string
}

func GetLogs

func GetLogs(lengthFromJavascript int) (*GeneralLogResponse, error)

func GetLogsForCLI added in v1.1.3

func GetLogsForCLI() (*GeneralLogResponse, error)

type INTERFACE_SETTINGS

type INTERFACE_SETTINGS struct {
	Index           int
	Flags           net.Flags
	MTU             int
	HardwareAddress net.HardwareAddr
	OIF             net.Interface
	Hop             string
	Metric          int
}

type IP

type IP struct {
	LOCAL  map[uint16]*RemotePort
	REMOTE map[uint16]*RemotePort
}

type LOADING_LOGS_RESPONSE

type LOADING_LOGS_RESPONSE struct {
	Lines [100]string
}

func GetLoadingLogs

func GetLoadingLogs(t string) (Logs *LOADING_LOGS_RESPONSE, err error)

type List added in v1.1.4

type List struct {
	FullPath string
	Tag      string
	Enabled  bool
	Domains  string
}

type LogItem

type LogItem struct {
	Type string
	Line string
}

type LoggerInterface

type LoggerInterface struct{}

func (*LoggerInterface) Debug

func (l *LoggerInterface) Debug(message string)

func (*LoggerInterface) Error

func (l *LoggerInterface) Error(message string)

func (*LoggerInterface) Fatal

func (l *LoggerInterface) Fatal(message string)

func (*LoggerInterface) Info

func (l *LoggerInterface) Info(message string)

func (*LoggerInterface) Print

func (l *LoggerInterface) Print(message string)

We only want to see wails.io logs while in development mode

func (*LoggerInterface) Trace

func (l *LoggerInterface) Trace(message string)

func (*LoggerInterface) Warning

func (l *LoggerInterface) Warning(message string)

type LoginForm added in v1.1.3

type LoginForm struct {
	Email       string
	Password    string
	DeviceName  string
	DeviceToken string
	Digits      string
	Recovery    string
}

type LogoutForm added in v1.1.3

type LogoutForm struct {
	Email       string
	DeviceToken string
}

type Logs

type Logs struct {
	PING       [100]string
	CONNECT    [100]string
	DISCONNECT [100]string
	SWITCH     [100]string
	GENERAL    [5000]string
}

type M added in v1.1.4

type M struct {
	LOCAL  map[[2]byte]*RP
	REMOTE map[[2]byte]*RP
	// X []*RemotePort
	Lock sync.Mutex
}

type MIB_TCPROW_OWNER_PID added in v1.1.4

type MIB_TCPROW_OWNER_PID struct {
	// contains filtered or unexported fields
}
type OpenSockets struct {
	RemoteAddress string  `json:"RemoteAddress"`
	RemoteIP      [4]byte `json:"-"`
	LocalPort     uint16  `json:"LocalPort"`
	RemotePort    uint16  `json:"RemotePort"`
}

type MIB_TCPTABLE_OWNER_PID added in v1.1.4

type MIB_TCPTABLE_OWNER_PID struct {
	// contains filtered or unexported fields
}

type O1 added in v1.1.4

type O1 struct {
	// contains filtered or unexported fields
}

type O2 added in v1.1.4

type O2 struct {
	// contains filtered or unexported fields
}

type O3 added in v1.1.4

type O3 struct {
	// contains filtered or unexported fields
}

type OTK

type OTK struct {
	Created    time.Time
	Key        [32]byte
	PrivateKey *ecdsa.PrivateKey
	AEAD       cipher.AEAD // used to open client data
}

type OTK_REQUEST

type OTK_REQUEST struct {
	X *big.Int
	Y *big.Int
}

func GenerateEllipticCurveAndPrivateKey

func GenerateEllipticCurveAndPrivateKey() (PK *ecdsa.PrivateKey, R *OTK_REQUEST, err error)

type OTK_RESPONSE

type OTK_RESPONSE struct {
	X    *big.Int
	Y    *big.Int
	UUID []byte
}

type PS_DEFAULT_ROUTES

type PS_DEFAULT_ROUTES struct {
	// CimClass struct {
	// 	CimSuperClassName string `json:"CimSuperClassName,omitempty"`
	// 	CimSuperClass     struct {
	// 		CimSuperClassName   string `json:"CimSuperClassName"`
	// 		CimSuperClass       string `json:"CimSuperClass"`
	// 		CimClassProperties  string `json:"CimClassProperties"`
	// 		CimClassQualifiers  string `json:"CimClassQualifiers"`
	// 		CimClassMethods     string `json:"CimClassMethods"`
	// 		CimSystemProperties string `json:"CimSystemProperties"`
	// 	} `json:"CimSuperClass,omitempty"`
	// 	CimClassProperties  []string `json:"CimClassProperties,omitempty"`
	// 	CimClassQualifiers  []string `json:"CimClassQualifiers,omitempty"`
	// 	CimClassMethods     []string `json:"CimClassMethods,omitempty"`
	// 	CimSystemProperties struct {
	// 		Namespace  string      `json:"Namespace"`
	// 		ServerName string      `json:"ServerName"`
	// 		ClassName  string      `json:"ClassName"`
	// 		Path       interface{} `json:"Path"`
	// 	} `json:"CimSystemProperties,omitempty"`
	// } `json:"CimClass,omitempty"`
	// CimInstanceProperties []struct {
	// 	Name            string      `json:"Name"`
	// 	Value           interface{} `json:"Value"`
	// 	CimType         int         `json:"CimType"`
	// 	Flags           string      `json:"Flags"`
	// 	IsValueModified bool        `json:"IsValueModified"`
	// } `json:"CimInstanceProperties,omitempty"`
	// CimSystemProperties struct {
	// 	Namespace  string      `json:"Namespace"`
	// 	ServerName string      `json:"ServerName"`
	// 	ClassName  string      `json:"ClassName"`
	// 	Path       interface{} `json:"Path"`
	// } `json:"CimSystemProperties,omitempty"`
	// Publish            int         `json:"Publish"`
	// Protocol           int         `json:"Protocol"`
	// Store              int         `json:"Store"`
	// AddressFamily      int         `json:"AddressFamily"`
	// State              int         `json:"State"`
	// IfIndex int `json:"ifIndex"`
	// Caption            interface{} `json:"Caption"`
	// Description        interface{} `json:"Description"`
	// ElementName        interface{} `json:"ElementName"`
	// InstanceID         string      `json:"InstanceID"`
	// AdminDistance      interface{} `json:"AdminDistance"`
	// DestinationAddress interface{} `json:"DestinationAddress"`
	// IsStatic           interface{} `json:"IsStatic"`
	RouteMetric int `json:"RouteMetric"`
	// TypeOfRoute        int         `json:"TypeOfRoute"`
	// CompartmentID      int         `json:"CompartmentId"`
	DestinationPrefix string `json:"DestinationPrefix"`
	InterfaceAlias    string `json:"InterfaceAlias"`
	InterfaceIndex    int    `json:"InterfaceIndex"`
	InterfaceMetric   int    `json:"InterfaceMetric"`
	NextHop           string `json:"NextHop"`
}

type QR_CODE

type QR_CODE struct {
	Value string
}

func GetQRCode

func GetQRCode(LF *TWO_FACTOR_CONFIRM) (QR *QR_CODE, err error)

type ROUTER

type ROUTER struct {
	IP             string `json:"PublicIP"`
	GROUP          uint8  `json:"GROUP"`
	ROUTERID       uint8  `json:"ROUTERID"`
	Tag            string `json:"Tag"`
	MS             uint64 `json:"MS"`
	Online         bool   `json:"Online"`
	Country        string `json:"Country"`
	AvailableMbps  int    `json:"AvailableMbps"`
	Slots          int    `json:"Slots"`
	AvailableSlots int    `json:"AvailableSlots"`

	LastPing  time.Time       `json:"-"`
	PingStats ping.Statistics `json:"-"`

	TCPControllerConnection net.Conn `json:"-"`
	TCPTunnelConnection     net.Conn `json:"-"`

	ROUTER_STATS

	Score int `json:"Score"`
}

type ROUTER_STATS

type ROUTER_STATS struct {
	AEBP      float64
	AIBP      float64
	CPUP      int
	RAMUsage  int
	DiskUsage int
}

type RP added in v1.1.4

type RP struct {
	Local        [2]byte
	Mapped       [2]byte
	Remote       [2]byte
	LastActivity time.Time
}

func CreateOrGetPortMapping added in v1.1.4

func CreateOrGetPortMapping(protoMap *[256]*O1, ip [4]byte, lport, rport [2]byte) *RP

func GetIngressPortMapping added in v1.1.4

func GetIngressPortMapping(protoMap *[256]*O1, ip [4]byte, port [2]byte) (mapping *RP)

type RemotePort

type RemotePort struct {
	Local        uint16
	Original     uint16
	Mapped       uint16
	LastActivity time.Time
}

type State

type State struct {
	UMbps          int    `json:"UMbps"`
	DMbps          int    `json:"DMbps"`
	UMbpsString    string `json:"UMbpsString"`
	DMbpsString    string `json:"DMbpsString"`
	IngressPackets uint64 `json:"IngressPackets"`
	EgressPackets  uint64 `json:"EgressPackets"`
	ConnectedTimer string `json:"ConnectedTimer"`

	IsAdmin               bool `json:"IsAdmin"`
	NeedsRouterProbe      bool `json:"NeedsRouterProbe"`
	BaseFolderInitialized bool `json:"BaseFolderInitialized"`
	TunnelInitialized     bool `json:"TunnelInitialized"`
	LogFileInitialized    bool `json:"LogFileInitialized"`
	ConfigInitialized     bool `json:"ConfigInitialized"`
	ClientReady           bool `json:"ClientReady"`
	ClientStartupError    bool `json:"ClientStartupError"`
	BufferError           bool `json:"BufferError"`

	Connected  bool `json:"Connected"`
	Connecting bool `json:"Connecting"`
	Exiting    bool `json:"Exiting"`

	C                             *Config              `json:"C"`
	DefaultInterface              *CONNECTION_SETTINGS `json:"DefaultInterface"`
	LastRouterPing                time.Time            `json:"LastRouterPing"`
	PingReceivedFromRouter        time.Time            `json:"PingReceivedFromRouter"`
	SecondsSincePingFromRouter    string               `json:"SecondsSincePingFromRouter"`
	LastAccessPointUpdate         time.Time
	SecondsUntilAccessPointUpdate int
	AvailableCountries            []string        `json:"AvailableCountries"`
	RoutersList                   [2000]*ROUTER   `json:"-"`
	Routers                       []*ROUTER       `json:"Routers"`
	AccessPoints                  []*AccessPoint  `json:"AccessPoints"`
	PrivateAccessPoints           []*AccessPoint  `json:"PrivateAccessPoints"`
	ActiveRouter                  *ROUTER         `json:"ActiveRouter"`
	ActiveAccessPoint             *AccessPoint    `json:"ActiveAccessPoint"`
	ActiveSession                 *CLIENT_SESSION `json:"ActiveSession"`

	// FILE PATHS
	LogFileName   string `json:"LogFileName"`
	LogPath       string `json:"LogPath"`
	ConfigPath    string `json:"ConfigPath"`
	BackupPath    string `json:"BackupPath"`
	BlockListPath string `json:"BlockListPath"`
	BasePath      string `json:"BasePath"`

	Version string `json:"Version"`

	// BLOCKING AND PARENTAL CONTROLS
	BLists              []*List `json:"BlockLists"`
	DNSCaptureEnabled   bool    `json:"DNSCaptureEnabled"`
	DNSWhitelistEnabled bool    `json:"DNSWhitelistEnabled"`
}

type TWO_FACTOR_CONFIRM

type TWO_FACTOR_CONFIRM struct {
	Email  string
	Code   string
	Digits string
}

type User added in v1.1.5

type User struct {
	ID               primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"`
	APIKey           string             `bson:"AK" json:"APIKey"`
	Email            string             `bson:"E"`
	TwoFactorEnabled bool               `json:"TwoFactorEnabled" bson:"TFE"`
	Disabled         bool               `bson:"D" json:"Disabled"`
	Tokens           []*DEVICE_TOKEN    `json:"Tokens" bson:"T"`
	DeviceToken      *DEVICE_TOKEN      `json:",omitempty" bson:"-"`

	CashCode      int       `bson:"CSC" json:"CashCode"`
	Affiliate     string    `bson:"AF"`
	SubLevel      int       `bson:"SUL"`
	SubExpiration time.Time `bson:"SE"`
	TrialStarted  time.Time `bson:"TrialStarted" json:"TrialStarted"`

	CancelSub bool `json:"CancelSub" bson:"CS"`

	Version string `json:"Version" bson:"-"`
}

use struct you get from the login request

Jump to

Keyboard shortcuts

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