|
8 | 8 |
|
9 | 9 | "github.com/akamensky/argparse" |
10 | 10 | "github.com/octeep/wireproxy" |
| 11 | + "golang.zx2c4.com/wireguard/device" |
11 | 12 | "suah.dev/protect" |
12 | 13 | ) |
13 | 14 |
|
@@ -63,6 +64,7 @@ func main() { |
63 | 64 | parser := argparse.NewParser("wireproxy", "Userspace wireguard client for proxying") |
64 | 65 |
|
65 | 66 | config := parser.String("c", "config", &argparse.Options{Help: "Path of configuration file"}) |
| 67 | + silent := parser.Flag("s", "silent", &argparse.Options{Help: "Silent mode"}) |
66 | 68 | daemon := parser.Flag("d", "daemon", &argparse.Options{Help: "Make wireproxy run in background"}) |
67 | 69 | printVerison := parser.Flag("v", "version", &argparse.Options{Help: "Print version"}) |
68 | 70 | configTest := parser.Flag("n", "configtest", &argparse.Options{Help: "Configtest mode. Only check the configuration file for validity."}) |
@@ -114,10 +116,15 @@ func main() { |
114 | 116 | return |
115 | 117 | } |
116 | 118 |
|
| 119 | + logLevel := device.LogLevelVerbose |
| 120 | + if *silent { |
| 121 | + logLevel = device.LogLevelSilent |
| 122 | + } |
| 123 | + |
117 | 124 | // no file access is allowed from now on, only networking |
118 | 125 | pledgeOrPanic("stdio inet dns") |
119 | 126 |
|
120 | | - tnet, err := wireproxy.StartWireguard(conf.Device) |
| 127 | + tnet, err := wireproxy.StartWireguard(conf.Device, logLevel) |
121 | 128 | if err != nil { |
122 | 129 | log.Fatal(err) |
123 | 130 | } |
|
0 commit comments