warp

package
v1.0.3-rc2 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const KeyLen = 32 // wgh.KeyLen

KeyLen is the expected key length for a WireGuard key.

Variables

This section is empty.

Functions

func CheckProfileExists

func CheckProfileExists(license string) bool

func LoadOrCreateIdentity

func LoadOrCreateIdentity(license string) error

func MergeMaps

func MergeMaps(maps ...map[string]string) map[string]string

func RandomIPFromRange

func RandomIPFromRange(cidr string) (net.IP, error)

func UpdatePath

func UpdatePath(path string)

Types

type AccountData

type AccountData struct {
	AccountID   string `json:"account_id"`
	AccessToken string `json:"access_token"`
	PrivateKey  string `json:"private_key"`
	LicenseKey  string `json:"license_key"`
}

type ConfigurationData

type ConfigurationData struct {
	LocalAddressIPv4    string `json:"local_address_ipv4"`
	LocalAddressIPv6    string `json:"local_address_ipv6"`
	EndpointAddressHost string `json:"endpoint_address_host"`
	EndpointAddressIPv4 string `json:"endpoint_address_ipv4"`
	EndpointAddressIPv6 string `json:"endpoint_address_ipv6"`
	EndpointPublicKey   string `json:"endpoint_public_key"`
	WarpEnabled         bool   `json:"warp_enabled"`
	AccountType         string `json:"account_type"`
	WarpPlusEnabled     bool   `json:"warp_plus_enabled"`
	LicenseKeyUpdated   bool   `json:"license_key_updated"`
}

type Dialer

type Dialer struct {
}

Dialer is a struct that holds various options for custom dialing.

func (*Dialer) TLSDial

func (d *Dialer) TLSDial(plainDialer *net.Dialer, network, addr string) (net.Conn, error)

TLSDial dials a TLS connection.

type Key

type Key [KeyLen]byte

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

func GenerateKey() (Key, error)

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

func GeneratePrivateKey() (Key, error)

GeneratePrivateKey generates a Key suitable for use as a private key from a cryptographically safe source.

func NewKey

func NewKey(b []byte) (Key, error)

NewKey creates a Key from an existing byte slice. The byte slice must be exactly 32 bytes in length.

func (Key) PublicKey

func (k Key) PublicKey() Key

PublicKey computes a public key from the private key k.

PublicKey should only be called when k is a private key.

func (Key) String

func (k Key) String() string

String returns the base64-encoded string representation of a Key.

ParseKey can be used to produce a new Key from this string.

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.

func (*SNICurveExtension) Read

func (e *SNICurveExtension) Read(b []byte) (n int, err error)

Read reads 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.

func (*SNIExtension) Read

func (e *SNIExtension) Read(b []byte) (int, error)

Read reads the SNIExtension.

Jump to

Keyboard shortcuts

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