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 /device/uapi.go | |
parent | ae6bc4dd64e149270a86d649c92728432a50945f (diff) | |
download | wireguard-go-42c9af45e12dbb2de4d3c273bfc7deeda984f827.tar.gz 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/uapi.go')
-rw-r--r-- | device/uapi.go | 10 |
1 files changed, 4 insertions, 6 deletions
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 { |