global: regroup all imports

This commit is contained in:
Jason A. Donenfeld 2019-05-14 09:09:52 +02:00
parent 3147f00089
commit 3bf41b06ae
27 changed files with 70 additions and 44 deletions

View file

@ -7,8 +7,9 @@ package device
import ( import (
"encoding/binary" "encoding/binary"
"golang.org/x/sys/windows"
"unsafe" "unsafe"
"golang.org/x/sys/windows"
) )
const ( const (

View file

@ -7,10 +7,11 @@ package device
import ( import (
"errors" "errors"
"golang.org/x/net/ipv4"
"golang.org/x/net/ipv6"
"net" "net"
"strings" "strings"
"golang.org/x/net/ipv4"
"golang.org/x/net/ipv6"
) )
const ( const (

View file

@ -18,13 +18,14 @@ package device
import ( import (
"errors" "errors"
"golang.org/x/sys/unix"
"golang.zx2c4.com/wireguard/rwcancel"
"net" "net"
"strconv" "strconv"
"sync" "sync"
"syscall" "syscall"
"unsafe" "unsafe"
"golang.org/x/sys/unix"
"golang.zx2c4.com/wireguard/rwcancel"
) )
const ( const (

View file

@ -8,10 +8,11 @@ package device
import ( import (
"crypto/hmac" "crypto/hmac"
"crypto/rand" "crypto/rand"
"golang.org/x/crypto/blake2s"
"golang.org/x/crypto/chacha20poly1305"
"sync" "sync"
"time" "time"
"golang.org/x/crypto/blake2s"
"golang.org/x/crypto/chacha20poly1305"
) )
type CookieChecker struct { type CookieChecker struct {

View file

@ -6,12 +6,13 @@
package device package device
import ( import (
"golang.zx2c4.com/wireguard/ratelimiter"
"golang.zx2c4.com/wireguard/tun"
"runtime" "runtime"
"sync" "sync"
"sync/atomic" "sync/atomic"
"time" "time"
"golang.zx2c4.com/wireguard/ratelimiter"
"golang.zx2c4.com/wireguard/tun"
) )
const ( const (

View file

@ -7,8 +7,9 @@ package device
import ( import (
"encoding/hex" "encoding/hex"
"golang.org/x/crypto/blake2s"
"testing" "testing"
"golang.org/x/crypto/blake2s"
) )
type KDFTest struct { type KDFTest struct {

View file

@ -7,9 +7,10 @@ package device
import ( import (
"crypto/cipher" "crypto/cipher"
"golang.zx2c4.com/wireguard/replay"
"sync" "sync"
"time" "time"
"golang.zx2c4.com/wireguard/replay"
) )
/* Due to limitations in Go and /x/crypto there is currently /* Due to limitations in Go and /x/crypto there is currently

View file

@ -8,8 +8,9 @@
package device package device
import ( import (
"golang.org/x/sys/unix"
"runtime" "runtime"
"golang.org/x/sys/unix"
) )
var fwmarkIoctl int var fwmarkIoctl int

View file

@ -9,9 +9,10 @@ import (
"crypto/hmac" "crypto/hmac"
"crypto/rand" "crypto/rand"
"crypto/subtle" "crypto/subtle"
"hash"
"golang.org/x/crypto/blake2s" "golang.org/x/crypto/blake2s"
"golang.org/x/crypto/curve25519" "golang.org/x/crypto/curve25519"
"hash"
) )
/* KDF related functions. /* KDF related functions.

View file

@ -7,12 +7,13 @@ package device
import ( import (
"errors" "errors"
"sync"
"time"
"golang.org/x/crypto/blake2s" "golang.org/x/crypto/blake2s"
"golang.org/x/crypto/chacha20poly1305" "golang.org/x/crypto/chacha20poly1305"
"golang.org/x/crypto/poly1305" "golang.org/x/crypto/poly1305"
"golang.zx2c4.com/wireguard/tai64n" "golang.zx2c4.com/wireguard/tai64n"
"sync"
"time"
) )
const ( const (

View file

@ -9,6 +9,7 @@ import (
"crypto/subtle" "crypto/subtle"
"encoding/hex" "encoding/hex"
"errors" "errors"
"golang.org/x/crypto/chacha20poly1305" "golang.org/x/crypto/chacha20poly1305"
) )

View file

@ -8,14 +8,15 @@ package device
import ( import (
"bytes" "bytes"
"encoding/binary" "encoding/binary"
"golang.org/x/crypto/chacha20poly1305"
"golang.org/x/net/ipv4"
"golang.org/x/net/ipv6"
"net" "net"
"strconv" "strconv"
"sync" "sync"
"sync/atomic" "sync/atomic"
"time" "time"
"golang.org/x/crypto/chacha20poly1305"
"golang.org/x/net/ipv4"
"golang.org/x/net/ipv6"
) )
type QueueHandshakeElement struct { type QueueHandshakeElement struct {

View file

@ -8,13 +8,14 @@ package device
import ( import (
"bytes" "bytes"
"encoding/binary" "encoding/binary"
"golang.org/x/crypto/chacha20poly1305"
"golang.org/x/net/ipv4"
"golang.org/x/net/ipv6"
"net" "net"
"sync" "sync"
"sync/atomic" "sync/atomic"
"time" "time"
"golang.org/x/crypto/chacha20poly1305"
"golang.org/x/net/ipv4"
"golang.org/x/net/ipv6"
) )
/* Outbound flow /* Outbound flow

View file

@ -6,8 +6,9 @@
package device package device
import ( import (
"golang.zx2c4.com/wireguard/tun"
"sync/atomic" "sync/atomic"
"golang.zx2c4.com/wireguard/tun"
) )
const DefaultMTU = 1420 const DefaultMTU = 1420

View file

@ -8,13 +8,14 @@ package device
import ( import (
"bufio" "bufio"
"fmt" "fmt"
"golang.zx2c4.com/wireguard/ipc"
"io" "io"
"net" "net"
"strconv" "strconv"
"strings" "strings"
"sync/atomic" "sync/atomic"
"time" "time"
"golang.zx2c4.com/wireguard/ipc"
) )
type IPCError struct { type IPCError struct {

View file

@ -10,11 +10,12 @@ package ipc
import ( import (
"errors" "errors"
"fmt" "fmt"
"golang.org/x/sys/unix"
"net" "net"
"os" "os"
"path" "path"
"unsafe" "unsafe"
"golang.org/x/sys/unix"
) )
var socketDirectory = "/var/run/wireguard" var socketDirectory = "/var/run/wireguard"

View file

@ -8,11 +8,12 @@ package ipc
import ( import (
"errors" "errors"
"fmt" "fmt"
"golang.org/x/sys/unix"
"golang.zx2c4.com/wireguard/rwcancel"
"net" "net"
"os" "os"
"path" "path"
"golang.org/x/sys/unix"
"golang.zx2c4.com/wireguard/rwcancel"
) )
var socketDirectory = "/var/run/wireguard" var socketDirectory = "/var/run/wireguard"

View file

@ -6,8 +6,9 @@
package ipc package ipc
import ( import (
"github.com/Microsoft/go-winio"
"net" "net"
"github.com/Microsoft/go-winio"
) )
//TODO: replace these with actual standard windows error numbers from the win package //TODO: replace these with actual standard windows error numbers from the win package

View file

@ -9,14 +9,15 @@ package main
import ( import (
"fmt" "fmt"
"golang.zx2c4.com/wireguard/device"
"golang.zx2c4.com/wireguard/ipc"
"golang.zx2c4.com/wireguard/tun"
"os" "os"
"os/signal" "os/signal"
"runtime" "runtime"
"strconv" "strconv"
"syscall" "syscall"
"golang.zx2c4.com/wireguard/device"
"golang.zx2c4.com/wireguard/ipc"
"golang.zx2c4.com/wireguard/tun"
) )
const ( const (

View file

@ -7,12 +7,13 @@ package main
import ( import (
"fmt" "fmt"
"golang.zx2c4.com/wireguard/device"
"golang.zx2c4.com/wireguard/ipc"
"os" "os"
"os/signal" "os/signal"
"syscall" "syscall"
"golang.zx2c4.com/wireguard/device"
"golang.zx2c4.com/wireguard/ipc"
"golang.zx2c4.com/wireguard/tun" "golang.zx2c4.com/wireguard/tun"
) )

View file

@ -7,9 +7,10 @@ package rwcancel
import ( import (
"errors" "errors"
"golang.org/x/sys/unix"
"os" "os"
"syscall" "syscall"
"golang.org/x/sys/unix"
) )
func max(a, b int) int { func max(a, b int) int {

View file

@ -8,9 +8,10 @@ package tun
import ( import (
"bytes" "bytes"
"errors" "errors"
"golang.zx2c4.com/wireguard/tun"
"os" "os"
"testing" "testing"
"golang.zx2c4.com/wireguard/tun"
) )
/* Helpers for writing unit tests /* Helpers for writing unit tests

View file

@ -7,13 +7,14 @@ package tun
import ( import (
"fmt" "fmt"
"golang.org/x/net/ipv6"
"golang.org/x/sys/unix"
"io/ioutil" "io/ioutil"
"net" "net"
"os" "os"
"syscall" "syscall"
"unsafe" "unsafe"
"golang.org/x/net/ipv6"
"golang.org/x/sys/unix"
) )
const utunControlName = "com.apple.net.utun_control" const utunControlName = "com.apple.net.utun_control"

View file

@ -9,12 +9,13 @@ import (
"bytes" "bytes"
"errors" "errors"
"fmt" "fmt"
"golang.org/x/net/ipv6"
"golang.org/x/sys/unix"
"net" "net"
"os" "os"
"syscall" "syscall"
"unsafe" "unsafe"
"golang.org/x/net/ipv6"
"golang.org/x/sys/unix"
) )
// _TUNSIFHEAD, value derived from sys/net/{if_tun,ioccom}.h // _TUNSIFHEAD, value derived from sys/net/{if_tun,ioccom}.h

View file

@ -12,15 +12,16 @@ import (
"bytes" "bytes"
"errors" "errors"
"fmt" "fmt"
"golang.org/x/net/ipv6"
"golang.org/x/sys/unix"
"golang.zx2c4.com/wireguard/rwcancel"
"net" "net"
"os" "os"
"sync" "sync"
"syscall" "syscall"
"time" "time"
"unsafe" "unsafe"
"golang.org/x/net/ipv6"
"golang.org/x/sys/unix"
"golang.zx2c4.com/wireguard/rwcancel"
) )
const ( const (

View file

@ -7,13 +7,14 @@ package tun
import ( import (
"fmt" "fmt"
"golang.org/x/net/ipv6"
"golang.org/x/sys/unix"
"io/ioutil" "io/ioutil"
"net" "net"
"os" "os"
"syscall" "syscall"
"unsafe" "unsafe"
"golang.org/x/net/ipv6"
"golang.org/x/sys/unix"
) )
// Structure for iface mtu get/set ioctls // Structure for iface mtu get/set ioctls