|
1 | 1 | package main |
2 | 2 |
|
3 | 3 | import ( |
4 | | - "flag" |
5 | 4 | "os" |
6 | 5 |
|
7 | 6 | "github.com/Pandentia/protoplex/protoplex" |
8 | 7 | "github.com/Pandentia/protoplex/protoplex/protocols" |
9 | 8 | "github.com/rs/zerolog" |
| 9 | + "gopkg.in/alecthomas/kingpin.v2" |
10 | 10 | ) |
11 | 11 |
|
12 | 12 | func main() { |
| 13 | + app := kingpin.New("protoplex", "A fast and simple protocol multiplexer.") |
13 | 14 | logger := zerolog.New(os.Stdout).With().Timestamp().Logger() |
14 | 15 |
|
15 | | - bind := flag.String("bind", "0.0.0.0:8443", "The address to bind to") |
16 | | - verbose := flag.Bool("verbose", false, "Whether to be verbose") |
17 | | - pretty := flag.Bool("pretty", false, "Whether to enable pretty printing") |
| 16 | + bind := app.Flag("bind", "The address to bind to").Short('b').Default("0.0.0.0:8443").String() |
| 17 | + verbose := app.Flag("verbose", "Enables debug logging").Short('v').Bool() |
| 18 | + pretty := app.Flag("pretty", "Enables pretty logging").Short('p').Bool() |
18 | 19 |
|
19 | | - ssh := flag.String("ssh", "", "The SSH server address") |
20 | | - tls := flag.String("tls", "", "The TLS/HTTPS server address") |
21 | | - openvpn := flag.String("ovpn", "", "The OpenVPN server address") |
22 | | - http := flag.String("http", "", "The HTTP server address") |
23 | | - socks5 := flag.String("socks5", "", "The SOCKS5 server address") |
24 | | - socks4 := flag.String("socks4", "", "The SOCKS4 server address") |
| 20 | + ssh := app.Flag("ssh", "The SSH server address").String() |
| 21 | + tls := app.Flag("tls", "The TLS/HTTPS server address").String() |
| 22 | + openvpn := app.Flag("ovpn", "The OpenVPN server address").String() |
| 23 | + http := app.Flag("http", "The HTTP server address").String() |
| 24 | + socks5 := app.Flag("socks5", "The SOCKS5 server address").String() |
| 25 | + socks4 := app.Flag("socks4", "The SOCKS4 server address").String() |
25 | 26 | // stRelay := flag.String("strelay", "", "The Syncthing Relay server address") |
26 | 27 |
|
27 | | - flag.Parse() |
| 28 | + app.Parse(os.Args[1:]) |
28 | 29 |
|
29 | 30 | if *pretty { |
30 | 31 | logger = logger.Output(zerolog.ConsoleWriter{Out: os.Stderr}) |
|
0 commit comments