forked from lyc8503/EasierConnect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
30 lines (27 loc) · 1.14 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package main
import (
"EasierConnect/core"
"flag"
"log"
)
func main() {
// CLI args
host, port, username, password, twfId := "", 0, "", "", ""
flag.StringVar(&host, "server", "", "EasyConnect server address (e.g. vpn.nju.edu.cn, sslvpn.sysu.edu.cn)")
flag.StringVar(&username, "username", "", "Your username")
flag.StringVar(&password, "password", "", "Your password")
flag.StringVar(&core.SocksBind, "socks-bind", ":1080", "The addr socks5 server listens on (e.g. 0.0.0.0:1080)")
flag.StringVar(&twfId, "twf-id", "", "Login using twfID captured (mostly for debug usage)")
flag.IntVar(&port, "port", 443, "EasyConnect port address (e.g. 443)")
core.DebugDump = false
core.ParseServConfig = true
flag.BoolVar(&core.DebugDump, "debug-dump", false, "Enable traffic debug dump (only for debug usage)")
flag.BoolVar(&core.ParseServConfig, "parse", true, "parse server buildconfig")
flag.Parse()
if host == "" || ((username == "" || password == "") && twfId == "") {
log.Printf("Starting as ECAgent mode. For more infomations: `EasierConnect --help`.\n")
core.StartECAgent()
} else {
core.StartClient(host, port, username, password, twfId)
}
}