aboutsummaryrefslogtreecommitdiff
path: root/peer.go
diff options
context:
space:
mode:
authorFlorent Daigniere <nextgens@freenetproject.org>2019-02-23 21:50:04 +0100
committerFlorent Daigniere <nextgens@freenetproject.org>2019-02-25 18:20:23 +0100
commit0c2d06d8a5a6bb61b42857ac2c21c579b11a6f1c (patch)
treeabcd5992aaa3f02f0c0b5e14a4673317b6749fca /peer.go
parent9e686cd714a371ad5f35f356fe88f018fa5e92e6 (diff)
downloadwireguard-go-0c2d06d8a5a6bb61b42857ac2c21c579b11a6f1c.tar.gz
wireguard-go-0c2d06d8a5a6bb61b42857ac2c21c579b11a6f1c.zip
net: implement ECN handling, rfc6040 stylefd/propagate-DSCP-bits
To decide whether we should use the compatibility mode or the normal mode with a peer, we use the handshake messages as a signaling channel. If we receive the expected ECN bits, it most likely means they're running a compatible version. Signed-off-by: Florent Daigniere <nextgens@freenetproject.org>
Diffstat (limited to 'peer.go')
-rw-r--r--peer.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/peer.go b/peer.go
index 96cfa61..642a0ee 100644
--- a/peer.go
+++ b/peer.go
@@ -15,6 +15,14 @@ import (
const (
PeerRoutineNumber = 3
+
+ DiffServAF41 = 0x88 // AF41
+ NotECNTransport = 0x00 // Not-ECT (Not ECN-Capable Transport)
+ ECNTransport1 = 0x01 // ECT(1) (ECN-Capable Transport(1))
+ ECNTransport0 = 0x02 // ECT(0) (ECN-Capable Transport(0))
+ CongestionExperienced = 0x03 // CE (Congestion Experienced)
+
+ HandshakeDSCP = DiffServAF41 | ECNTransport0 // AF41, plus 10 ECN
)
type Peer struct {
@@ -25,6 +33,7 @@ type Peer struct {
device *Device
endpoint Endpoint
persistentKeepaliveInterval uint16
+ isECNConfirmed AtomicBool
// This must be 64-bit aligned, so make sure the above members come out to even alignment and pad accordingly
stats struct {