Skip to content

Commit

Permalink
feat: show current version
Browse files Browse the repository at this point in the history
  • Loading branch information
Mythologyli committed Oct 11, 2023
1 parent bdbfdf5 commit 4f96e14
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"flag"
"fmt"
"log"
"os"
"strings"

Expand Down Expand Up @@ -54,10 +55,13 @@ func getTomlVal[T int | uint64 | string | bool](valPointer *T, defaultVal T) T {
}

func main() {
version := "0.4.1"

// CLI args
host, port, username, password := "", 0, "", ""
disableServerConfig, disableZjuConfig, disableZjuDns, disableMultiLine, disableKeepAlive := false, false, false, false, false
twfId, configFile, tcpPortForwarding, udpPortForwarding, customDns := "", "", "", "", ""
showVersion := false

flag.StringVar(&host, "server", "rvpn.zju.edu.cn", "EasyConnect server address")
flag.IntVar(&port, "port", 443, "EasyConnect port address")
Expand All @@ -81,9 +85,15 @@ func main() {
flag.StringVar(&core.ZjuDnsServer, "zju-dns-server", "10.10.0.21", "ZJU DNS server address")
flag.StringVar(&twfId, "twf-id", "", "Login using twfID captured (mostly for debug usage)")
flag.StringVar(&configFile, "config", "", "Config file")
flag.BoolVar(&showVersion, "version", false, "Show version")

flag.Parse()

if showVersion {
fmt.Printf("ZJU Connect v%s\n", version)
return
}

if configFile != "" {
var conf Config
_, err := toml.DecodeFile(configFile, &conf)
Expand Down Expand Up @@ -228,5 +238,7 @@ func main() {
return
}

log.Println("Start ZJU Connect v" + version)

core.StartClient(host, port, username, password, twfId)
}

0 comments on commit 4f96e14

Please sign in to comment.