menshen

package
v0.0.0-...-e3c9231 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBonafideGateway

func NewBonafideGateway(v5Gateway *models.ModelsGateway) *bonafide.Gateway

func NewBonafideGatewayArray

func NewBonafideGatewayArray(gatewaysV5 []*models.ModelsGateway) []bonafide.Gateway

Types

type Menshen

type Menshen struct {

	// SnowflakeCh chan *snowflake.StatusEvent //TODO: Snowflake support
	// snowflakeProgress int
	// snowflake bool
	Gateways []*models.ModelsGateway // list of gateways offered by menshen
	// contains filtered or unexported fields
}

func New

func New() (*Menshen, error)

func (*Menshen) DoGeolocationLookup

func (m *Menshen) DoGeolocationLookup() (string, error)

func (*Menshen) DoLogin

func (m *Menshen) DoLogin(username, password string) (bool, error)

func (*Menshen) FetchAllGateways

func (m *Menshen) FetchAllGateways(transport string) error

Asks menshen for gateways. The gateways are stored in m.Gateways Currently, there is not CountryCode filtering The vars m.gwLocations and m.gwsByLocation are updated

func (*Menshen) GetBestGateways

func (m *Menshen) GetBestGateways(transport string) ([]bonafide.Gateway, error)

Returns a list of gateways that we will connect to. First checks if automatic gateway selection should be used.

func (*Menshen) GetBestLocation

func (m *Menshen) GetBestLocation(transport string) (string, error)

Returns the best location by iterating over m.locationQualityMap and finding the location with the highest quality

func (*Menshen) GetGatewayByIP

func (m *Menshen) GetGatewayByIP(ip string) (bonafide.Gateway, error)

Returns a gateway for a given ip address. Use case: We start OpenVPN with multiple --remote arguments, but in the end we don't know to which endpoint we are connected. Using the management interface, OpenVPN tells us the ip we are connected to

func (*Menshen) GetLocationLabels

func (m *Menshen) GetLocationLabels(transport string) map[string][]string

Returns a map[string][string] with gateway locations and their country code. Only used for the GUI locationLabels["Paris"] = ["Paris", "FR"] locationLabels["Seattle"] = ["Seattle", "US"] This functions gets called quiet often via toJson function in pkg/backend/status.go TODO: use a smarter structure if we get rid of v3 (needs to be cpp compatible)

func (*Menshen) GetLocationQualityMap

func (m *Menshen) GetLocationQualityMap(transport string) map[string]float64

func (*Menshen) GetOpenvpnArgs

func (m *Menshen) GetOpenvpnArgs() ([]string, error)

Asks menshen for OpenVPN arguments Returns a list of arguments that can be passed over as command line arguments There are key-value arguments like "--dev tun" and boolean arguments like "--persisst-key" without additional value Currently, there is no caching implemented

func (*Menshen) GetPemCertificate

func (m *Menshen) GetPemCertificate() ([]byte, error)

Asks menshen for valid client credentials (certificate + key) Currently, there is no caching implemented

func (*Menshen) GetSnowflakeCh

func (m *Menshen) GetSnowflakeCh() chan *snowflake.StatusEvent

func (*Menshen) IsManualLocation

func (m *Menshen) IsManualLocation() bool

Returns true if the user selected a preferred location to connect with

func (*Menshen) IsUDPAvailable

func (m *Menshen) IsUDPAvailable() bool

Returns true if at least one gateway supports udp

func (*Menshen) NeedsCredentials

func (m *Menshen) NeedsCredentials() bool

func (*Menshen) SetAutomaticGateway

func (m *Menshen) SetAutomaticGateway()

Sets m.userChoice to an empty string (auto-select best gateway/location)

func (*Menshen) SetManualGateway

func (m *Menshen) SetManualGateway(location string)

Sets m.userChoice to a location if the user selects a location in the GUI

Jump to

Keyboard shortcuts

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