aboutsummaryrefslogtreecommitdiffstats
path: root/device
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josh@tailscale.com>2022-03-16 16:09:48 -0700
committerJosh Bleecher Snyder <josh@tailscale.com>2022-03-16 16:09:48 -0700
commit42c9af45e12dbb2de4d3c273bfc7deeda984f827 (patch)
tree67d59df66ccd8683f92efb256323257adb240e5b /device
parenttun/netstack: check error returned by SetDeadline() (diff)
downloadwireguard-go-42c9af45e12dbb2de4d3c273bfc7deeda984f827.tar.xz
wireguard-go-42c9af45e12dbb2de4d3c273bfc7deeda984f827.zip
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>
Diffstat (limited to 'device')
-rw-r--r--device/allowedips.go3
-rw-r--r--device/allowedips_rand_test.go3
-rw-r--r--device/allowedips_test.go3
-rw-r--r--device/device_test.go2
-rw-r--r--device/endpoint_test.go3
-rw-r--r--device/uapi.go10
6 files changed, 9 insertions, 15 deletions
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 {