diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-11-11 15:43:55 +0100 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-11-11 15:43:55 +0100 |
commit | 892276aa64ca9b14d2e96186b83145ab2f5ce25a (patch) | |
tree | 0638d0c7232a03474af29acc63e72e29c009c654 /src/device.go | |
parent | 0485c34c8e20e4f7ea19bd3c3f52d2f4717caead (diff) |
Fixed port endianness
Diffstat (limited to 'src/device.go')
-rw-r--r-- | src/device.go | 16 |
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 { |