]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
all: update to Go 1.18
authorJosh Bleecher Snyder <josh@tailscale.com>
Wed, 16 Mar 2022 23:09:48 +0000 (16:09 -0700)
committerJosh Bleecher Snyder <josh@tailscale.com>
Wed, 16 Mar 2022 23:09:48 +0000 (16:09 -0700)
Bump go.mod and README.

Switch to upstream net/netip.

Use strings.Cut.

Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
20 files changed:
README.md
conn/bind_linux.go
conn/bind_std.go
conn/bind_windows.go
conn/bindtest/bindtest.go
conn/conn.go
device/allowedips.go
device/allowedips_rand_test.go
device/allowedips_test.go
device/device_test.go
device/endpoint_test.go
device/uapi.go
go.mod
ratelimiter/ratelimiter.go
ratelimiter/ratelimiter_test.go
tun/netstack/examples/http_client.go
tun/netstack/examples/http_server.go
tun/netstack/examples/ping_client.go
tun/netstack/tun.go
tun/tuntest/tuntest.go

index 8d1955630726bf95c52bdf121ed510f495f6fd03..30ea3ac0f896c29ff07c98082d1ad67b9c33650f 100644 (file)
--- a/README.md
+++ b/README.md
@@ -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
index b3d755cab13496454f84f52ac47bf8899755a6fb..f11f031d4e74b7e5b6ce1d12dc2f558e619e0aa7 100644 (file)
@@ -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 {
index de03b10656a442342754fc1c2e0f4852cbe700a4..ab800ba29cf22986fc99469da2868e2b5e874f2f 100644 (file)
@@ -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
index 476e2771e5abce2a266cf65cc1f7cb8c5734d432..9268bc15fe7d257ba504cdaaad9f3d4c81c1b412 100644 (file)
@@ -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"
 )
index 6fc19727a57b7f570387d807454dfaafed037d4a..b38cae6719a75e5e55f8e3719653d3d873373aea 100644 (file)
@@ -9,9 +9,9 @@ import (
        "fmt"
        "math/rand"
        "net"
+       "net/netip"
        "os"
 
-       "golang.zx2c4.com/go118/netip"
        "golang.zx2c4.com/wireguard/conn"
 )
 
index 35fb6b1b0020d650bbc4144a9565a98c3bbbe2ef..5a93b2b85d3e3a2352779ea6dfbe22ed58e84215 100644 (file)
@@ -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.
index 06c54656f61457aa6cad2de5db26ed2a20c61429..3cac694fb488d525b4a597d994b3b09811bd0647 100644 (file)
@@ -11,10 +11,9 @@ import (
        "errors"
        "math/bits"
        "net"
+       "net/netip"
        "sync"
        "unsafe"
-
-       "golang.zx2c4.com/go118/netip"
 )
 
 type parentIndirection struct {
index ff56fe6a9050aa43b220aba8f6a7d93ba4cbc38b..0d3eecb067c188f85661cf62558557f386008c79 100644 (file)
@@ -8,10 +8,9 @@ package device
 import (
        "math/rand"
        "net"
+       "net/netip"
        "sort"
        "testing"
-
-       "golang.zx2c4.com/go118/netip"
 )
 
 const (
index 68f382b14c2242e1c5f5863cf5676ecf6ffe4f8f..225c788601d3f8f33fadad87c624805833a71cb8 100644 (file)
@@ -8,9 +8,8 @@ package device
 import (
        "math/rand"
        "net"
+       "net/netip"
        "testing"
-
-       "golang.zx2c4.com/go118/netip"
 )
 
 type testPairCommonBits struct {
index b484ca2ebc1c49542e8ba72f2d4aad57ad4dbd05..ab7236efae3626351bc6e778e1b713d0a7f9c600 100644 (file)
@@ -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"
index f1ae47e34dd549b0b9c3a5dd85a3c2f982479e81..b265be684950a08e29c5a2e2c22b9454a00a4a4f 100644 (file)
@@ -7,8 +7,7 @@ package device
 
 import (
        "math/rand"
-
-       "golang.zx2c4.com/go118/netip"
+       "net/netip"
 )
 
 type DummyEndpoint struct {
index 1994d46da04cd2590026e8703d2de74596a6f892..746cf29eeecc039ea173c28fdfd2f12332f56f8b 100644 (file)
@@ -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 {
diff --git a/go.mod b/go.mod
index b51096070479a3e4c8a577d016520bc9b51ee35f..3dece4a6d17218bc1260cb6a3700be0436a93001 100644 (file)
--- a/go.mod
+++ b/go.mod
@@ -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
index 8e78d5e46ad5d18f3ac8d234a54449d48e9ab2dd..1e3c252e55363445cb8932a41654dd5aa202155b 100644 (file)
@@ -6,10 +6,9 @@
 package ratelimiter
 
 import (
+       "net/netip"
        "sync"
        "time"
-
-       "golang.zx2c4.com/go118/netip"
 )
 
 const (
index 3e06ff77848843ddf21defd0270d766d0955c1c8..ca7db72b1e8200cdc0266fde3e04768261089d79 100644 (file)
@@ -6,10 +6,9 @@
 package ratelimiter
 
 import (
+       "net/netip"
        "testing"
        "time"
-
-       "golang.zx2c4.com/go118/netip"
 )
 
 type result struct {
index b39b453164a7ff6692884beef6919370e0ac2be8..352c1e46104b287aae87fca2c2d7aafce55a1b5a 100644 (file)
@@ -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"
index 40f780447e85543da3745b487763c5f07937311c..0fdf4cd8f8d899d4b535010e0bfaea7bc345cfd8 100644 (file)
@@ -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"
index cbd54b8eac19d6ad5d2760c4f7b28b929f4ea106..a1bc7f8037553e07ac6111c87600dcb759d5e7c9 100644 (file)
@@ -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"
index 8b1bb7f40190080a25eb95503285164248d80571..c26d8ed5e1100dacfb394fee3f209063e6851175 100644 (file)
@@ -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"
index bdf0467b4f159cff07a140d66ea159f79ab441b6..8196c349dc857c17320ec36f10c43d9ea546a644 100644 (file)
@@ -8,9 +8,9 @@ package tuntest
 import (
        "encoding/binary"
        "io"
+       "net/netip"
        "os"
 
-       "golang.zx2c4.com/go118/netip"
        "golang.zx2c4.com/wireguard/tun"
 )