summaryrefslogtreecommitdiff
path: root/pkg/vpn
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2020-06-22 22:00:23 +0200
committerkali kaneko (leap communications) <kali@leap.se>2020-06-26 12:13:44 +0200
commit06a7453984adca0b34e62421a1baa8fe54b0d7bb (patch)
tree4eb7d0f31d540c33d2d6f53ed44257c06a4d8220 /pkg/vpn
parent20266b063c1be8818d4582bff7b59486551ee447 (diff)
[refactor] several simplifications after review
- simplify notification routine (we dont need no rejected action). we just check every hour, as in the original code. - open links directly from Qt - rename some global variables to make them less cryptic - move cleanup function to the same module that created them
Diffstat (limited to 'pkg/vpn')
-rw-r--r--pkg/vpn/main.go23
1 files changed, 19 insertions, 4 deletions
diff --git a/pkg/vpn/main.go b/pkg/vpn/main.go
index 9d59131..f3c5b83 100644
--- a/pkg/vpn/main.go
+++ b/pkg/vpn/main.go
@@ -19,6 +19,8 @@ import (
"io/ioutil"
"log"
"os"
+ "path"
+ "path/filepath"
"0xacab.org/leap/bitmask-vpn/pkg/config"
"0xacab.org/leap/bitmask-vpn/pkg/vpn/bonafide"
@@ -52,10 +54,15 @@ func Init() (*Bitmask, error) {
b := Bitmask{tempdir, statusCh, nil, bonafide, launch, "", nil}
/*
- err = b.StopVPN()
- if err != nil {
- return nil, err
- }
+ TODO -- we still want to do this, since it resets the fw/vpn if running
+ from a previous one, but first we need to complete all the
+ system/helper checks that we can do. otherwise this times out with an
+ error that's captured badly as of today.
+
+ err = b.StopVPN()
+ if err != nil {
+ return nil, err
+ }
*/
err = ioutil.WriteFile(b.getCaCertPath(), config.CaCert, 0600)
@@ -87,3 +94,11 @@ func (b *Bitmask) Close() {
func (b *Bitmask) Version() (string, error) {
return "", nil
}
+
+func Cleanup() {
+ dirs, _ := filepath.Glob(path.Join(os.TempDir(), "leap-*"))
+ for _, d := range dirs {
+ log.Println("removing temp dir:", d)
+ os.RemoveAll(d)
+ }
+}