cloudflare

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CfConfig

type CfConfig struct {
	ID     string `json:"id"`
	Token  string `json:"token"`
	Config struct {
		ClientID string `json:"client_id"`
		Peers    []struct {
			PublicKey string `json:"public_key"`
			Endpoint  struct {
				Host string `json:"host"`
			} `json:"endpoint"`
		} `json:"peers"`
		Interface struct {
			Addresses struct {
				V4 string `json:"v4"`
				V6 string `json:"v6"`
			} `json:"addresses"`
		} `json:"interface"`
	} `json:"config"`
}

See example/cloudflare.json

func (*CfConfig) ExportConf

func (c *CfConfig) ExportConf(exportFmt string) (resault []byte, err error)

Share configuration

type RegisterRequest

type RegisterRequest struct {
	FCMToken  string `json:"fcm_token"`
	InstallID string `json:"install_id"`
	Key       string `json:"key"`
	Locale    string `json:"locale"`
	Model     string `json:"model"`
	TOS       string `json:"tos"`
	Type      string `json:"type"`
}

Build register request

type Uint8Array

type Uint8Array []uint8

go 会自动将 []uint 编码为 base64

func (Uint8Array) MarshalJSON

func (a Uint8Array) MarshalJSON() ([]byte, error)

type UpdateDeviceRequest

type UpdateDeviceRequest struct {
	Name   string `json:"name"`
	Active bool   `json:"active"`
}

Build UpdateDevice Request

type Warp

type Warp struct {
	Cfg       CfConfig
	SocksAddr string
	Name      string
}

Warp 结构体是一个抽象的入口。

func New

func New() *Warp

func (*Warp) ExportConf

func (w *Warp) ExportConf(exportFmt string) (resault []byte, err error)

func (*Warp) Register

func (w *Warp) Register() (err error)

main: register WARP

func (*Warp) UpdateDevice

func (w *Warp) UpdateDevice(name string) error

Jump to

Keyboard shortcuts

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