Skip to content

Commit

Permalink
global: begin modularization
Browse files Browse the repository at this point in the history
  • Loading branch information
zx2c4 committed Mar 3, 2019
1 parent d435be3 commit 69f0fe6
Show file tree
Hide file tree
Showing 44 changed files with 118 additions and 109 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ MAKEFLAGS += --no-print-directory
generate-version-and-build:
@export GIT_CEILING_DIRECTORIES="$(realpath $(CURDIR)/..)" && \
tag="$$(git describe --dirty 2>/dev/null)" && \
ver="$$(printf 'package main\nconst WireGuardGoVersion = "%s"\n' "$$tag")" && \
[ "$$(cat version.go 2>/dev/null)" != "$$ver" ] && \
echo "$$ver" > version.go && \
git update-index --assume-unchanged version.go || true
ver="$$(printf 'package device\nconst WireGuardGoVersion = "%s"\n' "$$tag")" && \
[ "$$(cat device/version.go 2>/dev/null)" != "$$ver" ] && \
echo "$$ver" > device/version.go && \
git update-index --assume-unchanged device/version.go || true
@$(MAKE) wireguard-go

wireguard-go: $(wildcard *.go) $(wildcard */*.go)
Expand Down
2 changes: 1 addition & 1 deletion allowedips.go → device/allowedips.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion allowedips_rand_test.go → device/allowedips_rand_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"math/rand"
Expand Down
2 changes: 1 addition & 1 deletion allowedips_test.go → device/allowedips_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"math/rand"
Expand Down
2 changes: 1 addition & 1 deletion bind_test.go → device/bind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import "errors"

Expand Down
4 changes: 2 additions & 2 deletions conn.go → device/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"errors"
Expand Down Expand Up @@ -177,4 +177,4 @@ func (device *Device) BindClose() error {
err := unsafeCloseBind(device)
device.net.Unlock()
return err
}
}
2 changes: 1 addition & 1 deletion conn_default.go → device/conn_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"net"
Expand Down
2 changes: 1 addition & 1 deletion conn_linux.go → device/conn_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* So this code is remains platform dependent.
*/

package main
package device

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion constants.go → device/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"time"
Expand Down
2 changes: 1 addition & 1 deletion cookie.go → device/cookie.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"crypto/hmac"
Expand Down
2 changes: 1 addition & 1 deletion cookie_test.go → device/cookie_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion device.go → device/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"golang.zx2c4.com/wireguard/ratelimiter"
Expand Down
2 changes: 1 addition & 1 deletion device_test.go → device/device_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

/* Create two device instances and simulate full WireGuard interaction
* without network dependencies
Expand Down
2 changes: 1 addition & 1 deletion endpoint_test.go → device/endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"math/rand"
Expand Down
2 changes: 1 addition & 1 deletion indextable.go → device/indextable.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"crypto/rand"
Expand Down
2 changes: 1 addition & 1 deletion ip.go → device/ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"net"
Expand Down
2 changes: 1 addition & 1 deletion kdf_test.go → device/kdf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"encoding/hex"
Expand Down
2 changes: 1 addition & 1 deletion keypair.go → device/keypair.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"crypto/cipher"
Expand Down
2 changes: 1 addition & 1 deletion logger.go → device/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"io"
Expand Down
2 changes: 1 addition & 1 deletion mark_default.go → device/mark_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

func (bind *NativeBind) SetMark(mark uint32) error {
return nil
Expand Down
2 changes: 1 addition & 1 deletion mark_unix.go → device/mark_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"golang.org/x/sys/unix"
Expand Down
2 changes: 1 addition & 1 deletion misc.go → device/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"sync/atomic"
Expand Down
2 changes: 1 addition & 1 deletion noise-helpers.go → device/noise-helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"crypto/hmac"
Expand Down
2 changes: 1 addition & 1 deletion noise-protocol.go → device/noise-protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion noise-types.go → device/noise-types.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"crypto/subtle"
Expand Down
2 changes: 1 addition & 1 deletion noise_test.go → device/noise_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion peer.go → device/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"encoding/base64"
Expand Down
2 changes: 1 addition & 1 deletion pools.go → device/pools.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import "sync"

Expand Down
2 changes: 1 addition & 1 deletion queueconstants.go → device/queueconstants.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

/* Implementation specific constants */

Expand Down
2 changes: 1 addition & 1 deletion receive.go → device/receive.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion send.go → device/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion timers.go → device/timers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* This is based heavily on timers.c from the kernel implementation.
*/

package main
package device

import (
"math/rand"
Expand Down
2 changes: 1 addition & 1 deletion tun.go → device/tun.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
*/

package main
package device

import (
"golang.zx2c4.com/wireguard/tun"
Expand Down
Loading

0 comments on commit 69f0fe6

Please sign in to comment.