summaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-04-15 23:32:44 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2021-04-15 23:35:45 -0600
commit39888214425f5c4d6c3c8344cc0087880de9e663 (patch)
tree7343a31df63045a01d4d265873cb3c2e67308ec9 /main.go
parentdevice: don't defer unlocking from loop (diff)
downloadwireguard-go-39888214425f5c4d6c3c8344cc0087880de9e663.tar.xz
wireguard-go-39888214425f5c4d6c3c8344cc0087880de9e663.zip
main: print kernel warning on OpenBSD and FreeBSD too
More kernels! Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'main.go')
-rw-r--r--main.go29
1 files changed, 16 insertions, 13 deletions
diff --git a/main.go b/main.go
index a599de1..639d644 100644
--- a/main.go
+++ b/main.go
@@ -33,25 +33,28 @@ const (
)
func printUsage() {
- fmt.Printf("usage:\n")
- fmt.Printf("%s [-f/--foreground] INTERFACE-NAME\n", os.Args[0])
+ fmt.Printf("Usage: %s [-f/--foreground] INTERFACE-NAME\n", os.Args[0])
}
func warning() {
- if runtime.GOOS != "linux" || os.Getenv(ENV_WG_PROCESS_FOREGROUND) == "1" {
+ switch runtime.GOOS {
+ case "linux", "freebsd", "openbsd":
+ if os.Getenv(ENV_WG_PROCESS_FOREGROUND) == "1" {
+ return
+ }
+ default:
return
}
- fmt.Fprintln(os.Stderr, "┌───────────────────────────────────────────────────┐")
- fmt.Fprintln(os.Stderr, "│ │")
- fmt.Fprintln(os.Stderr, "│ Running this software on Linux is unnecessary, │")
- fmt.Fprintln(os.Stderr, "│ because the Linux kernel has built-in first │")
- fmt.Fprintln(os.Stderr, "│ class support for WireGuard, which will be │")
- fmt.Fprintln(os.Stderr, "│ faster, slicker, and better integrated. For │")
- fmt.Fprintln(os.Stderr, "│ information on installing the kernel module, │")
- fmt.Fprintln(os.Stderr, "│ please visit: <https://wireguard.com/install>. │")
- fmt.Fprintln(os.Stderr, "│ │")
- fmt.Fprintln(os.Stderr, "└───────────────────────────────────────────────────┘")
+ fmt.Fprintln(os.Stderr, "┌──────────────────────────────────────────────────────┐")
+ fmt.Fprintln(os.Stderr, "│ │")
+ fmt.Fprintln(os.Stderr, "│ Running wireguard-go is not required because this │")
+ fmt.Fprintln(os.Stderr, "│ kernel has first class support for WireGuard. For │")
+ fmt.Fprintln(os.Stderr, "│ information on installing the kernel module, │")
+ fmt.Fprintln(os.Stderr, "│ please visit: │")
+ fmt.Fprintln(os.Stderr, "│ https://www.wireguard.com/install/ │")
+ fmt.Fprintln(os.Stderr, "│ │")
+ fmt.Fprintln(os.Stderr, "└──────────────────────────────────────────────────────┘")
}
func main() {