rpn

package
v0.0.0-...-75cfc67 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Net6to4 = []netip.Prefix{
	netip.MustParsePrefix("2a00:1098:2b::/96"),
	netip.MustParsePrefix("2a00:1098:2c:1::/96"),
	netip.MustParsePrefix("2a01:4f8:c2c:123f:64::/96"),
	netip.MustParsePrefix("2a01:4f9:c010:3f02:64::/96"),
	netip.MustParsePrefix("2001:67c:2960:6464::/96"),
	netip.MustParsePrefix("2001:67c:2b0:db32:0:1::/96"),
}

preset 6to4 NATs; from: nat64.xyz

Functions

func Exit64Endpoints

func Exit64Endpoints() (v6 []netip.Addr, errs error)

func WinEndpoints

func WinEndpoints() (v4 []netip.AddrPort, v6 []netip.AddrPort, err error)

Types

type BaseClient

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

func NewExtClient

func NewExtClient(d protect.RDialer) *BaseClient

func (*BaseClient) MakeWsEntitlement

func (w *BaseClient) MakeWsEntitlement(entitlementOrStateJson []byte, did string) (out x.RpnEntitlement, err error)

Did can be left empty if entitlementOrStateJson has one.

func (*BaseClient) MakeWsWg

func (w *BaseClient) MakeWsWg(entitlement []byte, did string, ops x.RpnOps) (*WsClient, error)

func (*BaseClient) MakeWsWgFrom

func (w *BaseClient) MakeWsWgFrom(entitlementOrWsConfigJson, entitlementOnly []byte, did string, ops x.RpnOps) (*WsClient, error)

func (*BaseClient) MakeWsWgFromAny

func (w *BaseClient) MakeWsWgFromAny(entitlementOnly, entitlementOrStateJson []byte, did string, ops x.RpnOps) (*WsClient, error)

MakeWsWgFromAny registers a Windscribe account from entitlementOnly and/or entitlementOrStateJson; at least one of the two must be non-empty. entitlementOnly is always an entitlement json, whereas entitlementOrStateJson may be a full state+entitlement (WsWgConfig) json or just an entitlement json. When both are present, entitlementOrStateJson is processed first and, on failure, entitlementOnly is used to register instead.

type RegionalWgConf

type RegionalWgConf struct {
	// WsServerList.CountryCode (uppercased)
	CC string `json:"CC"`
	// WsServerGroup.City
	City string `json:"City"`
	// City (Nick)
	Name string `json:"Name"`
	// WsServerGroup.Health (0-100, lower is better)
	Load int32 `json:"Load"`
	// WsServerGroup.LinkSpeed (100, 1000, 10000 in mbps)
	Link int32 `json:"Link"`
	// len(WsServerGroup.Nodes) (number of nodes in this group)
	Count int32 `json:"Count"`
	// WsServerList.PremiumOnly == 1
	Premium bool `json:"Premium"`
	// WsServerList.P2P == 1 (0 means torrent trackers may be null routed)
	P2P bool `json:"P2P"`

	ClientAddr4   string `json:"ClientAddr4"`
	ClientAddr6   string `json:"ClientAddr6"`
	ClientPrivKey string `json:"ClientPrivKey"`
	ClientPubKey  string `json:"ClientPubKey"`
	ClientDNS4    string `json:"ClientDNS4"`
	ClientDNS6    string `json:"ClientDNS6"`

	PskKey string `json:"PskKey"`

	ServerPubKey     string   `json:"ServerPubKey"`
	ServerIPPort4    string   `json:"ServerIPPort4"`
	ServerIPPort6    string   `json:"ServerIPPort6"`
	ServerDomainPort string   `json:"ServerDomainPort"`
	AllowedIPs       []string `json:"AllowedIPs"` // csv

	UapiWgConf string `json:"uapiwgconf,omitempty"` // generated
}

func (*RegionalWgConf) GenUapiConfig

func (rwg *RegionalWgConf) GenUapiConfig() (didGenerate bool)

func (*RegionalWgConf) MakeUapiConfig

func (rwg *RegionalWgConf) MakeUapiConfig(creds *WsWgCreds, port string) (string, bool)

MakeUapiConfig builds an on-the-fly UAPI config string that overlays the credentials from a permanent config (private key, address v4/v6, DNS v4/v6, preshared key, allowed IPs) onto this regional config's server endpoints. rwg.UapiWgConf is NOT modified; the generated string is returned directly. Returns ("", false) when rwg/perma is nil or PrivateKey/Address is absent.

func (*RegionalWgConf) String

func (rwg *RegionalWgConf) String() string

type RpnAcc

type RpnAcc interface {
	x.RpnAcc
	ProviderID() string // x.RpnWg, x.RpnPro, x.RpnAmz, x.RpnWin
	MultiCountry() bool
	Conf(key string, ccs []string) (string, *x.RpnServer, error)
}

type RpnCountryless

type RpnCountryless struct{}

func (RpnCountryless) Locations

func (c RpnCountryless) Locations() (x.RpnServers, error)

func (RpnCountryless) MultiCountry

func (c RpnCountryless) MultiCountry() bool

type RpnForever

type RpnForever struct{}

func (RpnForever) Created

func (RpnForever) Created() int64

func (RpnForever) Expires

func (RpnForever) Expires() int64

type RpnMultiCountry

type RpnMultiCountry struct{}

func (RpnMultiCountry) MultiCountry

func (RpnMultiCountry) MultiCountry() bool

type RpnMultiCountryServers

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

func (*RpnMultiCountryServers) Get

func (s *RpnMultiCountryServers) Get(i int) (*x.RpnServer, error)

func (*RpnMultiCountryServers) Json

func (s *RpnMultiCountryServers) Json() ([]byte, error)

func (*RpnMultiCountryServers) Len

func (s *RpnMultiCountryServers) Len() int

type RpnStateless

type RpnStateless struct {
	RpnUpdateless
}

func (RpnStateless) Conf

func (RpnStateless) Conf(cc string, ccs []string) (string, *x.RpnServer, error)

func (RpnStateless) Entitlement

func (RpnStateless) Entitlement() (x.RpnEntitlement, error)

func (RpnStateless) State

func (RpnStateless) State() ([]byte, error)

func (RpnStateless) Updated

func (RpnStateless) Updated() int64

type RpnUpdateless

type RpnUpdateless struct{}

func (RpnUpdateless) Ops

func (RpnUpdateless) Ops() *x.RpnOps

func (RpnUpdateless) Update

func (RpnUpdateless) Update(*x.RpnOps) ([]byte, error)

type WsClient

type WsClient struct {
	RpnMultiCountry
	// contains filtered or unexported fields
}

func (*WsClient) Conf

func (a *WsClient) Conf(cc string, exclusions []string) (string, *x.RpnServer, error)

Conf implements RpnAcc.

func (*WsClient) Created

func (a *WsClient) Created() int64

Created implements x.RpnAcc.

func (*WsClient) Entitlement

func (a *WsClient) Entitlement() (x.RpnEntitlement, error)

func (*WsClient) Expires

func (a *WsClient) Expires() int64

Expires implements x.RpnAcc.

func (*WsClient) Locations

func (a *WsClient) Locations() (x.RpnServers, error)

func (*WsClient) Ops

func (a *WsClient) Ops() *x.RpnOps

Ops implements x.RpnAcc. Never returns nil.

func (*WsClient) ProviderID

func (*WsClient) ProviderID() string

ProviderID implements RpnAcc.

func (*WsClient) State

func (a *WsClient) State() ([]byte, error)

State implements x.RpnAcc.

func (*WsClient) Update

func (a *WsClient) Update(ops *x.RpnOps) (newstate []byte, err error)

Update implements x.RpnAcc.

func (*WsClient) Updated

func (a *WsClient) Updated() int64

func (*WsClient) Who

func (a *WsClient) Who() string

Who implements x.RpnAcc.

type WsEntitlement

type WsEntitlement struct {
	Kind         string `json:"kind"`          // e.g. "ws#v1"
	Cid          string `json:"cid"`           // Client ID
	Did          string `json:"did,omitempty"` // Device ID, if any
	Pid          string `json:"pid,omitempty"` // Share ID
	SessionToken string `json:"sessiontoken"`  // Encrypted session token
	// Expiry date of the entitlement; go.dev/play/p/1rWNG6GPGqN
	Exp              time.Time `json:"expiry"`
	AccStatus        string    `json:"status"`       // "valid" | "invalid" | "banned" | "expired" | "unknown"
	AllowCrossDevice bool      `json:"allowRestore"` // true if this entitlement can be restored
	TestDomain       bool      `json:"test"`         // true if this is a test entitlement
	// DidToken is the device-id token (x-rethink-app-did-token) issued by svchost,
	// format "hextoken:expiryepochsec".
	DidToken string `json:"didtoken,omitempty"`
}

{ "kind": "ws#v1", "cid": "hex", // Identifier "sid": "id:epochsec:parentcidsig", // profile identifier, if any "sessiontoken": enc("id:typ:epochsec:sig1:sig2"), "expiry": "2025-07-15T00:00:00Z", // Expiry date of the entitlement "status": "valid" // "valid" | "invalid" | "banned" | "expired" | "unknown" "allowRestore": false, // true if this entitlement can be restored "test": false // true if this is a test entitlement }

func (*WsEntitlement) AllowRestore

func (e *WsEntitlement) AllowRestore() bool

func (*WsEntitlement) CID

func (e *WsEntitlement) CID() string

func (*WsEntitlement) DID

func (e *WsEntitlement) DID() string

func (*WsEntitlement) Expiry

func (e *WsEntitlement) Expiry() int64

func (*WsEntitlement) Json

func (e *WsEntitlement) Json() ([]byte, error)

func (*WsEntitlement) ProviderID

func (e *WsEntitlement) ProviderID() string

func (*WsEntitlement) Status

func (e *WsEntitlement) Status() string

func (*WsEntitlement) Test

func (e *WsEntitlement) Test() bool

func (*WsEntitlement) Token

func (e *WsEntitlement) Token() string

type WsErrorResponse

type WsErrorResponse struct {
	Code      int            `json:"errorCode"`
	Msg       string         `json:"errorMessage"`
	Desc      string         `json:"errorDescription"`
	LogStatus string         `json:"logStatus"`
	Failures  map[string]any `json:"validationFailuresArray"`
	// RPN errors
	Error   string `json:"error"`
	Details string `json:"details,omitempty"`
	// TODO: Ray is present in all svc responses; not just error
	Ray string `json:"ray,omitempty"`
}
{
    "errorCode": 502,
    "errorMessage": "1 arguments had validation errors",
    "errorDescription": "Argument did not validate",
    "logStatus": null,
    "validationFailuresArray": {
        "0": {
            "wg_pubkey": {
                "lengthMin": {
                    "validationValue": "44"
                }
            }
        },
        "validationErrorMessageArray": [
            "wg pubkey is too short. Minimum value is 44 characters"
        ]
    }
}

type WsFilter

type WsFilter struct {
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
	ID          string `json:"id"`
	// Status is 1 when the filter is enabled, 0 when disabled.
	Status int `json:"status"`
}

WsFilter represents a single Robert DNS filter entry.

type WsFilterSetData

type WsFilterSetData struct {
	Success int `json:"success"`
}

type WsFilterSetRequest

type WsFilterSetRequest struct {
	Filter string `json:"filter"`
	Status int    `json:"status"`
}

WsFilterSetRequest is the JSON body for PUT Robert/filter.

type WsFilterSetResponse

type WsFilterSetResponse struct {
	Data     WsFilterSetData `json:"data"`
	Metadata WsMetadata      `json:"metadata"`
}

type WsFiltersData

type WsFiltersData struct {
	Filters []WsFilter `json:"filters"`
	Success int        `json:"success"`
}

type WsFiltersResponse

type WsFiltersResponse struct {
	Data     WsFiltersData `json:"data"`
	Metadata WsMetadata    `json:"metadata"`
}

type WsInfo

type WsInfo struct {
	Revision      int    `json:"revision"`
	RevisionHash  string `json:"revision_hash"`
	Changed       int    `json:"changed"`
	FeatureConfig int    `json:"fc"`
}
{
        "revision": 2672,
        "revision_hash": "6ad01549d6643292d8021f19a14b82310ff44c90",
        "changed": 1,
        "fc": 1
}

type WsMetadata

type WsMetadata struct {
	ServiceRequestId string `json:"serviceRequestId"`
	HostName         string `json:"hostName"`
	Duration         string `json:"duration"`
	LogStatus        string `json:"logStatus"`
	MD5              string `json:"md5"`
}
	{
        "serviceRequestId": "1752328061104032696",
        "hostName": "staging",
        "duration": "0.00278ms",
        "logStatus": null,
        "md5": "f90552b29b73b6899f7f00dc0c9fe5f4"
    }

type WsPortMap

type WsPortMap struct {
	Protocol    string   `json:"protocol"`
	Heading     string   `json:"heading"`
	Use         string   `json:"use"`
	Ports       []string `json:"ports"`
	LegacyPorts []string `json:"legacy_ports,omitempty"`
}
{
        "portmap": [
            {
                "protocol": "wg",
                "heading": "WireGuard",
                "use": "ip3",
                "ports": [
                    "443",
                    "80",
                    "53",
                    "123",
                    "1194",
                    "65142"
                ]
            },
            {
                "protocol": "ikev2",
                "heading": "IKEv2",
                "use": "hostname",
                "ports": [
                    "500"
                ],
                "legacy_ports": [
                    "500"
                ]
            },
            {
                "protocol": "udp",
                "heading": "UDP",
                "use": "ip2",
                "ports": [
                    "443",
                    "80",
                ],
                "legacy_ports": [
                    "443"
                ]
            },
            {
                "protocol": "tcp",
                "heading": "TCP",
                "use": "ip2",
                "ports": [
                    "443",
                    "587",
                    "21",
                    "1194"
                ],
                "legacy_ports": [
                    "1194"
                ]
            },
            {
                "protocol": "stunnel",
                "heading": "Stealth",
                "use": "ip3",
                "ports": [
                    "443",
                    "587",
                    "21",
                    "22",
                    "80",
                    "123",
                    "8443"
                ],
                "legacy_ports": [
                    "8443"
                ]
            },
            {
                "protocol": "wstunnel",
                "heading": "WStunnel",
                "use": "hostname",
                "ports": [
                    "443"
                ],
                "legacy_ports": [
                    "443"
                ]
            }
        ]
}

type WsPortMapResponse

type WsPortMapResponse struct {
	Data struct {
		PortMap []WsPortMap `json:"portmap"`
	} `json:"data"`
	Metadata WsMetadata `json:"metadata"`
}
{
    "data": {
        "portmap": [
		{...}, {...}
		],
	}
	"metadata": { ... }

type WsProxyCreds

type WsProxyCreds struct {
	Username string `json:"username"`
	Password string `json:"password"`
}
{
        "username": "string",
        "password": "string"
}

type WsProxyCredsResponse

type WsProxyCredsResponse struct {
	Data     WsProxyCreds `json:"data"`
	Metadata WsMetadata   `json:"metadata"`
}
{
    "data": WsProxyCreds,
	metadata: { ... }
}

type WsServerGroup

type WsServerGroup struct {
	ID   int    `json:"id"`
	City string `json:"city"`
	Nick string `json:"nick"`
	Pro  int    `json:"pro"`
	GPS  string `json:"gps"`
	TZ   string `json:"tz"`
	// public key for all servers in this datacenter / building
	WgPubKey string `json:"wg_pubkey"`
	// WireGuard hostname to connect to, which will connect to a
	// random WireGuard server in this datacenter: Its A/AAAA records
	// contains all "ip3" (WireGuard-only) IPs for individual Nodes
	// (all hosts in this datacenter).
	WgEndpoint string `json:"wg_endpoint"`
	OvpnX509   string `json:"ovpn_x509"`
	PingIP     string `json:"ping_ip"`
	// GET <ping-host>/latency
	// {"rtt": "5775"}  = 5.7ms
	PingHost string `json:"ping_host"`
	// 100, 1000, 10000 (in mbps) etc;
	LinkSpeed string `json:"link_speed"`
	// Nodes are online servers that can be connected to in a datacneter.
	// If empty, the datacenter is offline.
	Nodes []WsServerNode `json:"nodes"`
	// Health is a measure of load, between 0 and 100. Lower is better.
	Health int `json:"health"`
}
				{
                    "id": 87,
                    "city": "Boston",
                    "nick": "The Wahlberg",
                    "pro": 1,
                    "gps": "42.36,-71.06",
                    "tz": "EST",
                    "wg_pubkey": "M/kVfITvFaz8i8msJi7C3jsgk45vnbnYLJIOl/zBsVk=",
                    "wg_endpoint": "bos-87-wg.whiskergalaxy.dev",
                    "ovpn_x509": "bos-87.windscribe.dev",
                    "ping_ip": "181.215.52.122",
                    "ping_host": "http://us-014.whiskergalaxy.dev:6464/latency",
                    "link_speed": "1000",
                    "nodes": [
                        { ... }
                    ],
                    "health": 0
                }

type WsServerList

type WsServerList struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	CountryCode string `json:"country_code"`
	// Status is for country level location record,
	// flips to a value thats not 1 only if all servers
	// in the whole country are unavailable.
	Status      int    `json:"status"`
	PremiumOnly int    `json:"premium_only"`
	ShortName   string `json:"short_name"`
	// P2P is 0 as a signal that common torrent trackers are null routed
	// on these machines and torrenting is discouraged. Nothing prevents
	// users from still doing so, especially on private trackers.
	// This flag has no impact on port forwarding.
	P2P         int             `json:"p2p"`
	TZ          string          `json:"tz"`
	TZOffset    string          `json:"tz_offset"`
	LocType     string          `json:"loc_type"`
	DNSHostname string          `json:"dns_hostname,omitempty"`
	Groups      []WsServerGroup `json:"groups"`
}
{
            "id": 90,
            "name": "Guatemala",
            "country_code": "gt",
            "status": 1,
            "premium_only": 1,
            "short_name": "GT",
            "p2p": 1,
            "tz": "America/Toronto",
            "tz_offset": "-4,EST",
            "loc_type": "normal",
            "dns_hostname": "gt.windscribe.dev",
            "groups": [
                {
                    "id": 110,
                    "city": "San Marcos",
                    "nick": "Trafficker",
                    "pro": 1,
                    "gps": "14.97,-91.80",
                    "tz": "America/Guatemala",
                    "wg_pubkey": "NXPIQ0kD2ww9VkgFqMWvJs7ZLthd5PS259/yJPyDyz0=",
                    "wg_endpoint": "gua-110-wg.whiskergalaxy.dev",
                    "ovpn_x509": "gua-110.windscribe.dev",
                    "ping_ip": "66.66.66.70",
                    "ping_host": "http://gt-stg-001.whiskergalaxy.dev:6464/latency",
                    "link_speed": "100",
                    "nodes": [
                        {
                            "ip": "66.66.66.70",
                            "ip2": "66.66.66.71",
                            "ip3": "66.66.66.72",
                            "hostname": "gt-stg-001.whiskergalaxy.dev",
                            "weight": 1,
                            "health": 0
                        }
                    ],
                    "health": 0
                }
            ]
        },
        {
            "id": 38,
            "name": "Canada East",
            "country_code": "CA",
            "status": 1,
            "premium_only": 0,
            "short_name": "CA",
            "p2p": 0,
            "tz": "America/Toronto",
            "tz_offset": "-4,EST",
            "loc_type": "normal",
            "dns_hostname": "ca.windscribe.dev",
            "groups": [
                { ... }
            ]
        },
        {
            "id": 52,
            "name": "United States",
            "country_code": "US",
            "status": 1,
            "premium_only": 0,
            "short_name": "US",
            "p2p": 0,
            "tz": "America/Chicago",
            "tz_offset": "-6,CET",
            "loc_type": "normal",
            "dns_hostname": "us.windscribe.dev",
            "groups": [
                { ... }
            ]
        },
        {
            "id": 84,
            "name": "The Best Korea",
            "country_code": "KP",
            "status": 2,
            "premium_only": 1,
            "short_name": "KP",
            "p2p": 1,
            "tz": "Asia/Pyongyang",
            "tz_offset": "9,PYT",
            "loc_type": "normal",
            "groups": [
                { ... }
            ]
        }

type WsServerListResponse

type WsServerListResponse struct {
	Data     []WsServerList `json:"data"`
	Info     WsInfo         `json:"info"`
	Metadata WsMetadata     `json:"metadata"`
}
{
    "data": [
		{ ... }, { ... },
    ],
    "info": { ... },
    "metadata": { ... }
}

type WsServerNode

type WsServerNode struct {
	IP  string `json:"ip"`
	IP2 string `json:"ip2,omitempty"`
	// Init direct connections to "ip3" + port to connect to
	// a specific node (host) skipping DNS.
	IP3      string `json:"ip3,omitempty"`
	Hostname string `json:"hostname"`
	Weight   int    `json:"weight"`
	Health   int    `json:"health"`
}
						{
                            "ip": "181.215.52.122",
                            "ip2": "181.215.52.123",
                            "ip3": "181.215.52.124",
                            "hostname": "us-014.whiskergalaxy.dev",
                            "weight": 1,
                            "health": 0
                        },
                        {
                            "ip": "181.215.52.2",
                            "ip2": "181.215.52.3",
                            "ip3": "181.215.52.4",
                            "hostname": "us-004.whiskergalaxy.dev",
                            "weight": 1,
                            "health": 0
                        }

type WsSession

type WsSession struct {
	UserID string `json:"user_id"`
	// Encrypted account session token authenticates this user with the API to get
	// and set any state, incl WG configuration which are unique and bound
	// to each session token. Session token is the "bearer token".
	// Unencrypted session/bearer token is of shape, id:type:timestamp:sig1:sig2.
	// However it could change to a new format in the future.
	SessionToken string `json:"session_auth_hash"`
	Username     string `json:"username"`
	// TrafficUsed shows byte count of data used since LastReset date?
	TrafficUsed int64 `json:"traffic_used"`
	TrafficMax  int64 `json:"traffic_max"`
	// Status is 1 under normal circumstances. Any other state means
	// this user is banned (or a free account has expired).
	// Bans are extremely rare, and there is no appeal process.
	// Bans are issued on repeated abuse, never right away.
	// This user is permanently disabled if banned.
	Status        int    `json:"status"`
	Email         string `json:"email"`
	EmailStatus   int    `json:"email_status"`
	BillingPlanID int    `json:"billing_plan_id"`
	IsPremium     int    `json:"is_premium"`
	Rebill        int    `json:"rebill"`
	// This will downgrade on this date, unless its renewed.
	// ex: "2025-07-22" go.dev/play/p/IoeH1Ee6cZ3
	ExpiryDate string `json:"premium_expiry_date"`
	RegDate    int64  `json:"reg_date"`
	LastReset  string `json:"last_reset"` // can be null
	LocRev     int    `json:"loc_rev"`
	// Latest revision hash of the server list.
	LocHash string `json:"loc_hash"`
}
{
        "user_id": "l7xfy9c1",
        "session_auth_hash": "id:typ:epochsec:sig1:sig2",
        "username": "celz_l7xfy9c1",
        "traffic_used": 0,
        "traffic_max": -1,
        "status": 1,
        "email": null,
        "email_status": 0,
        "billing_plan_id": 120,
        "is_premium": 1,
        "rebill": 0,
        "premium_expiry_date": "2025-07-15",
        "reg_date": 1749999508,
        "last_reset": "2025-07-12", // or null
        "loc_rev": 2672,
        "loc_hash": "6ad01549d66..."
}

type WsSessionResponse

type WsSessionResponse struct {
	Data     WsSession  `json:"data"`
	Metadata WsMetadata `json:"metadata"`
}
{
    "data": WsSession ,
    "metadata": { ... }
}

type WsWgConfig

type WsWgConfig struct {
	Entitlement *WsEntitlement       `json:"entitlement"` // entitlement info
	Session     *WsSession           `json:"session"`
	Configs     []*RegionalWgConf    `json:"configs"`
	Servers     []WsServerList       `json:"servers"`              // all servers in the server list
	Creds       *WsWgCreds           `json:"creds"`                // base64 encoded private key
	PermaCreds  *WsWgPermanentConfig `json:"permacreds,omitempty"` // permanent WG config; nil if not yet fetched
	LastUpdate  time.Time
}

func (*WsWgConfig) Json

func (a *WsWgConfig) Json() ([]byte, error)

type WsWgConnectData

type WsWgConnectData struct {
	Config  WsWgInterface     `json:"config"`
	Debug   map[string]string `json:"debug,omitempty"` // optional
	Success int               `json:"success"`
}
{
        "config": WsWgInterface,
        "debug": {
            "pub_key": "supplied: tsoZzRelDNFe/xF6eQz+xxzjmgS0xKfxEmlqsZKPNgs=",
            "interface": "generated + attached: 100.65.61.145"
        },
        "success": 1
    }

type WsWgConnectResponse

type WsWgConnectResponse struct {
	Data     WsWgConnectData `json:"data"`
	Metadata WsMetadata      `json:"metadata"`
}
{
    "data": WsWgConnectData,
    "metadata": { ... }
}

type WsWgCreds

type WsWgCreds struct {
	PrivateKey   string `json:"PrivateKey,omitempty"` // base64; locally generated for /init, server-generated for /permanent
	PublicKey    string `json:"PublicKey"`            // base64; locally generated for /init, server-generated for /permanent
	PresharedKey string `json:"PresharedKey"`         // base64; only the latest key is valid (generated by remote)
	AllowedIPs   string `json:"AllowedIPs"`           // e.g. "0.0.0.0/0" or "0.0.0.0/0, ::/0"
	// Address and DNS (and their v6 counterparts) are populated only by the
	// /permanent endpoint; empty for /init responses.
	// So dynamic creds, after /init, will have to /connect before populating these
	Address   string `json:"Address,omitempty"`   // CIDR notation, e.g. "100.64.236.203/32"
	DNS       string `json:"DNS,omitempty"`       // IP address, e.g. "10.255.255.1"
	AddressV6 string `json:"AddressV6,omitempty"` // CIDR notation, e.g. "fd54:4::aaff:5ba3:ee48:e72b/128"; empty when unassigned
	DNSV6     string `json:"DNSV6,omitempty"`     // IPv6 address, e.g. "fd54::1"; empty unless the server supplies one
}
	{
	            "PrivateKey": "stdbase64",
	            "PublicKey": "tsoZzRelDNFe/xF6eQz+xxzjmgS0xKfxEmlqsZKPNgs=",
	            "PresharedKey": "stdbase64",
	            "AllowedIPs": "0.0.0.0/0",
	            "Address": "100.64.236.203/32",  // omitempty: absent in /init responses; present in /permanent
	            "DNS": "10.255.255.1"             // omitempty: absent in /init responses; present in /permanent
	}
	or
    {
            "PrivateKey": "stdbase64",
            "PublicKey": "3lXKBJMJ/Rv1BbUhojSkywk/GKnRV0JzDA1xtn50eFA=",
            "PresharedKey": "stdbase64",
            "AllowedIPs": "0.0.0.0/0",
            "AllowedIPsV6": "::/0",
            "HashedCIDR": [
                "100.64.0.0/10"
            ],
            "HashedCIDRv6": [
                "fd54:0004::/64"
            ],
            "Address": "100.127.91.163/32",
            "AddressV6": "fd54:4::aaff:5ba3:ee48:e72b/128",
            "DNS": "10.255.255.2"
    }
}

type WsWgCredsData

type WsWgCredsData struct {
	Config  WsWgCreds         `json:"config"`
	Debug   map[string]string `json:"debug,omitempty"`
	Success int               `json:"success"`
}
{
        "config": WsWgCreds,
        "debug": {
            "init": "generated: tsoZzRelDNFe/xF6eQz+xxzjmgS0xKfxEmlqsZKPNgs="
        },
        "success": 1
}

// Also used for /WgConfigs/permanent responses, where config additionally // carries Address and DNS (populated in WsWgCreds via the omitempty fields).

type WsWgCredsResponse

type WsWgCredsResponse struct {
	Data     WsWgCredsData `json:"data"`
	Metadata WsMetadata    `json:"metadata"`
}
{
    "data": WsWgCredsData,
    "metadata": { ... }
}

type WsWgInterface

type WsWgInterface struct {
	Address   string `json:"Address"`             // cidr notation
	DNS       string `json:"DNS"`                 // ip address
	AddressV6 string `json:"AddressV6,omitempty"` // cidr notation, e.g. "fd54:4::aaff:5ba3:ee48:e72b/128"; empty when unassigned
	DNSV6     string `json:"DNSV6,omitempty"`     // ip address; empty unless the server supplies one
}
	{
	    "Address": "100.65.61.145/32",
	    "DNS": "10.255.255.2"
	}
	or
    {
        "Address": "100.127.91.163/32",
        "AddressV6": "fd54:4::aaff:5ba3:ee48:e72b/128",
        "DNS": "10.255.255.2"
    }

type WsWgListKeysData

type WsWgListKeysData struct {
	PubKeys []string `json:"pub_keys"`
	Success int      `json:"success"`
}
{
    "data": {
        "pub_keys": ["WzPsW3p+t5rkbZ2zg/QciGN3vMQVKciP/csQzIZ0ohE=", ...],
        "success": 1
    },
    "metadata": { ... }
}

type WsWgListKeysResponse

type WsWgListKeysResponse struct {
	Data     WsWgListKeysData `json:"data"`
	Metadata WsMetadata       `json:"metadata"`
}

type WsWgPermanentConfig

type WsWgPermanentConfig = WsWgCreds

WsWgPermanentConfig is an alias for WsWgCreds; the /permanent endpoint returns the same envelope as /init (WsWgCredsData / WsWgCredsResponse) but additionally populates the Address and DNS fields added to WsWgCreds.

Jump to

Keyboard shortcuts

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