backend

package
v0.0.0-...-10808f7 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: GPL-3.0 Imports: 29 Imported by: 0

README

how to add new fields to backend api

  1. add to the struct in status.go
  2. populate it in toJson() method.
  3. modify the bitmask interface in pkg/bitmask/bitmask.go (note: this is a relict from the past, we can probably get rid of since there'll be a single implementation in the foreseeable future).
  4. modify the bitmask struct in pkg/vpn/main.go
  5. modify the bitmask instantiation in pkg/vpn/main.go:Init
  6. implement functionality...

Documentation

Index

Constants

View Source
const OnStatusChanged string = "OnStatusChanged"

Variables

This section is empty.

Functions

func CheckAuth

func CheckAuth(handler http.HandlerFunc, token string) http.HandlerFunc

func DonateAccepted

func DonateAccepted()

func DonateSeen

func DonateSeen()

func EnableMockBackend

func EnableMockBackend()

func EnableWebAPI

func EnableWebAPI(port string)

func FetchProviderOptsFromRemote

func FetchProviderOptsFromRemote(providerURL string) string

func GetTransport

func GetTransport() *C.char

func GetVersion

func GetVersion() *C.char

func InitializeBitmaskContext

func InitializeBitmaskContext(opts *InitOpts)

func InstallHelpers

func InstallHelpers()

func IsProviderURI

func IsProviderURI(provider string) bool

func Login

func Login(username, password string)

func Quit

func Quit()

func RefreshContext

func RefreshContext() *C.char

func ResetError

func ResetError(errname string)

func ResetNotification

func ResetNotification(label string)

func SetSnowflake

func SetSnowflake(snowflake bool)

func SetTransport

func SetTransport(label string)

func SetUDP

func SetUDP(udp bool)

func SubscribeToEvent

func SubscribeToEvent(event string, f unsafe.Pointer)

func SwitchOff

func SwitchOff()

func SwitchOn

func SwitchOn()

func UseAutomaticGateway

func UseAutomaticGateway()

func UseLocation

func UseLocation(label string)

Types

type Events

type Events struct {
	OnStatusChanged string
}

Events are just a enumeration of all the posible events that C functions can be interested in subscribing to. You cannot subscribe to an event that is not listed here.

type InitOpts

type InitOpts struct {
	ProviderOptions    *bitmask.ProviderOpts
	SkipLaunch         bool
	Obfs4              bool
	UDP                bool
	DisableAutostart   bool
	StartVPN           string
	AvailableProviders []string
}

func InitOptsFromJSON

func InitOptsFromJSON(providerName, providersJSON string) *InitOpts

InitOptsFromJSON initializes the provider configuration (InitOpts) struct. It is called by the c++ code during startup. There is hardcoded provider information from the binary (providersJSON). And there are dynamic provider configurations saved on disk (loaded by appendOnDiskProviders function).

type Providers

type Providers struct {
	Default string                 `json:"default"`
	Data    []bitmask.ProviderOpts `json:"providers"`
}

Source Files

  • actions.go
  • api.go
  • auth.go
  • callbacks.go
  • donate.go
  • gatewaychecker.go
  • init.go
  • mocks.go
  • provider.go
  • status.go
  • webapi.go

Jump to

Keyboard shortcuts

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