aboutsummaryrefslogtreecommitdiffstats
path: root/src/device.go
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2017-11-11 15:43:55 +0100
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2017-11-11 15:43:55 +0100
commit892276aa64ca9b14d2e96186b83145ab2f5ce25a (patch)
tree0638d0c7232a03474af29acc63e72e29c009c654 /src/device.go
parentFixed message header length in conn_linux (diff)
downloadwireguard-go-892276aa64ca9b14d2e96186b83145ab2f5ce25a.tar.xz
wireguard-go-892276aa64ca9b14d2e96186b83145ab2f5ce25a.zip
Fixed port endianness
Diffstat (limited to 'src/device.go')
-rw-r--r--src/device.go16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/device.go b/src/device.go
index 1aae448..a348c68 100644
--- a/src/device.go
+++ b/src/device.go
@@ -23,9 +23,10 @@ type Device struct {
}
net struct {
mutex sync.RWMutex
- bind UDPBind
- port uint16
- fwmark uint32
+ bind UDPBind // bind interface
+ port uint16 // listening port
+ fwmark uint32 // mark value (0 = disabled)
+ update *sync.Cond // the bind was updated
}
mutex sync.RWMutex
privateKey NoisePrivateKey
@@ -38,8 +39,7 @@ type Device struct {
handshake chan QueueHandshakeElement
}
signal struct {
- stop chan struct{}
- updateBind chan struct{}
+ stop chan struct{}
}
underLoadUntil atomic.Value
ratelimiter Ratelimiter
@@ -163,6 +163,12 @@ func NewDevice(tun TUNDevice, logLevel int) *Device {
device.signal.stop = make(chan struct{})
+ // prepare net
+
+ device.net.port = 0
+ device.net.bind = nil
+ device.net.update = sync.NewCond(&device.net.mutex)
+
// start workers
for i := 0; i < runtime.NumCPU(); i += 1 {