Skip to content
Snippets Groups Projects
Unverified Commit 6dc48962 authored by meskio's avatar meskio :tent:
Browse files

[feat] add a cli client

parent 56c6dbf6
No related branches found
No related tags found
No related merge requests found
Pipeline #21977 failed
......@@ -2,7 +2,11 @@
cmd/bitmask-vpn/bitmask-vpn
/bitmask-helper
cmd/bitmask-helper/bitmask-helper
/bitmask-cli
cmd/bitmask-cli/bitmask-cli
locales/*/out.gotext.json
tools/transifex/transifex
.*.swp
*.exe
tools/transifex/transifex
// Copyright (C) 2018 LEAP
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package main
import (
"fmt"
"log"
"os"
"os/signal"
"0xacab.org/leap/bitmask-systray/pkg/bitmask"
"golang.org/x/text/language"
"golang.org/x/text/message"
)
const (
provider = "riseup.net"
logFile = "systray.log"
)
var version string
func main() {
if len(os.Args) <= 1 {
help()
os.Exit(1)
}
switch os.Args[1] {
case "connect":
start()
case "version":
fmt.Println(version)
default:
help()
}
}
func help() {
fmt.Println(`Bitmask VPN - commands:
help - Displays this help
connect - Connects to the VPN (stops by ctrl-c)
version - Displays the version`)
}
func start() {
signalCh := make(chan os.Signal, 1)
signal.Notify(signalCh, os.Interrupt)
b, err := bitmask.Init(message.NewPrinter(language.English))
if err != nil {
log.Fatal(err)
}
defer b.Close()
err = b.StartVPN(provider)
if err != nil {
log.Println(err)
os.Exit(1)
}
<-signalCh
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment