summaryrefslogtreecommitdiff
path: root/pkg/backend/bitmask.go
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2020-06-17 21:14:35 +0200
committerkali kaneko (leap communications) <kali@leap.se>2020-06-26 12:13:44 +0200
commit20266b063c1be8818d4582bff7b59486551ee447 (patch)
tree2f7bd97624104e7defecd6d29fff8dad2446c0ce /pkg/backend/bitmask.go
parent9b8009cfaf6707d23a20494cd5467aed9c98513b (diff)
[feat] pass initialization errors to gui
Diffstat (limited to 'pkg/backend/bitmask.go')
-rw-r--r--pkg/backend/bitmask.go67
1 files changed, 0 insertions, 67 deletions
diff --git a/pkg/backend/bitmask.go b/pkg/backend/bitmask.go
deleted file mode 100644
index 2b58859..0000000
--- a/pkg/backend/bitmask.go
+++ /dev/null
@@ -1,67 +0,0 @@
-package backend
-
-import (
- "log"
- "os"
-
- "0xacab.org/leap/bitmask-vpn/pkg/bitmask"
- "0xacab.org/leap/bitmask-vpn/pkg/config"
- "0xacab.org/leap/bitmask-vpn/pkg/config/version"
-)
-
-func initializeBitmask() {
- if ctx == nil {
- log.Println("error: cannot initialize bitmask, ctx is nil")
- os.Exit(1)
- }
- bitmask.InitializeLogger()
-
- b, err := bitmask.InitializeBitmask()
- if err != nil {
- log.Println("error: cannot initialize bitmask")
- }
- ctx.bm = b
- ctx.cfg = config.ParseConfig()
-}
-
-func startVPN() {
- err := ctx.bm.StartVPN(ctx.Provider)
- if err != nil {
- log.Println(err)
- os.Exit(1)
- }
-}
-
-func stopVPN() {
- err := ctx.bm.StopVPN()
- if err != nil {
- log.Println(err)
- }
-}
-
-func wantDonations() bool {
- if config.AskForDonations == "true" {
- return true
- }
- return false
-}
-
-// initializeContext initializes an empty connStatus and assigns it to the
-// global ctx holder. This is expected to be called only once, so the public
-// api uses the sync.Once primitive to call this.
-func initializeContext(provider, appName string) {
- var st status = off
- ctx = &connectionCtx{
- AppName: appName,
- Provider: provider,
- TosURL: config.TosURL,
- HelpURL: config.HelpURL,
- DonateURL: config.DonateURL,
- AskForDonations: wantDonations(),
- DonateDialog: false,
- Version: version.VERSION,
- Status: st,
- }
- go trigger(OnStatusChanged)
- initializeBitmask()
-}