Documentation ¶
Index ¶
- Constants
- func LoadOrCreateIdentity(l *slog.Logger, path, license string) error
- func RandomWarpEndpoint(v4, v6 bool) (netip.AddrPort, error)
- func RandomWarpPort() uint16
- func RandomWarpPrefix(v4, v6 bool) netip.Prefix
- func RemoveDevice(l *slog.Logger, accountID, accessToken string) error
- func WarpPorts() []uint16
- func WarpPrefixes() []netip.Prefix
- type Dialer
- type Identity
- type IdentityAccount
- type IdentityConfig
- type IdentityConfigInterface
- type IdentityConfigInterfaceAddresses
- type IdentityConfigPeer
- type IdentityConfigPeerEndpoint
- type IdentityConfigServices
- type Key
- type SNICurveExtension
- type SNIExtension
Constants ¶
const KeyLen = 32 // wgh.KeyLen
KeyLen is the expected key length for a WireGuard key.
Variables ¶
This section is empty.
Functions ¶
func RandomWarpPort ¶
func RandomWarpPort() uint16
func RandomWarpPrefix ¶
func WarpPrefixes ¶
Types ¶
type Dialer ¶
type Dialer struct{}
Dialer is a struct that holds various options for custom dialing.
type Identity ¶ added in v1.1.1
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 ¶ added in v1.1.1
func LoadIdentity ¶ added in v1.1.1
type IdentityAccount ¶ added in v1.1.1
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 ¶ added in v1.1.1
type IdentityConfig struct { Peers []IdentityConfigPeer `json:"peers"` Interface IdentityConfigInterface `json:"interface"` Services IdentityConfigServices `json:"services"` ClientID string `json:"client_id"` }
type IdentityConfigInterface ¶ added in v1.1.1
type IdentityConfigInterface struct {
Addresses IdentityConfigInterfaceAddresses `json:"addresses"`
}
type IdentityConfigInterfaceAddresses ¶ added in v1.1.1
type IdentityConfigPeer ¶ added in v1.1.1
type IdentityConfigPeer struct { PublicKey string `json:"public_key"` Endpoint IdentityConfigPeerEndpoint `json:"endpoint"` }
type IdentityConfigPeerEndpoint ¶ added in v1.1.1
type IdentityConfigServices ¶ added in v1.1.1
type IdentityConfigServices struct {
HTTPProxy string `json:"http_proxy"`
}
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 SNIExtension ¶
type SNIExtension struct { *tls.GenericExtension ServerName string // not an array because go crypto/tls doesn't support multiple SNIs }
SNIExtension implements server_name (0)
func (*SNIExtension) Len ¶
func (e *SNIExtension) Len() int
Len returns the length of the SNIExtension.