-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
46 lines (41 loc) · 1.06 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import (
"flag"
"fmt"
"github.com/wwricu/bad-proxy-core/proxy"
"os"
)
const (
versionMsg = "v1.0.5"
helpMsg = `
Bad proxy go is a primitive tool for breaching censorship
Run application:
bad_proxy <options>
Options:
--help show this help message
--version show version message
--config specify config file path, default conf/config.json
--router-path specify binary routing file path, default conf/rules.dat
`
)
func main() {
helpFlag := flag.Bool("help", false, "show help info")
versionFlag := flag.Bool("version", false, "show version info")
configPath := flag.String("config", "config.json", "config file path")
routerPath := flag.String("router-path", "rules.dat", "router data path")
flag.Parse()
if *versionFlag == true {
fmt.Println("Bad Proxy Golang", versionMsg)
return
}
if *helpFlag == true {
fmt.Print(helpMsg)
return
}
err := proxy.Startup(*configPath, *routerPath)
if err != nil {
fmt.Println("Error starting proxy:", err)
os.Exit(0)
}
<-make(chan os.Signal)
}