actions

package
v0.2.2-post.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2022 License: MIT Imports: 17 Imported by: 0

README

actions

import "github.com/forestvpn/cli/actions"

Index

type AuthClientWrapper

AuthClientWrapper is a structure that is used as a high-level wrapper for both AuthClient and ApiClient. It is used as main wgrest and Firebase REST API client as both of wrapped structures share the same AccessToken for authentication purposes.

type AuthClientWrapper struct {
    AuthClient auth.AuthClient
    ApiClient  api.ApiClientWrapper
}
func (AuthClientWrapper) ListLocations
func (w AuthClientWrapper) ListLocations(country string) error

ListLocations is a function to get the list of locations available for user.

See https://github.com/forestvpn/api-client-go/blob/main/docs/GeoApi.md#listlocations for more information.

func (AuthClientWrapper) Login
func (w AuthClientWrapper) Login(email string, password string, deviceID string) error

Login is a method for logging in a user on the Firebase. Accepts the deviceID (coming from local file) which indicates wether the device was created on previous login. If the deviceID is empty, then should create a new device on login.

See https://firebase.google.com/docs/reference/rest/auth#section-sign-in-email-password for more information.

func (AuthClientWrapper) Logout
func (w AuthClientWrapper) Logout() error

Logout is a method that removes FirebaseAuthFile, i.e. logs out the user.

func (AuthClientWrapper) Register
func (w AuthClientWrapper) Register(email string, password string) error

Register is a method to perform a user registration on Firebase.

See https://firebase.google.com/docs/reference/rest/auth#section-create-email-password for more information.

func (AuthClientWrapper) SetLocation
func (w AuthClientWrapper) SetLocation(billingFeature forestvpn_api.BillingFeature, location LocationWrapper, includeHostIP bool) error

SetLocation is a function that writes the location data into the Wireguard configuration file. It uses gopkg.in/ini.v1 package to form Woreguard compatible configuration file from the location data. If the user subscrition on the Forest VPN services is out of date, it calls BuyPremiumDialog.

See https://github.com/forestvpn/api-client-go/blob/main/docs/BillingFeature.md for more information.

type LocationWrapper

type LocationWrapper struct {
    Location forestvpn_api.Location
    Premium  bool
}
func GetWrappedLocations
func GetWrappedLocations(billingFeature forestvpn_api.BillingFeature, locations []forestvpn_api.Location) []LocationWrapper

type State

State is a structure representing Wireguard connection state.

type State struct {
    // contains filtered or unexported fields
}
func (*State) GetStatus
func (s *State) GetStatus() bool

Deprecated: GetStatus is a method to get the status of a Wireguard connection.

Using api.ApiClientWrapper.GetStatus instead

func (*State) SetDown
func (s *State) SetDown(config string) error

SetDown is used to terminate a Wireguard connection. It executes 'wg-quick' shell command.

func (*State) SetUp
func (s *State) SetUp(config string) error

SetUp is a method used to establish a Wireguard connection. It executes 'wg-quick' shell command.

Generated by gomarkdoc

Documentation

Index

Constants

View Source
const Falkenstein = "b134d679-8697-4dc6-b629-c4c189392fca"
View Source
const FirebaseApiKey = "AIzaSyBLSD5qtCem7IVxB9aToqTXWgDsKMAXnt0"

FirebaseApiKey is stored in an environment variable and assigned during the build with ldflags.

View Source
const Helsinki = "7fc5b17c-eddf-413f-8b37-9d36eb5e33ec"

Variables

This section is empty.

Functions

func IsPremiumLocation

func IsPremiumLocation(location forestvpn_api.Location) bool

Types

type AuthClientWrapper

type AuthClientWrapper struct {
	AuthClient  auth.AuthClient
	ApiClient   api.ApiClientWrapper
	AccountsMap auth.AccountsMap
}

AuthClientWrapper is a structure that is used as a high-level wrapper for both AuthClient and ApiClient. It is used as main wgrest and Firebase REST API client as both of wrapped structures share the same AccessToken for authentication purposes.

func GetAuthClientWrapper

func GetAuthClientWrapper() (AuthClientWrapper, error)

func (AuthClientWrapper) GetUnexpiredOrMostRecentBillingFeature

func (w AuthClientWrapper) GetUnexpiredOrMostRecentBillingFeature(userID string) (forestvpn_api.BillingFeature, error)

func (AuthClientWrapper) ListLocations

func (w AuthClientWrapper) ListLocations(country string) error

ListLocations is a function to get the list of locations available for user.

See https://github.com/forestvpn/api-client-go/blob/main/docs/GeoApi.md#listlocations for more information.

func (AuthClientWrapper) Login

func (w AuthClientWrapper) Login(email string, password string) error

Login is a method for logging in a user on the Firebase. Accepts the deviceID (coming from local file) which indicates wether the device was created on previous login. If the deviceID is empty, then should create a new device on login.

See https://firebase.google.com/docs/reference/rest/auth#section-sign-in-email-password for more information.

func (AuthClientWrapper) Register

func (w AuthClientWrapper) Register(email string, password string) error

Register is a method to perform a user registration on Firebase. See https://firebase.google.com/docs/reference/rest/auth#section-create-email-password for more information.

func (AuthClientWrapper) SetLocation

func (w AuthClientWrapper) SetLocation(device *forestvpn_api.Device, user_id string) error

SetLocation is a function that writes the location data into the Wireguard configuration file. It uses gopkg.in/ini.v1 package to form Woreguard compatible configuration file from the location data. If the user subscrition on the Forest VPN services is out of date, it calls BuyPremiumDialog.

See https://github.com/forestvpn/api-client-go/blob/main/docs/BillingFeature.md for more information.

func (AuthClientWrapper) SetUpProfile

func (w AuthClientWrapper) SetUpProfile(response *resty.Response) (string, error)

type LocationWrapper

type LocationWrapper struct {
	Location forestvpn_api.Location
	Premium  bool
}

func GetLocationWrappers

func GetLocationWrappers(locations []forestvpn_api.Location) []LocationWrapper

type State

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

State is a structure representing Wireguard connection state.

func (*State) GetStatus

func (s *State) GetStatus() bool

GetStatus is a method to get the status of a Wireguard connection.

Using api.ApiClientWrapper.GetStatus instead

func (*State) SetDown

func (s *State) SetDown(user_id string) error

SetDown is used to terminate a Wireguard connection. It executes 'wg-quick' shell command.

func (*State) SetUp

func (s *State) SetUp(user_id string) error

SetUp is a method used to establish a Wireguard connection. It executes 'wg-quick' shell command.

Jump to

Keyboard shortcuts

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