Documentation
¶
Index ¶
- Constants
- Variables
- func APIGetWarpPorts() []uint16
- func APIRandomWarpEndpoint(v4, v6 bool) (netip.AddrPort, error)
- func APIRandomWarpPrefix(v4, v6 bool) netip.Prefix
- func APIWarpPrefixes() []netip.Prefix
- func RandomWarpEndpoint(v4, v6 bool) (netip.AddrPort, error)
- func RandomWarpPort() uint16
- func RandomWarpPrefix(v4, v6 bool) netip.Prefix
- func WarpPorts() []uint16
- func WarpPrefixes() []netip.Prefix
- type APIIdentity
- type Dialer
- type Identity
- type IdentityAccount
- type IdentityConfig
- type IdentityConfigInterface
- type IdentityConfigInterfaceAddresses
- type IdentityConfigPeer
- type IdentityConfigPeerEndpoint
- type IdentityConfigServices
- type IdentityDevice
- type Key
- type License
- type SNICurveExtension
- type WarpAPI
- func (w *WarpAPI) DeleteDevice(authToken, deviceID string) error
- func (w *WarpAPI) GetAccount(authToken, deviceID string) (IdentityAccount, error)
- func (w *WarpAPI) GetBoundDevices(authToken, deviceID string) ([]IdentityDevice, error)
- func (w *WarpAPI) GetSourceDevice(authToken, deviceID string) (Identity, error)
- func (w *WarpAPI) Register(publicKey string) (Identity, error)
- func (w *WarpAPI) ResetAccountLicense(authToken, deviceID string) (License, error)
- func (w *WarpAPI) UpdateAccount(authToken, deviceID, license string) (IdentityAccount, error)
- func (w *WarpAPI) UpdateBoundDevice(authToken, deviceID, otherDeviceID, name string, active bool) (IdentityDevice, error)
- func (w *WarpAPI) UpdateSourceDevice(authToken, deviceID, publicKey string) (Identity, error)
Constants ¶
const KeyLen = 32 // wgh.KeyLen
KeyLen is the expected key length for a WireGuard key.
const SNICurveSize = 1200
Variables ¶
var APILoadOrCreateIdentity = LoadOrCreateIdentity
Functions ¶
func APIGetWarpPorts ¶
func APIGetWarpPorts() []uint16
func APIRandomWarpPrefix ¶
func APIWarpPrefixes ¶
func RandomWarpPort ¶
func RandomWarpPort() uint16
func RandomWarpPrefix ¶
func WarpPrefixes ¶
Types ¶
type APIIdentity ¶
type APIIdentity = Identity
type Dialer ¶
type Dialer struct {
// contains filtered or unexported fields
}
Dialer is a struct that holds various options for custom dialing.
type Identity ¶
type Identity struct {
PrivateKey string `json:"private_key"`
Key string `json:"key"`
Account IdentityAccount `json:"account"`
Place int64 `json:"place"`
FCMToken string `json:"fcm_token"`
Name string `json:"name"`
TOS string `json:"tos"`
Locale string `json:"locale"`
InstallID string `json:"install_id"`
WarpEnabled bool `json:"warp_enabled"`
Type string `json:"type"`
Model string `json:"model"`
Config IdentityConfig `json:"config"`
Token string `json:"token"`
Enabled bool `json:"enabled"`
ID string `json:"id"`
Created string `json:"created"`
Updated string `json:"updated"`
WaitlistEnabled bool `json:"waitlist_enabled"`
}
func CreateIdentity ¶
func LoadIdentity ¶
type IdentityAccount ¶
type IdentityAccount struct {
Created string `json:"created"`
Updated string `json:"updated"`
License string `json:"license"`
PremiumData int64 `json:"premium_data"`
WarpPlus bool `json:"warp_plus"`
AccountType string `json:"account_type"`
ReferralRenewalCountdown int64 `json:"referral_renewal_countdown"`
Role string `json:"role"`
ID string `json:"id"`
Quota int64 `json:"quota"`
Usage int64 `json:"usage"`
ReferralCount int64 `json:"referral_count"`
TTL string `json:"ttl"`
}
type IdentityConfig ¶
type IdentityConfig struct {
Peers []IdentityConfigPeer `json:"peers"`
Interface IdentityConfigInterface `json:"interface"`
Services IdentityConfigServices `json:"services"`
ClientID string `json:"client_id"`
}
type IdentityConfigInterface ¶
type IdentityConfigInterface struct {
Addresses IdentityConfigInterfaceAddresses `json:"addresses"`
}
type IdentityConfigPeer ¶
type IdentityConfigPeer struct {
PublicKey string `json:"public_key"`
Endpoint IdentityConfigPeerEndpoint `json:"endpoint"`
}
type IdentityConfigServices ¶
type IdentityConfigServices struct {
HTTPProxy string `json:"http_proxy"`
}
type IdentityDevice ¶
type Key ¶
A Key is a public, private, or pre-shared secret key. The Key constructor functions in this package can be used to create Keys suitable for each of these applications.
func GenerateKey ¶
GenerateKey generates a Key suitable for use as a pre-shared secret key from a cryptographically safe source.
The output Key should not be used as a private key; use GeneratePrivateKey instead.
func GeneratePrivateKey ¶
GeneratePrivateKey generates a Key suitable for use as a private key from a cryptographically safe source.
func NewKey ¶
NewKey creates a Key from an existing byte slice. The byte slice must be exactly 32 bytes in length.
type SNICurveExtension ¶
type SNICurveExtension struct {
*tls.GenericExtension
SNICurveLen int
WillPad bool // set false to disable extension
}
SNICurveExtension implements SNICurve (0x15) extension
func (*SNICurveExtension) Len ¶
func (e *SNICurveExtension) Len() int
Len returns the length of the SNICurveExtension.
type WarpAPI ¶
type WarpAPI struct {
// contains filtered or unexported fields
}
func NewWarpAPI ¶
func (*WarpAPI) DeleteDevice ¶
func (*WarpAPI) GetAccount ¶
func (w *WarpAPI) GetAccount(authToken, deviceID string) (IdentityAccount, error)
func (*WarpAPI) GetBoundDevices ¶
func (w *WarpAPI) GetBoundDevices(authToken, deviceID string) ([]IdentityDevice, error)
func (*WarpAPI) GetSourceDevice ¶
func (*WarpAPI) ResetAccountLicense ¶
func (*WarpAPI) UpdateAccount ¶
func (w *WarpAPI) UpdateAccount(authToken, deviceID, license string) (IdentityAccount, error)
func (*WarpAPI) UpdateBoundDevice ¶
func (w *WarpAPI) UpdateBoundDevice(authToken, deviceID, otherDeviceID, name string, active bool) (IdentityDevice, error)