Documentation ¶
Index ¶
- Constants
- func IsPremiumLocation(location forestvpn_api.Location) bool
- type AuthClientWrapper
- func (w AuthClientWrapper) GetUnexpiredOrMostRecentBillingFeature(userID string) (forestvpn_api.BillingFeature, error)
- func (w AuthClientWrapper) ListLocations(country string) error
- func (w AuthClientWrapper) Login(email string, password string) error
- func (w AuthClientWrapper) Register(email string, password string) error
- func (w AuthClientWrapper) SetLocation(device *forestvpn_api.Device, user_id string) error
- func (w AuthClientWrapper) SetUpProfile(response *resty.Response) (string, error)
- type LocationWrapper
- type State
Constants ¶
const Falkenstein = "b134d679-8697-4dc6-b629-c4c189392fca"
const FirebaseApiKey = "AIzaSyBLSD5qtCem7IVxB9aToqTXWgDsKMAXnt0"
FirebaseApiKey is stored in an environment variable and assigned during the build with ldflags.
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 ¶
GetStatus is a method to get the status of a Wireguard connection.
Using api.ApiClientWrapper.GetStatus instead