Skip to content

Commit

Permalink
refactor: update import paths to use the new repository structure
Browse files Browse the repository at this point in the history
  • Loading branch information
XPH0816 committed Dec 22, 2024
1 parent d56e503 commit cd18644
Show file tree
Hide file tree
Showing 35 changed files with 73 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
build:
strategy:
matrix:
go-version: ["1.20"]
go-version: ["1.22.1"]
runs-on: ubuntu-latest

steps:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# wgctrl [![Test Status](https://github.com/WireKCP/wkctrl/workflows/Linux%20Test/badge.svg)](https://github.com/WireKCP/wkctrl/actions) [![Go Reference](https://pkg.go.dev/badge/golang.zx2c4.com/wirekcp/wkctrl.svg)](https://pkg.go.dev/golang.zx2c4.com/wirekcp/wkctrl) [![Go Report Card](https://goreportcard.com/badge/github.com/wirekcp/wkctrl)](https://goreportcard.com/report/github.com/wirekcp/wkctrl)
# wgctrl [![Test Status](https://github.com/WireKCP/wgctrl/workflows/Linux%20Test/badge.svg)](https://github.com/WireKCP/wgctrl/actions) [![Go Reference](https://pkg.go.dev/badge/github.com/wirekcp/wgctrl.svg)](https://pkg.go.dev/github.com/wirekcp/wgctrl) [![Go Report Card](https://goreportcard.com/badge/github.com/wirekcp/wgctrl)](https://goreportcard.com/report/github.com/wirekcp/wgctrl)


Package `wgctrl` enables control of WireGuard devices on multiple platforms.
Expand All @@ -22,7 +22,7 @@ As new operating systems add support for in-kernel WireGuard implementations,
this package should also be extended to support those native implementations.

If you are aware of any efforts on this front, please
[file an issue](https://github.com/WireKCP/wkctrl/issues/new).
[file an issue](https://github.com/WireKCP/wgctrl/issues/new).

This package implements WireGuard configuration protocol operations, enabling
the configuration of existing WireGuard devices. Operations such as creating
Expand Down
4 changes: 2 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"errors"
"os"

"golang.zx2c4.com/wireguard/wgctrl/internal/wginternal"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"github.com/wirekcp/wgctrl/internal/wginternal"
"github.com/wirekcp/wgctrl/wgtypes"
)

// Expose an identical interface to the underlying packages.
Expand Down
8 changes: 4 additions & 4 deletions client_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (

"github.com/google/go-cmp/cmp"
"github.com/mikioh/ipaddr"
"golang.zx2c4.com/wireguard/wgctrl"
"golang.zx2c4.com/wireguard/wgctrl/internal/wginternal"
"golang.zx2c4.com/wireguard/wgctrl/internal/wgtest"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"github.com/wirekcp/wgctrl"
"github.com/wirekcp/wgctrl/internal/wginternal"
"github.com/wirekcp/wgctrl/internal/wgtest"
"github.com/wirekcp/wgctrl/wgtypes"
)

func TestIntegrationClient(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"testing"

"github.com/google/go-cmp/cmp"
"golang.zx2c4.com/wireguard/wgctrl/internal/wginternal"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"github.com/wirekcp/wgctrl/internal/wginternal"
"github.com/wirekcp/wgctrl/wgtypes"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions cmd/wgctrl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"net"
"strings"

"golang.zx2c4.com/wireguard/wgctrl"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"github.com/wirekcp/wgctrl"
"github.com/wirekcp/wgctrl/wgtypes"
)

func main() {
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module golang.zx2c4.com/wireguard/wgctrl
module github.com/wirekcp/wgctrl

go 1.20

Expand All @@ -7,14 +7,14 @@ require (
github.com/mdlayher/genetlink v1.3.2
github.com/mdlayher/netlink v1.7.2
github.com/mikioh/ipaddr v0.0.0-20190404000644-d465c8ab6721
github.com/wirekcp/wireguard-go v0.0.0-20241202123601-b3b57a5c124e
golang.org/x/crypto v0.17.0
golang.org/x/sys v0.15.0
golang.zx2c4.com/wireguard v0.0.0-20230325221338-052af4a8072b
)

require (
github.com/josharian/native v1.1.0 // indirect
github.com/mdlayher/socket v0.4.1 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/net v0.15.0 // indirect
golang.org/x/sync v0.1.0 // indirect
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ github.com/mdlayher/socket v0.4.1 h1:eM9y2/jlbs1M615oshPQOHZzj6R6wMT7bX5NPiQvn2U
github.com/mdlayher/socket v0.4.1/go.mod h1:cAqeGjoufqdxWkD7DkpyS+wcefOtmu5OQ8KuoJGIReA=
github.com/mikioh/ipaddr v0.0.0-20190404000644-d465c8ab6721 h1:RlZweED6sbSArvlE924+mUcZuXKLBHA35U7LN621Bws=
github.com/mikioh/ipaddr v0.0.0-20190404000644-d465c8ab6721/go.mod h1:Ickgr2WtCLZ2MDGd4Gr0geeCH5HybhRJbonOgQpvSxc=
github.com/wirekcp/wireguard-go v0.0.0-20241202123601-b3b57a5c124e h1:DWb3aFTURQ+Q+7UjOzTvptGLNPSMxnp2I7rp+X84vmE=
github.com/wirekcp/wireguard-go v0.0.0-20241202123601-b3b57a5c124e/go.mod h1:u5zvGnNV8J2szGr4PVS+L9Tvf/4p7+DCC4yL1HRzd5I=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.zx2c4.com/wireguard v0.0.0-20230325221338-052af4a8072b h1:J1CaxgLerRR5lgx3wnr6L04cJFbWoceSK9JWBdglINo=
golang.zx2c4.com/wireguard v0.0.0-20230325221338-052af4a8072b/go.mod h1:tqur9LnfstdR9ep2LaJT4lFUl0EjlHtge+gAjmsHUG4=
8 changes: 4 additions & 4 deletions internal/wgfreebsd/client_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import (
"time"
"unsafe"

"github.com/wirekcp/wgctrl/internal/wgfreebsd/internal/nv"
"github.com/wirekcp/wgctrl/internal/wgfreebsd/internal/wgh"
"github.com/wirekcp/wgctrl/internal/wginternal"
"github.com/wirekcp/wgctrl/wgtypes"
"golang.org/x/sys/unix"
"golang.zx2c4.com/wireguard/wgctrl/internal/wgfreebsd/internal/nv"
"golang.zx2c4.com/wireguard/wgctrl/internal/wgfreebsd/internal/wgh"
"golang.zx2c4.com/wireguard/wgctrl/internal/wginternal"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
)

// ifGroupWG is the WireGuard interface group name passed to the kernel.
Expand Down
2 changes: 1 addition & 1 deletion internal/wgfreebsd/internal/nv/nvlist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"
"unsafe"

"golang.zx2c4.com/wireguard/wgctrl/internal/wgfreebsd/internal/nv"
"github.com/wirekcp/wgctrl/internal/wgfreebsd/internal/nv"
)

func TestMarshaling(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/wginternal/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"errors"
"io"

"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"github.com/wirekcp/wgctrl/wgtypes"
)

// ErrReadOnly indicates that the driver backing a device is read-only. It is
Expand Down
4 changes: 2 additions & 2 deletions internal/wglinux/client_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"github.com/mdlayher/genetlink"
"github.com/mdlayher/netlink"
"github.com/mdlayher/netlink/nlenc"
"github.com/wirekcp/wgctrl/internal/wginternal"
"github.com/wirekcp/wgctrl/wgtypes"
"golang.org/x/sys/unix"
"golang.zx2c4.com/wireguard/wgctrl/internal/wginternal"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
)

var _ wginternal.Client = &Client{}
Expand Down
2 changes: 1 addition & 1 deletion internal/wglinux/client_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"github.com/mdlayher/netlink"
"github.com/mdlayher/netlink/nlenc"
"github.com/mdlayher/netlink/nltest"
"github.com/wirekcp/wgctrl/wgtypes"
"golang.org/x/sys/unix"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion internal/wglinux/configure_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (

"github.com/mdlayher/netlink"
"github.com/mdlayher/netlink/nlenc"
"github.com/wirekcp/wgctrl/wgtypes"
"golang.org/x/sys/unix"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
)

// configAttrs creates the required encoded netlink attributes to configure
Expand Down
4 changes: 2 additions & 2 deletions internal/wglinux/configure_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
"github.com/mdlayher/netlink"
"github.com/mdlayher/netlink/nlenc"
"github.com/mikioh/ipaddr"
"github.com/wirekcp/wgctrl/internal/wgtest"
"github.com/wirekcp/wgctrl/wgtypes"
"golang.org/x/sys/unix"
"golang.zx2c4.com/wireguard/wgctrl/internal/wgtest"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
)

func TestLinuxClientConfigureDevice(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/wglinux/parse_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (

"github.com/mdlayher/genetlink"
"github.com/mdlayher/netlink"
"github.com/wirekcp/wgctrl/wgtypes"
"golang.org/x/sys/unix"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
)

// parseDevice parses a Device from a slice of generic netlink messages,
Expand Down
4 changes: 2 additions & 2 deletions internal/wglinux/parse_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import (
"github.com/mdlayher/genetlink/genltest"
"github.com/mdlayher/netlink"
"github.com/mdlayher/netlink/nlenc"
"github.com/wirekcp/wgctrl/internal/wgtest"
"github.com/wirekcp/wgctrl/wgtypes"
"golang.org/x/sys/unix"
"golang.zx2c4.com/wireguard/wgctrl/internal/wgtest"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
)

func TestLinuxClientDevicesError(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions internal/wgopenbsd/client_openbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (
"time"
"unsafe"

"github.com/wirekcp/wgctrl/internal/wginternal"
"github.com/wirekcp/wgctrl/internal/wgopenbsd/internal/wgh"
"github.com/wirekcp/wgctrl/wgtypes"
"golang.org/x/sys/unix"
"golang.zx2c4.com/wireguard/wgctrl/internal/wginternal"
"golang.zx2c4.com/wireguard/wgctrl/internal/wgopenbsd/internal/wgh"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
)

// ifGroupWG is the WireGuard interface group name passed to the kernel.
Expand Down
6 changes: 3 additions & 3 deletions internal/wgopenbsd/client_openbsd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import (
"unsafe"

"github.com/google/go-cmp/cmp"
"github.com/wirekcp/wgctrl/internal/wgopenbsd/internal/wgh"
"github.com/wirekcp/wgctrl/internal/wgtest"
"github.com/wirekcp/wgctrl/wgtypes"
"golang.org/x/sys/unix"
"golang.zx2c4.com/wireguard/wgctrl/internal/wgopenbsd/internal/wgh"
"golang.zx2c4.com/wireguard/wgctrl/internal/wgtest"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
)

func TestClientDevices(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/wgtest/wgtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"net"

"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"github.com/wirekcp/wgctrl/wgtypes"
)

// MustCIDR converts CIDR string s into a net.IPNet or panics.
Expand Down
4 changes: 2 additions & 2 deletions internal/wguser/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"path/filepath"
"strings"

"golang.zx2c4.com/wireguard/wgctrl/internal/wginternal"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"github.com/wirekcp/wgctrl/internal/wginternal"
"github.com/wirekcp/wgctrl/wgtypes"
)

var _ wginternal.Client = &Client{}
Expand Down
2 changes: 1 addition & 1 deletion internal/wguser/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"time"

"github.com/google/go-cmp/cmp"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"github.com/wirekcp/wgctrl/wgtypes"
)

// A known device name used throughout unit and integration tests.
Expand Down
2 changes: 1 addition & 1 deletion internal/wguser/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"os"
"strings"

"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"github.com/wirekcp/wgctrl/wgtypes"
)

// configureDevice configures a device specified by its path.
Expand Down
4 changes: 2 additions & 2 deletions internal/wguser/configure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"testing"
"time"

"golang.zx2c4.com/wireguard/wgctrl/internal/wgtest"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"github.com/wirekcp/wgctrl/internal/wgtest"
"github.com/wirekcp/wgctrl/wgtypes"
)

// Example string source (with some slight modifications to use all fields):
Expand Down
7 changes: 4 additions & 3 deletions internal/wguser/conn_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@ import (
"strings"
"time"

"github.com/wirekcp/wireguard-go/ipc/namedpipe"
"golang.org/x/sys/windows"
"golang.zx2c4.com/wireguard/ipc/namedpipe"
)

// Expected prefixes when dealing with named pipes.
const (
pipePrefix = `\\.\pipe\`
wgPrefix = `ProtectedPrefix\Administrators\WireGuard\`
wgPrefix = `ProtectedPrefix\Administrators\WireKCP\`
)

// dial is the default implementation of Client.dial.
func dial(device string) (net.Conn, error) {
localSystem, err := windows.CreateWellKnownSid(windows.WinLocalSystemSid)
// localSystem, err := windows.CreateWellKnownSid(windows.WinLocalSystemSid)
localSystem, err := windows.CreateWellKnownSid(windows.WinBuiltinAdministratorsSid)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/wguser/conn_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"testing"
"time"

"github.com/wirekcp/wireguard-go/ipc/namedpipe"
"golang.org/x/sys/windows/registry"
"golang.zx2c4.com/wireguard/ipc/namedpipe"
)

// isWINE determines if this test is running in WINE.
Expand Down
2 changes: 1 addition & 1 deletion internal/wguser/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"strconv"
"time"

"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"github.com/wirekcp/wgctrl/wgtypes"
)

// The WireGuard userspace configuration protocol is described here:
Expand Down
2 changes: 1 addition & 1 deletion internal/wguser/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"

"github.com/google/go-cmp/cmp"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"github.com/wirekcp/wgctrl/wgtypes"
)

// Example string source (with some slight modifications to use all fields):
Expand Down
6 changes: 3 additions & 3 deletions internal/wgwindows/client_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (

"golang.org/x/sys/windows"

"golang.zx2c4.com/wireguard/wgctrl/internal/wginternal"
"golang.zx2c4.com/wireguard/wgctrl/internal/wgwindows/internal/ioctl"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"github.com/wirekcp/wgctrl/internal/wginternal"
"github.com/wirekcp/wgctrl/internal/wgwindows/internal/ioctl"
"github.com/wirekcp/wgctrl/wgtypes"
)

var _ wginternal.Client = &Client{}
Expand Down
6 changes: 3 additions & 3 deletions os_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
package wgctrl

import (
"golang.zx2c4.com/wireguard/wgctrl/internal/wgfreebsd"
"golang.zx2c4.com/wireguard/wgctrl/internal/wginternal"
"golang.zx2c4.com/wireguard/wgctrl/internal/wguser"
"github.com/wirekcp/wgctrl/internal/wgfreebsd"
"github.com/wirekcp/wgctrl/internal/wginternal"
"github.com/wirekcp/wgctrl/internal/wguser"
)

// newClients configures wginternal.Clients for FreeBSD systems.
Expand Down
6 changes: 3 additions & 3 deletions os_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
package wgctrl

import (
"golang.zx2c4.com/wireguard/wgctrl/internal/wginternal"
"golang.zx2c4.com/wireguard/wgctrl/internal/wglinux"
"golang.zx2c4.com/wireguard/wgctrl/internal/wguser"
"github.com/wirekcp/wgctrl/internal/wginternal"
"github.com/wirekcp/wgctrl/internal/wglinux"
"github.com/wirekcp/wgctrl/internal/wguser"
)

// newClients configures wginternal.Clients for Linux systems.
Expand Down
6 changes: 3 additions & 3 deletions os_openbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
package wgctrl

import (
"golang.zx2c4.com/wireguard/wgctrl/internal/wginternal"
"golang.zx2c4.com/wireguard/wgctrl/internal/wgopenbsd"
"golang.zx2c4.com/wireguard/wgctrl/internal/wguser"
"github.com/wirekcp/wgctrl/internal/wginternal"
"github.com/wirekcp/wgctrl/internal/wgopenbsd"
"github.com/wirekcp/wgctrl/internal/wguser"
)

// newClients configures wginternal.Clients for OpenBSD systems.
Expand Down
Loading

0 comments on commit cd18644

Please sign in to comment.