From 3bf41b06ae6ec9a558d3b1f1f315509ccef97010 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 14 May 2019 09:09:52 +0200 Subject: global: regroup all imports --- device/boundif_windows.go | 3 ++- device/conn.go | 5 +++-- device/conn_linux.go | 5 +++-- device/cookie.go | 5 +++-- device/device.go | 5 +++-- device/kdf_test.go | 3 ++- device/keypair.go | 3 ++- device/mark_unix.go | 3 ++- device/noise-helpers.go | 3 ++- device/noise-protocol.go | 5 +++-- device/noise-types.go | 1 + device/receive.go | 7 ++++--- device/send.go | 7 ++++--- device/tun.go | 3 ++- device/uapi.go | 3 ++- ipc/uapi_bsd.go | 3 ++- ipc/uapi_linux.go | 5 +++-- ipc/uapi_windows.go | 3 ++- main.go | 7 ++++--- main_windows.go | 5 +++-- rwcancel/rwcancel.go | 3 ++- tun/helper_test.go | 3 ++- tun/tun_darwin.go | 5 +++-- tun/tun_freebsd.go | 5 +++-- tun/tun_linux.go | 7 ++++--- tun/tun_openbsd.go | 5 +++-- tun/wintun/netshell/netshell_windows.go | 2 +- 27 files changed, 70 insertions(+), 44 deletions(-) diff --git a/device/boundif_windows.go b/device/boundif_windows.go index 97381ad..b842ba8 100644 --- a/device/boundif_windows.go +++ b/device/boundif_windows.go @@ -7,8 +7,9 @@ package device import ( "encoding/binary" - "golang.org/x/sys/windows" "unsafe" + + "golang.org/x/sys/windows" ) const ( diff --git a/device/conn.go b/device/conn.go index d57aa8c..7b341f6 100644 --- a/device/conn.go +++ b/device/conn.go @@ -7,10 +7,11 @@ package device import ( "errors" - "golang.org/x/net/ipv4" - "golang.org/x/net/ipv6" "net" "strings" + + "golang.org/x/net/ipv4" + "golang.org/x/net/ipv6" ) const ( diff --git a/device/conn_linux.go b/device/conn_linux.go index 06b15f9..ebbbe11 100644 --- a/device/conn_linux.go +++ b/device/conn_linux.go @@ -18,13 +18,14 @@ package device import ( "errors" - "golang.org/x/sys/unix" - "golang.zx2c4.com/wireguard/rwcancel" "net" "strconv" "sync" "syscall" "unsafe" + + "golang.org/x/sys/unix" + "golang.zx2c4.com/wireguard/rwcancel" ) const ( diff --git a/device/cookie.go b/device/cookie.go index 2f21067..3a88a0c 100644 --- a/device/cookie.go +++ b/device/cookie.go @@ -8,10 +8,11 @@ package device import ( "crypto/hmac" "crypto/rand" - "golang.org/x/crypto/blake2s" - "golang.org/x/crypto/chacha20poly1305" "sync" "time" + + "golang.org/x/crypto/blake2s" + "golang.org/x/crypto/chacha20poly1305" ) type CookieChecker struct { diff --git a/device/device.go b/device/device.go index d6c96d6..ef269f5 100644 --- a/device/device.go +++ b/device/device.go @@ -6,12 +6,13 @@ package device import ( - "golang.zx2c4.com/wireguard/ratelimiter" - "golang.zx2c4.com/wireguard/tun" "runtime" "sync" "sync/atomic" "time" + + "golang.zx2c4.com/wireguard/ratelimiter" + "golang.zx2c4.com/wireguard/tun" ) const ( diff --git a/device/kdf_test.go b/device/kdf_test.go index 11ea8d5..cb8dbab 100644 --- a/device/kdf_test.go +++ b/device/kdf_test.go @@ -7,8 +7,9 @@ package device import ( "encoding/hex" - "golang.org/x/crypto/blake2s" "testing" + + "golang.org/x/crypto/blake2s" ) type KDFTest struct { diff --git a/device/keypair.go b/device/keypair.go index a9fbfce..9c78fa9 100644 --- a/device/keypair.go +++ b/device/keypair.go @@ -7,9 +7,10 @@ package device import ( "crypto/cipher" - "golang.zx2c4.com/wireguard/replay" "sync" "time" + + "golang.zx2c4.com/wireguard/replay" ) /* Due to limitations in Go and /x/crypto there is currently diff --git a/device/mark_unix.go b/device/mark_unix.go index a791c71..669b328 100644 --- a/device/mark_unix.go +++ b/device/mark_unix.go @@ -8,8 +8,9 @@ package device import ( - "golang.org/x/sys/unix" "runtime" + + "golang.org/x/sys/unix" ) var fwmarkIoctl int diff --git a/device/noise-helpers.go b/device/noise-helpers.go index 4b09bf3..03e6ec6 100644 --- a/device/noise-helpers.go +++ b/device/noise-helpers.go @@ -9,9 +9,10 @@ import ( "crypto/hmac" "crypto/rand" "crypto/subtle" + "hash" + "golang.org/x/crypto/blake2s" "golang.org/x/crypto/curve25519" - "hash" ) /* KDF related functions. diff --git a/device/noise-protocol.go b/device/noise-protocol.go index 73826e1..1f70e81 100644 --- a/device/noise-protocol.go +++ b/device/noise-protocol.go @@ -7,12 +7,13 @@ package device import ( "errors" + "sync" + "time" + "golang.org/x/crypto/blake2s" "golang.org/x/crypto/chacha20poly1305" "golang.org/x/crypto/poly1305" "golang.zx2c4.com/wireguard/tai64n" - "sync" - "time" ) const ( diff --git a/device/noise-types.go b/device/noise-types.go index 82b12c1..6b1f16f 100644 --- a/device/noise-types.go +++ b/device/noise-types.go @@ -9,6 +9,7 @@ import ( "crypto/subtle" "encoding/hex" "errors" + "golang.org/x/crypto/chacha20poly1305" ) diff --git a/device/receive.go b/device/receive.go index 747a188..22870f2 100644 --- a/device/receive.go +++ b/device/receive.go @@ -8,14 +8,15 @@ package device import ( "bytes" "encoding/binary" - "golang.org/x/crypto/chacha20poly1305" - "golang.org/x/net/ipv4" - "golang.org/x/net/ipv6" "net" "strconv" "sync" "sync/atomic" "time" + + "golang.org/x/crypto/chacha20poly1305" + "golang.org/x/net/ipv4" + "golang.org/x/net/ipv6" ) type QueueHandshakeElement struct { diff --git a/device/send.go b/device/send.go index ccb28da..ae96aa2 100644 --- a/device/send.go +++ b/device/send.go @@ -8,13 +8,14 @@ package device import ( "bytes" "encoding/binary" - "golang.org/x/crypto/chacha20poly1305" - "golang.org/x/net/ipv4" - "golang.org/x/net/ipv6" "net" "sync" "sync/atomic" "time" + + "golang.org/x/crypto/chacha20poly1305" + "golang.org/x/net/ipv4" + "golang.org/x/net/ipv6" ) /* Outbound flow diff --git a/device/tun.go b/device/tun.go index bc5f1f1..fe1158c 100644 --- a/device/tun.go +++ b/device/tun.go @@ -6,8 +6,9 @@ package device import ( - "golang.zx2c4.com/wireguard/tun" "sync/atomic" + + "golang.zx2c4.com/wireguard/tun" ) const DefaultMTU = 1420 diff --git a/device/uapi.go b/device/uapi.go index fb62048..99cb421 100644 --- a/device/uapi.go +++ b/device/uapi.go @@ -8,13 +8,14 @@ package device import ( "bufio" "fmt" - "golang.zx2c4.com/wireguard/ipc" "io" "net" "strconv" "strings" "sync/atomic" "time" + + "golang.zx2c4.com/wireguard/ipc" ) type IPCError struct { diff --git a/ipc/uapi_bsd.go b/ipc/uapi_bsd.go index f66c386..75cc0e3 100644 --- a/ipc/uapi_bsd.go +++ b/ipc/uapi_bsd.go @@ -10,11 +10,12 @@ package ipc import ( "errors" "fmt" - "golang.org/x/sys/unix" "net" "os" "path" "unsafe" + + "golang.org/x/sys/unix" ) var socketDirectory = "/var/run/wireguard" diff --git a/ipc/uapi_linux.go b/ipc/uapi_linux.go index 8af3d8c..a3c95ca 100644 --- a/ipc/uapi_linux.go +++ b/ipc/uapi_linux.go @@ -8,11 +8,12 @@ package ipc import ( "errors" "fmt" - "golang.org/x/sys/unix" - "golang.zx2c4.com/wireguard/rwcancel" "net" "os" "path" + + "golang.org/x/sys/unix" + "golang.zx2c4.com/wireguard/rwcancel" ) var socketDirectory = "/var/run/wireguard" diff --git a/ipc/uapi_windows.go b/ipc/uapi_windows.go index 8f0268d..b3aeb26 100644 --- a/ipc/uapi_windows.go +++ b/ipc/uapi_windows.go @@ -6,8 +6,9 @@ package ipc import ( - "github.com/Microsoft/go-winio" "net" + + "github.com/Microsoft/go-winio" ) //TODO: replace these with actual standard windows error numbers from the win package diff --git a/main.go b/main.go index d13a113..77a660f 100644 --- a/main.go +++ b/main.go @@ -9,14 +9,15 @@ package main import ( "fmt" - "golang.zx2c4.com/wireguard/device" - "golang.zx2c4.com/wireguard/ipc" - "golang.zx2c4.com/wireguard/tun" "os" "os/signal" "runtime" "strconv" "syscall" + + "golang.zx2c4.com/wireguard/device" + "golang.zx2c4.com/wireguard/ipc" + "golang.zx2c4.com/wireguard/tun" ) const ( diff --git a/main_windows.go b/main_windows.go index 4954adc..5380f56 100644 --- a/main_windows.go +++ b/main_windows.go @@ -7,12 +7,13 @@ package main import ( "fmt" - "golang.zx2c4.com/wireguard/device" - "golang.zx2c4.com/wireguard/ipc" "os" "os/signal" "syscall" + "golang.zx2c4.com/wireguard/device" + "golang.zx2c4.com/wireguard/ipc" + "golang.zx2c4.com/wireguard/tun" ) diff --git a/rwcancel/rwcancel.go b/rwcancel/rwcancel.go index 3984310..62397c2 100644 --- a/rwcancel/rwcancel.go +++ b/rwcancel/rwcancel.go @@ -7,9 +7,10 @@ package rwcancel import ( "errors" - "golang.org/x/sys/unix" "os" "syscall" + + "golang.org/x/sys/unix" ) func max(a, b int) int { diff --git a/tun/helper_test.go b/tun/helper_test.go index 3e86fc8..4fa0357 100644 --- a/tun/helper_test.go +++ b/tun/helper_test.go @@ -8,9 +8,10 @@ package tun import ( "bytes" "errors" - "golang.zx2c4.com/wireguard/tun" "os" "testing" + + "golang.zx2c4.com/wireguard/tun" ) /* Helpers for writing unit tests diff --git a/tun/tun_darwin.go b/tun/tun_darwin.go index 2afe9de..f7cf8e8 100644 --- a/tun/tun_darwin.go +++ b/tun/tun_darwin.go @@ -7,13 +7,14 @@ package tun import ( "fmt" - "golang.org/x/net/ipv6" - "golang.org/x/sys/unix" "io/ioutil" "net" "os" "syscall" "unsafe" + + "golang.org/x/net/ipv6" + "golang.org/x/sys/unix" ) const utunControlName = "com.apple.net.utun_control" diff --git a/tun/tun_freebsd.go b/tun/tun_freebsd.go index c9c89ef..b7c82cf 100644 --- a/tun/tun_freebsd.go +++ b/tun/tun_freebsd.go @@ -9,12 +9,13 @@ import ( "bytes" "errors" "fmt" - "golang.org/x/net/ipv6" - "golang.org/x/sys/unix" "net" "os" "syscall" "unsafe" + + "golang.org/x/net/ipv6" + "golang.org/x/sys/unix" ) // _TUNSIFHEAD, value derived from sys/net/{if_tun,ioccom}.h diff --git a/tun/tun_linux.go b/tun/tun_linux.go index 784cb9f..f5f7ec7 100644 --- a/tun/tun_linux.go +++ b/tun/tun_linux.go @@ -12,15 +12,16 @@ import ( "bytes" "errors" "fmt" - "golang.org/x/net/ipv6" - "golang.org/x/sys/unix" - "golang.zx2c4.com/wireguard/rwcancel" "net" "os" "sync" "syscall" "time" "unsafe" + + "golang.org/x/net/ipv6" + "golang.org/x/sys/unix" + "golang.zx2c4.com/wireguard/rwcancel" ) const ( diff --git a/tun/tun_openbsd.go b/tun/tun_openbsd.go index 645bcca..a3db83b 100644 --- a/tun/tun_openbsd.go +++ b/tun/tun_openbsd.go @@ -7,13 +7,14 @@ package tun import ( "fmt" - "golang.org/x/net/ipv6" - "golang.org/x/sys/unix" "io/ioutil" "net" "os" "syscall" "unsafe" + + "golang.org/x/net/ipv6" + "golang.org/x/sys/unix" ) // Structure for iface mtu get/set ioctls diff --git a/tun/wintun/netshell/netshell_windows.go b/tun/wintun/netshell/netshell_windows.go index cb03252..3122d87 100644 --- a/tun/wintun/netshell/netshell_windows.go +++ b/tun/wintun/netshell/netshell_windows.go @@ -13,7 +13,7 @@ import ( ) var ( - modnetshell = windows.NewLazySystemDLL("netshell.dll") + modnetshell = windows.NewLazySystemDLL("netshell.dll") procHrRenameConnection = modnetshell.NewProc("HrRenameConnection") ) -- cgit v1.2.3-59-g8ed1b