diff options
author | Josh Bleecher Snyder <josh@tailscale.com> | 2022-03-16 16:09:48 -0700 |
---|---|---|
committer | Josh Bleecher Snyder <josh@tailscale.com> | 2022-03-16 16:09:48 -0700 |
commit | 42c9af45e12dbb2de4d3c273bfc7deeda984f827 (patch) | |
tree | 67d59df66ccd8683f92efb256323257adb240e5b | |
parent | ae6bc4dd64e149270a86d649c92728432a50945f (diff) |
all: update to Go 1.18
Bump go.mod and README.
Switch to upstream net/netip.
Use strings.Cut.
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | conn/bind_linux.go | 2 | ||||
-rw-r--r-- | conn/bind_std.go | 3 | ||||
-rw-r--r-- | conn/bind_windows.go | 2 | ||||
-rw-r--r-- | conn/bindtest/bindtest.go | 2 | ||||
-rw-r--r-- | conn/conn.go | 3 | ||||
-rw-r--r-- | device/allowedips.go | 3 | ||||
-rw-r--r-- | device/allowedips_rand_test.go | 3 | ||||
-rw-r--r-- | device/allowedips_test.go | 3 | ||||
-rw-r--r-- | device/device_test.go | 2 | ||||
-rw-r--r-- | device/endpoint_test.go | 3 | ||||
-rw-r--r-- | device/uapi.go | 10 | ||||
-rw-r--r-- | go.mod | 2 | ||||
-rw-r--r-- | ratelimiter/ratelimiter.go | 3 | ||||
-rw-r--r-- | ratelimiter/ratelimiter_test.go | 3 | ||||
-rw-r--r-- | tun/netstack/examples/http_client.go | 2 | ||||
-rw-r--r-- | tun/netstack/examples/http_server.go | 2 | ||||
-rw-r--r-- | tun/netstack/examples/ping_client.go | 2 | ||||
-rw-r--r-- | tun/netstack/tun.go | 2 | ||||
-rw-r--r-- | tun/tuntest/tuntest.go | 2 |
20 files changed, 23 insertions, 33 deletions
@@ -46,7 +46,7 @@ This will run on OpenBSD. It does not yet support sticky sockets. Fwmark is mapp ## Building -This requires an installation of [go](https://golang.org) ≥ 1.17. +This requires an installation of [go](https://golang.org) ≥ 1.18. ``` $ git clone https://git.zx2c4.com/wireguard-go diff --git a/conn/bind_linux.go b/conn/bind_linux.go index b3d755c..f11f031 100644 --- a/conn/bind_linux.go +++ b/conn/bind_linux.go @@ -8,13 +8,13 @@ package conn import ( "errors" "net" + "net/netip" "strconv" "sync" "syscall" "unsafe" "golang.org/x/sys/unix" - "golang.zx2c4.com/go118/netip" ) type ipv4Source struct { diff --git a/conn/bind_std.go b/conn/bind_std.go index de03b10..ab800ba 100644 --- a/conn/bind_std.go +++ b/conn/bind_std.go @@ -8,10 +8,9 @@ package conn import ( "errors" "net" + "net/netip" "sync" "syscall" - - "golang.zx2c4.com/go118/netip" ) // StdNetBind is meant to be a temporary solution on platforms for which diff --git a/conn/bind_windows.go b/conn/bind_windows.go index 476e277..9268bc1 100644 --- a/conn/bind_windows.go +++ b/conn/bind_windows.go @@ -9,13 +9,13 @@ import ( "encoding/binary" "io" "net" + "net/netip" "strconv" "sync" "sync/atomic" "unsafe" "golang.org/x/sys/windows" - "golang.zx2c4.com/go118/netip" "golang.zx2c4.com/wireguard/conn/winrio" ) diff --git a/conn/bindtest/bindtest.go b/conn/bindtest/bindtest.go index 6fc1972..b38cae6 100644 --- a/conn/bindtest/bindtest.go +++ b/conn/bindtest/bindtest.go @@ -9,9 +9,9 @@ import ( "fmt" "math/rand" "net" + "net/netip" "os" - "golang.zx2c4.com/go118/netip" "golang.zx2c4.com/wireguard/conn" ) diff --git a/conn/conn.go b/conn/conn.go index 35fb6b1..5a93b2b 100644 --- a/conn/conn.go +++ b/conn/conn.go @@ -9,11 +9,10 @@ package conn import ( "errors" "fmt" + "net/netip" "reflect" "runtime" "strings" - - "golang.zx2c4.com/go118/netip" ) // A ReceiveFunc receives a single inbound packet from the network. diff --git a/device/allowedips.go b/device/allowedips.go index 06c5465..3cac694 100644 --- a/device/allowedips.go +++ b/device/allowedips.go @@ -11,10 +11,9 @@ import ( "errors" "math/bits" "net" + "net/netip" "sync" "unsafe" - - "golang.zx2c4.com/go118/netip" ) type parentIndirection struct { diff --git a/device/allowedips_rand_test.go b/device/allowedips_rand_test.go index ff56fe6..0d3eecb 100644 --- a/device/allowedips_rand_test.go +++ b/device/allowedips_rand_test.go @@ -8,10 +8,9 @@ package device import ( "math/rand" "net" + "net/netip" "sort" "testing" - - "golang.zx2c4.com/go118/netip" ) const ( diff --git a/device/allowedips_test.go b/device/allowedips_test.go index 68f382b..225c788 100644 --- a/device/allowedips_test.go +++ b/device/allowedips_test.go @@ -8,9 +8,8 @@ package device import ( "math/rand" "net" + "net/netip" "testing" - - "golang.zx2c4.com/go118/netip" ) type testPairCommonBits struct { diff --git a/device/device_test.go b/device/device_test.go index b484ca2..ab7236e 100644 --- a/device/device_test.go +++ b/device/device_test.go @@ -11,6 +11,7 @@ import ( "fmt" "io" "math/rand" + "net/netip" "runtime" "runtime/pprof" "sync" @@ -18,7 +19,6 @@ import ( "testing" "time" - "golang.zx2c4.com/go118/netip" "golang.zx2c4.com/wireguard/conn" "golang.zx2c4.com/wireguard/conn/bindtest" "golang.zx2c4.com/wireguard/tun/tuntest" diff --git a/device/endpoint_test.go b/device/endpoint_test.go index f1ae47e..b265be6 100644 --- a/device/endpoint_test.go +++ b/device/endpoint_test.go @@ -7,8 +7,7 @@ package device import ( "math/rand" - - "golang.zx2c4.com/go118/netip" + "net/netip" ) type DummyEndpoint struct { diff --git a/device/uapi.go b/device/uapi.go index 1994d46..746cf29 100644 --- a/device/uapi.go +++ b/device/uapi.go @@ -12,13 +12,13 @@ import ( "fmt" "io" "net" + "net/netip" "strconv" "strings" "sync" "sync/atomic" "time" - "golang.zx2c4.com/go118/netip" "golang.zx2c4.com/wireguard/ipc" ) @@ -161,12 +161,10 @@ func (device *Device) IpcSetOperation(r io.Reader) (err error) { peer.handlePostConfig() return nil } - parts := strings.Split(line, "=") - if len(parts) != 2 { - return ipcErrorf(ipc.IpcErrorProtocol, "failed to parse line %q, found %d =-separated parts, want 2", line, len(parts)) + key, value, ok := strings.Cut(line, "=") + if !ok { + return ipcErrorf(ipc.IpcErrorProtocol, "failed to parse line %q", line) } - key := parts[0] - value := parts[1] if key == "public_key" { if deviceConfig { @@ -1,6 +1,6 @@ module golang.zx2c4.com/wireguard -go 1.17 +go 1.18 require ( golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa diff --git a/ratelimiter/ratelimiter.go b/ratelimiter/ratelimiter.go index 8e78d5e..1e3c252 100644 --- a/ratelimiter/ratelimiter.go +++ b/ratelimiter/ratelimiter.go @@ -6,10 +6,9 @@ package ratelimiter import ( + "net/netip" "sync" "time" - - "golang.zx2c4.com/go118/netip" ) const ( diff --git a/ratelimiter/ratelimiter_test.go b/ratelimiter/ratelimiter_test.go index 3e06ff7..ca7db72 100644 --- a/ratelimiter/ratelimiter_test.go +++ b/ratelimiter/ratelimiter_test.go @@ -6,10 +6,9 @@ package ratelimiter import ( + "net/netip" "testing" "time" - - "golang.zx2c4.com/go118/netip" ) type result struct { diff --git a/tun/netstack/examples/http_client.go b/tun/netstack/examples/http_client.go index b39b453..352c1e4 100644 --- a/tun/netstack/examples/http_client.go +++ b/tun/netstack/examples/http_client.go @@ -12,8 +12,8 @@ import ( "io" "log" "net/http" + "net/netip" - "golang.zx2c4.com/go118/netip" "golang.zx2c4.com/wireguard/conn" "golang.zx2c4.com/wireguard/device" "golang.zx2c4.com/wireguard/tun/netstack" diff --git a/tun/netstack/examples/http_server.go b/tun/netstack/examples/http_server.go index 40f7804..0fdf4cd 100644 --- a/tun/netstack/examples/http_server.go +++ b/tun/netstack/examples/http_server.go @@ -13,8 +13,8 @@ import ( "log" "net" "net/http" + "net/netip" - "golang.zx2c4.com/go118/netip" "golang.zx2c4.com/wireguard/conn" "golang.zx2c4.com/wireguard/device" "golang.zx2c4.com/wireguard/tun/netstack" diff --git a/tun/netstack/examples/ping_client.go b/tun/netstack/examples/ping_client.go index cbd54b8..a1bc7f8 100644 --- a/tun/netstack/examples/ping_client.go +++ b/tun/netstack/examples/ping_client.go @@ -12,12 +12,12 @@ import ( "bytes" "log" "math/rand" + "net/netip" "time" "golang.org/x/net/icmp" "golang.org/x/net/ipv4" - "golang.zx2c4.com/go118/netip" "golang.zx2c4.com/wireguard/conn" "golang.zx2c4.com/wireguard/device" "golang.zx2c4.com/wireguard/tun/netstack" diff --git a/tun/netstack/tun.go b/tun/netstack/tun.go index 8b1bb7f..c26d8ed 100644 --- a/tun/netstack/tun.go +++ b/tun/netstack/tun.go @@ -13,13 +13,13 @@ import ( "fmt" "io" "net" + "net/netip" "os" "regexp" "strconv" "strings" "time" - "golang.zx2c4.com/go118/netip" "golang.zx2c4.com/wireguard/tun" "golang.org/x/net/dns/dnsmessage" diff --git a/tun/tuntest/tuntest.go b/tun/tuntest/tuntest.go index bdf0467..8196c34 100644 --- a/tun/tuntest/tuntest.go +++ b/tun/tuntest/tuntest.go @@ -8,9 +8,9 @@ package tuntest import ( "encoding/binary" "io" + "net/netip" "os" - "golang.zx2c4.com/go118/netip" "golang.zx2c4.com/wireguard/tun" ) |