diff --git a/conn/bind_std.go b/conn/bind_std.go index fc05634..249f53d 100644 --- a/conn/bind_std.go +++ b/conn/bind_std.go @@ -213,10 +213,8 @@ func (s *StdNetBind) getMessages() *[]ipv6.Message { return s.msgsPool.Get().(*[]ipv6.Message) } -var ( - // If compilation fails here these are no longer the same underlying type. - _ ipv6.Message = ipv4.Message{} -) +// If compilation fails here these are no longer the same underlying type. +var _ ipv6.Message = ipv4.Message{} type batchReader interface { ReadBatch([]ipv6.Message, int) (int, error) diff --git a/conn/bind_windows.go b/conn/bind_windows.go index d32ecd6..81a820b 100644 --- a/conn/bind_windows.go +++ b/conn/bind_windows.go @@ -15,9 +15,8 @@ import ( "sync/atomic" "unsafe" - "golang.org/x/sys/windows" - "github.com/sagernet/wireguard-go/conn/winrio" + "golang.org/x/sys/windows" ) const ( diff --git a/device/noise-protocol.go b/device/noise-protocol.go index 50dcb60..6e67d04 100644 --- a/device/noise-protocol.go +++ b/device/noise-protocol.go @@ -12,12 +12,11 @@ import ( "sync" "time" + "github.com/sagernet/wireguard-go/conn" + "github.com/sagernet/wireguard-go/tai64n" "golang.org/x/crypto/blake2s" "golang.org/x/crypto/chacha20poly1305" "golang.org/x/crypto/poly1305" - - "github.com/sagernet/wireguard-go/conn" - "github.com/sagernet/wireguard-go/tai64n" ) type handshakeState int diff --git a/device/receive.go b/device/receive.go index 01baad8..6ab2680 100644 --- a/device/receive.go +++ b/device/receive.go @@ -411,7 +411,6 @@ func (device *Device) RoutineHandshake(id int) { // derive keypair err = peer.BeginSymmetricSession() - if err != nil { device.log.Errorf("%v - Failed to derive keypair: %v", peer, err) goto skip diff --git a/device/sticky_linux.go b/device/sticky_linux.go index 79ece63..b5b0e51 100644 --- a/device/sticky_linux.go +++ b/device/sticky_linux.go @@ -18,10 +18,9 @@ import ( "sync" "unsafe" - "golang.org/x/sys/unix" - "github.com/sagernet/wireguard-go/conn" "github.com/sagernet/wireguard-go/rwcancel" + "golang.org/x/sys/unix" ) func (device *Device) startRouteListener(bind conn.Bind) (*rwcancel.RWCancel, error) { diff --git a/ipc/uapi_linux.go b/ipc/uapi_linux.go index 6a662d3..c14d5d0 100644 --- a/ipc/uapi_linux.go +++ b/ipc/uapi_linux.go @@ -84,7 +84,6 @@ func UAPIListen(name string, file *os.File) (net.Listener, error) { unix.IN_DELETE| unix.IN_DELETE_SELF, ) - if err != nil { return nil, err } diff --git a/tun/errors.go b/tun/errors.go index 75ae3a4..2c49fc7 100644 --- a/tun/errors.go +++ b/tun/errors.go @@ -4,9 +4,7 @@ import ( "errors" ) -var ( - // ErrTooManySegments is returned by Device.Read() when segmentation - // overflows the length of supplied buffers. This error should not cause - // reads to cease. - ErrTooManySegments = errors.New("too many segments") -) +// ErrTooManySegments is returned by Device.Read() when segmentation +// overflows the length of supplied buffers. This error should not cause +// reads to cease. +var ErrTooManySegments = errors.New("too many segments") diff --git a/tun/tun_linux.go b/tun/tun_linux.go index 4e27c1b..8f4aed1 100644 --- a/tun/tun_linux.go +++ b/tun/tun_linux.go @@ -506,9 +506,7 @@ func (tun *NativeTun) initFromFlags(name string) error { return err } if e := sc.Control(func(fd uintptr) { - var ( - ifr *unix.Ifreq - ) + var ifr *unix.Ifreq ifr, err = unix.NewIfreq(name) if err != nil { return