wndclient

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	READ_LIMIT                int64 = 128 * 1024
	SESSION_TYPE_WEB                = 1
	SESSION_TYPE_EXT                = 2
	SESSION_TYPE_DESKTOP            = 3
	SESSION_TYPE_MOBILE             = 4
	ACCOUNT_STATE_ACTIVE            = 1
	ACCOUNT_STATE_OUT_OF_DATA       = 2
	ACCOUNT_STATE_BANNED            = 3
)

Variables

View Source
var DefaultWndEndpoints = WndEndpoints{
	Session:           "https://api.windscribe.com/Session",
	ServerList:        "https://assets.windscribe.com/serverlist",
	ServerCredentials: "https://api.windscribe.com/ServerCredentials",
	BestLocation:      "https://api.windscribe.com/BestLocation",
}
View Source
var DefaultWndSettings = WndSettings{
	ClientAuthSecret: "952b4412f002315aa50751032fcaab03",
	Platform:         "chrome",
	Type:             "chrome",
	UserAgent:        "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36",
	Origin:           "chrome-extension://hnmpcagpplmpfojmgmnngilcnanddlhb",
	SessionType:      SESSION_TYPE_EXT,
	Endpoints:        DefaultWndEndpoints,
}
View Source
var ErrNoDataInResponse = errors.New("no \"data\" key in response")

Functions

func MakeAuthHash

func MakeAuthHash(secret string) (string, int64)

Types

type BestLocation added in v1.0.0

type BestLocation struct {
	CountryCode  string `json:"country_code"`
	ShortName    string `json:"short_name"`
	LocationName string `json:"location_name"`
	CityName     string `json:"city_name"`
	DCID         int    `json:"dc_id"`
	ServerID     int    `json:"server_id"`
	Hostname     string `json:"hostname"`
}

type BestLocationResponse added in v1.0.0

type BestLocationResponse struct {
	Data *BestLocation `json:"data"`
}

type RegisterTokenRequest

type RegisterTokenRequest struct {
	ClientAuthHash string `json:"client_auth_hash"`
	Time           int64  `json:"time,string"`
}

type RegisterTokenResponse

type RegisterTokenResponse struct {
	Data *struct {
		TokenID        string `json:"id"`
		Token          string `json:"token"`
		TokenSignature string `json:"signature"`
		TokenTime      int64  `json:"time"`
	} `json:"data"`
}

type ServerCredentialsResponse

type ServerCredentialsResponse struct {
	Data *struct {
		Username []byte `json:"username"`
		Password []byte `json:"password"`
	} `json:"data"`
}

type ServerList

type ServerList []ServerListLocation

type ServerListGroup

type ServerListGroup struct {
	ID       int                   `json:"id"`
	City     string                `json:"city"`
	Nick     string                `json:"nick"`
	Pro      int                   `json:"pro"`
	GPS      string                `json:"gps"`
	WGPubkey []byte                `json:"wg_pubkey"`
	PingIP   string                `json:"ping_ip"`
	Hosts    []ServerListGroupHost `json:"hosts"`
}

type ServerListGroupHost

type ServerListGroupHost struct {
	Hostname string  `json:"hostname"`
	Weight   float64 `json:"weight"`
}

type ServerListLocation

type ServerListLocation struct {
	ID           int               `json:"id"`
	Name         string            `json:"name"`
	CountryCode  string            `json:"country_code"`
	Status       int               `json:"status"`
	PremiumOnly  int               `json:"premium_only"`
	ShortName    string            `json:"short_name"`
	P2P          int               `json:"p2p"`
	TZName       string            `json:"tz"`
	TZOffset     string            `json:"tz_offset"`
	LocationType string            `json:"loc_type"`
	ForceExpand  int               `json:"force_expand"`
	Groups       []ServerListGroup `json:"groups"`
}

type ServerListResponse

type ServerListResponse struct {
	Data ServerList `json:"data"`
	Info *struct {
		Revision       int    `json:"revision"`
		RevisionHash   string `json:"revision_hash"`
		Changed        int    `json:"changed"`
		FC             int    `json:"fc"`
		ProDatacenters []interface{}
	} `json:"info"`
}

type SessionResponse added in v1.1.0

type SessionResponse struct {
	Data *struct {
		SessionAuthHash  string  `json:"session_auth_hash"`
		Username         string  `json:"username"`
		UserID           string  `json:"user_id"`
		TrafficUsed      float64 `json:"traffic_used"`
		TrafficMax       float64 `json:"traffic_max"`
		Status           int     `json:"status"`
		Email            *string `json:"email"`
		EmailStatus      int     `json:"email_status"`
		BillingPlanID    int64   `json:"billing_plan_id"`
		IsPremium        int     `json:"is_premium"`
		RegDate          float64 `json:"reg_date"`
		LocationRevision int     `json:"loc_rev"`
		LocationHash     string  `json:"loc_hash"`
	} `json:"data"`
}

type StrKV

type StrKV map[string]string

type UsersRequest

type UsersRequest struct {
	ClientAuthHash string `json:"client_auth_hash"`
	SessionType    int    `json:"session_type_id"`
	Time           int64  `json:"time,string"`
	Token          string `json:"token"`
}

type UsersResponse

type UsersResponse struct {
	Data *struct {
		UserID           string `json:"user_id"`
		SessionAuthHash  string `json:"session_auth_hash"`
		Status           int    `json:"status"`
		IsPremium        int    `json:"is_premium"`
		LocationRevision int    `json:"loc_rev"`
		LocationHash     string `json:"loc_hash"`
	} `json:"data"`
}

type WndClient

type WndClient struct {
	Mux   sync.Mutex
	State WndClientState
	// contains filtered or unexported fields
}

func NewWndClient

func NewWndClient(transport http.RoundTripper) (*WndClient, error)

func (*WndClient) BestLocation added in v1.0.0

func (c *WndClient) BestLocation(ctx context.Context) (*BestLocation, error)

func (*WndClient) GetProxyCredentials

func (c *WndClient) GetProxyCredentials() (string, string)

func (*WndClient) ServerCredentials

func (c *WndClient) ServerCredentials(ctx context.Context) error

func (*WndClient) ServerList

func (c *WndClient) ServerList(ctx context.Context) (ServerList, error)

func (*WndClient) Session added in v1.1.0

func (c *WndClient) Session(ctx context.Context, username, password, tfacode string) error

type WndClientState

type WndClientState struct {
	TokenID            string      `json:"token_id"`
	Token              string      `json:"token"`
	TokenSignature     string      `json:"token_signature"`
	TokenSignatureTime int64       `json:"token_signature_time,string"`
	LocationHash       string      `json:"loc_hash"`
	LocationRevision   int         `json:"loc_rev"`
	IsPremium          bool        `json:"is_premium"`
	Status             int         `json:"status"`
	UserID             string      `json:"user_id"`
	SessionAuthHash    string      `json:"session_auth_hash"`
	ProxyUsername      string      `json:"proxy_username"`
	ProxyPassword      string      `json:"proxy_password"`
	Settings           WndSettings `json:"settings"`
}

type WndEndpoints

type WndEndpoints struct {
	Session           string `json:"Session"`
	ServerList        string `json:"serverlist"`
	ServerCredentials string `json:"ServerCredentials"`
	BestLocation      string `json:"BestLocation"`
}

type WndSettings

type WndSettings struct {
	ClientAuthSecret string       `json:"client_auth_secret"`
	Platform         string       `json:"platform"`
	Type             string       `json:"type"`
	UserAgent        string       `json:"user_agent"`
	Origin           string       `json:"origin"`
	SessionType      int          `json:"session_type"`
	Endpoints        WndEndpoints `json:"endpoints"`
}

Jump to

Keyboard shortcuts

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