From 39888214425f5c4d6c3c8344cc0087880de9e663 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 15 Apr 2021 23:32:44 -0600 Subject: [PATCH] main: print kernel warning on OpenBSD and FreeBSD too More kernels! Signed-off-by: Jason A. Donenfeld --- main.go | 29 ++++++++++++++++------------- 1 file 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: . │") - 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() {