bootstrap

package
v0.0.0-...-5012d17 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

func NewAPI

func NewAPI(cfg *Config) (*API, error)

func (*API) DoGeolocationLookup

func (api *API) DoGeolocationLookup() error

DoGeolocationLookup will try to fetch a valid country code from an online geolocation service (not controlled by us). This country code will be stored and sent in any subsequent resource queries to menshen (gateways/bridges), so that proximity is used in addition to the load information. This method should be called only once, right after initializing the API object.

func (*API) GetGateways

func (api *API) GetGateways(p *GatewayParams) ([]*models.ModelsGateway, error)

GetGateways returns a list of gateways (it it's enabled by the menshen API). It optionally accepts a GatewayParams object where you can set different filters.

func (*API) GetOpenVPNCert

func (api *API) GetOpenVPNCert() (string, error)

GetOpenVPNCert returns valid OpenVPN client credentials (certificate and private key)

func (*API) GetService

func (api *API) GetService() (*models.ModelsEIPService, error)

call menshen endpoint /service and return response TODO: rename endpoint and and this function TODO: split /service into multiple endpoints: locations, openvpn arguments, serial+version, auth

func (*API) SerializeConfig

func (api *API) SerializeConfig(params *GatewayParams) (string, error)

SerializeConfig returns a single string containing a valid OpenVPN configuration file.

type Config

type Config struct {
	// BaseCountry is an ISO-2 country code. If present, we will skip
	// geolocation lookup, and we will send our "base" country to menshen
	// when asking for gateways/bridges.
	BaseCountry string
	// Host we will connect to for API operations.
	Host string
	// Port we will connect to for API operations (default 443)
	Port int
	// Use TLS to connect to menshen (default: true)
	UseTLS bool
	// Introducer is an obfsucated introducer to use for all bootstrap operations.
	Introducer string
	// Proxy is a local SOCKS5 proxy for all bootstrap operations.
	Proxy string
	// ResolveWithDoH indicates whether we should use a DoH resolver.
	ResolveWithDoH bool
}

func NewConfig

func NewConfig() *Config

type GatewayParams

type GatewayParams struct {
	Location  string
	Port      string
	Transport string
	CC        string
}

GatewayParams contains the fields that can be used to filter the listing of available gateways.

Jump to

Keyboard shortcuts

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