Browse Source

main: simplify warnings

Jason A. Donenfeld 8 months ago
parent
commit
84b5a4d83d
3 changed files with 1 additions and 44 deletions
  1. 0
    14
      Makefile
  2. 0
    15
      donotuseon_linux.go
  3. 1
    15
      main.go

+ 0
- 14
Makefile View File

@@ -1,24 +1,10 @@
1 1
 PREFIX ?= /usr
2 2
 DESTDIR ?=
3 3
 BINDIR ?= $(PREFIX)/bin
4
-export GOPATH ?= $(CURDIR)/.gopath
5 4
 export GO111MODULE := on
6 5
 
7 6
 all: generate-version-and-build
8 7
 
9
-ifeq ($(shell go env GOOS)|$(wildcard .git),linux|)
10
-$(error Do not build this for Linux. Instead use the Linux kernel module. See wireguard.com/install/ for more info.)
11
-else ifeq ($(shell go env GOOS),linux)
12
-ireallywantobuildon_linux.go:
13
-	@printf "WARNING: This software is meant for use on non-Linux\nsystems. For Linux, please use the kernel module\ninstead. See wireguard.com/install/ for more info.\n\n" >&2
14
-	@printf 'package main\nconst UseTheKernelModuleInstead = 0xdeadbabe\n' > "$@"
15
-clean-ireallywantobuildon_linux.go:
16
-	@rm -f ireallywantobuildon_linux.go
17
-.PHONY: clean-ireallywantobuildon_linux.go
18
-clean: clean-ireallywantobuildon_linux.go
19
-wireguard-go: ireallywantobuildon_linux.go
20
-endif
21
-
22 8
 MAKEFLAGS += --no-print-directory
23 9
 
24 10
 generate-version-and-build:

+ 0
- 15
donotuseon_linux.go View File

@@ -1,15 +0,0 @@
1
-// +build !android
2
-
3
-/* SPDX-License-Identifier: MIT
4
- *
5
- * Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
6
- */
7
-
8
-package main
9
-
10
-const DoNotUseThisProgramOnLinux = UseTheKernelModuleInstead
11
-
12
-// --------------------------------------------------------
13
-// Do not use this on Linux. Instead use the kernel module.
14
-// See wireguard.com/install for more information.
15
-// --------------------------------------------------------

+ 1
- 15
main.go View File

@@ -40,31 +40,19 @@ func warning() {
40 40
 	if runtime.GOOS != "linux" || os.Getenv(ENV_WG_PROCESS_FOREGROUND) == "1" {
41 41
 		return
42 42
 	}
43
-	shouldQuit := os.Getenv("WG_I_PREFER_BUGGY_USERSPACE_TO_POLISHED_KMOD") != "1"
44 43
 
45 44
 	fmt.Fprintln(os.Stderr, "WARNING WARNING WARNING WARNING WARNING WARNING WARNING")
46 45
 	fmt.Fprintln(os.Stderr, "W                                                     G")
47 46
 	fmt.Fprintln(os.Stderr, "W   You are running this software on a Linux kernel,  G")
48
-	fmt.Fprintln(os.Stderr, "W   which is probably unnecessary and foolish. This   G")
47
+	fmt.Fprintln(os.Stderr, "W   which is probably unnecessary and misguided. This G")
49 48
 	fmt.Fprintln(os.Stderr, "W   is because the Linux kernel has built-in first    G")
50 49
 	fmt.Fprintln(os.Stderr, "W   class support for WireGuard, and this support is  G")
51 50
 	fmt.Fprintln(os.Stderr, "W   much more refined than this slower userspace      G")
52 51
 	fmt.Fprintln(os.Stderr, "W   implementation. For more information on           G")
53 52
 	fmt.Fprintln(os.Stderr, "W   installing the kernel module, please visit:       G")
54 53
 	fmt.Fprintln(os.Stderr, "W           https://www.wireguard.com/install         G")
55
-	if shouldQuit {
56
-		fmt.Fprintln(os.Stderr, "W                                                     G")
57
-		fmt.Fprintln(os.Stderr, "W   If you still want to use this program, against    G")
58
-		fmt.Fprintln(os.Stderr, "W   the advice here, please first export this         G")
59
-		fmt.Fprintln(os.Stderr, "W   environment variable:                             G")
60
-		fmt.Fprintln(os.Stderr, "W   WG_I_PREFER_BUGGY_USERSPACE_TO_POLISHED_KMOD=1    G")
61
-	}
62 54
 	fmt.Fprintln(os.Stderr, "W                                                     G")
63 55
 	fmt.Fprintln(os.Stderr, "WARNING WARNING WARNING WARNING WARNING WARNING WARNING")
64
-
65
-	if shouldQuit {
66
-		os.Exit(1)
67
-	}
68 56
 }
69 57
 
70 58
 func main() {
@@ -75,8 +63,6 @@ func main() {
75 63
 
76 64
 	warning()
77 65
 
78
-	// parse arguments
79
-
80 66
 	var foreground bool
81 67
 	var interfaceName string
82 68
 	if len(os.Args) < 2 || len(os.Args) > 3 {

Loading…
Cancel
Save