diff --git a/pkg/backend/actions.go b/pkg/backend/actions.go index 08b2f980b7a44c6cfcc942d8365e55a1ccbe1a66..091094c1a990d75b6c68e372800d7c7f488f3fdc 100644 --- a/pkg/backend/actions.go +++ b/pkg/backend/actions.go @@ -23,7 +23,3 @@ func stopVPN() { Msg("Could not stop VPN") } } - -func getGateway() string { - return ctx.bm.GetCurrentGateway() -} diff --git a/pkg/bitmask/autostart/autostart.go b/pkg/bitmask/autostart/autostart.go index c84ca0f48cb9205f5c5bf9b8f1a56e463c60fad4..cf48fe240a66eee733f4f40277572d57e355c090 100644 --- a/pkg/bitmask/autostart/autostart.go +++ b/pkg/bitmask/autostart/autostart.go @@ -29,10 +29,6 @@ import ( pmautostart "github.com/ProtonMail/go-autostart" ) -const ( - errorMsg = `An error has ocurred initializing the VPN: %v` -) - // Autostart holds the functions to enable and disable the application autostart type Autostart interface { Disable() error diff --git a/pkg/helper/ports.go b/pkg/helper/ports.go deleted file mode 100644 index 58e5856c26bfde61ad9a5c2793eec094f3d35375..0000000000000000000000000000000000000000 --- a/pkg/helper/ports.go +++ /dev/null @@ -1,49 +0,0 @@ -package helper - -import ( - "io/ioutil" - "net" - "os" - "path" - "strconv" -) - -func getFirstAvailablePortFrom(port int) int { - for { - if isPortAvailable(port) { - return port - } - if port > 65535 { - return 0 - } - port += 1 - } -} - -func isPortAvailable(port int) bool { - conn, err := net.Dial("tcp", "127.0.0.1:"+strconv.Itoa(port)) - if err != nil { - return true - } else { - defer conn.Close() - return false - } -} - -func writePortToFile(port int) error { - exeDir, err := getExecutableDir() - if err != nil { - return err - } - portFile := path.Join(exeDir, "port") - return ioutil.WriteFile(portFile, []byte(strconv.Itoa(port)+"\n"), 0644) - -} - -func getExecutableDir() (string, error) { - ex, err := os.Executable() - if err != nil { - return "", err - } - return path.Dir(ex), nil -}