diff options
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 { |