aboutsummaryrefslogtreecommitdiff
path: root/src/device.go
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2017-07-08 23:51:26 +0200
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2017-07-08 23:51:26 +0200
commit4ad62aaa6aa269f08c0fdc9c139e6d5417e21746 (patch)
tree2105f65bc61b0fb842ac44c11a81150a8bb9a909 /src/device.go
parent5c1ccbddf0c6fdfd98cb3204c1cd4726862855f2 (diff)
downloadwireguard-go-4ad62aaa6aa269f08c0fdc9c139e6d5417e21746.tar.gz
wireguard-go-4ad62aaa6aa269f08c0fdc9c139e6d5417e21746.zip
Improved timer state machine
Diffstat (limited to 'src/device.go')
-rw-r--r--src/device.go13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/device.go b/src/device.go
index 0564068..12d1ed9 100644
--- a/src/device.go
+++ b/src/device.go
@@ -31,16 +31,11 @@ type Device struct {
signal struct {
stop chan struct{}
}
- congestionState int32 // used as an atomic bool
- peers map[NoisePublicKey]*Peer
- mac MACStateDevice
+ underLoad int32 // used as an atomic bool
+ peers map[NoisePublicKey]*Peer
+ mac MACStateDevice
}
-const (
- CongestionStateUnderLoad = iota
- CongestionStateOkay
-)
-
func (device *Device) SetPrivateKey(sk NoisePrivateKey) {
device.mutex.Lock()
defer device.mutex.Unlock()
@@ -99,10 +94,12 @@ func NewDevice(tun TUNDevice, logLevel int) *Device {
go device.RoutineDecryption()
go device.RoutineHandshake()
}
+
go device.RoutineBusyMonitor()
go device.RoutineReadFromTUN(tun)
go device.RoutineReceiveIncomming()
go device.RoutineWriteToTUN(tun)
+
return device
}