warp

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApiUrl        = "https://api.cloudflareclient.com"
	ApiVersion    = "v0a4471"
	KeyTypeWg     = "curve25519"
	TunTypeWg     = "wireguard"
	KeyTypeMasque = "secp256r1"
	TunTypeMasque = "masque"
)

Variables

View Source
var Headers = map[string]string{
	"User-Agent":        "WARP for Android",
	"CF-Client-Version": "a-6.35-4471",
	"Content-Type":      "application/json; charset=UTF-8",
	"Connection":        "Keep-Alive",
}

Functions

func EnrollKey

func EnrollKey(accountData models.AccountData, pubKey []byte, deviceName string) (models.AccountData, *models.APIError, error)

EnrollKey updates an existing user account with a new MASQUE public key.

This function sends a PATCH request to update the user's account with a new key.

Parameters:

  • accountData: models.AccountData - The account data of the user being updated.
  • pubKey: []byte - The new MASQUE public key in binary format.
  • deviceName: string - The name of the device to enroll. (optional)

Returns:

  • models.AccountData: The updated account data.
  • error: An error if the update process fails.

func GenerateRandomAndroidSerial

func GenerateRandomAndroidSerial() (string, error)

GenerateRandomAndroidSerial generates a random 8-byte Android-like device identifier and returns it as a hexadecimal string.

func GenerateRandomWgPubkey

func GenerateRandomWgPubkey() (string, error)

GenerateRandomWgPubkey generates a random 32-byte WireGuard like public key and returns it as a base64-encoded string.

func Register

func Register(model, locale, jwt string, acceptTos bool) (models.AccountData, error)

Register creates a new user account by registering a WireGuard public key and generating a random Android-like device identifier. The WireGuard private key isn't stored anywhere, therefore it won't be usable. It's sole purpose is to mimic the Android app's registration process.

This function sends a POST request to the API to register a new user and returns the created account data.

Parameters:

  • model: string - The device model string to register. (e.g., "PC")
  • locale: string - The user's locale. (e.g., "en-US")
  • jwt: string - Team token to register.
  • acceptTos: bool - Whether the user accepts the Terms of Service (TOS). If false, the user will be prompted to accept.

Returns:

  • models.AccountData: The account data returned from the registration process.
  • error: An error if registration fails at any step.

func TimeAsCfString

func TimeAsCfString(t time.Time) string

TimeAsCfString formats a given time.Time into a Cloudflare-compatible string format.

Types

This section is empty.

Jump to

Keyboard shortcuts

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