diff options
author | Florent Daigniere <nextgens@freenetproject.org> | 2019-02-23 21:50:04 +0100 |
---|---|---|
committer | Florent Daigniere <nextgens@freenetproject.org> | 2019-02-25 18:20:23 +0100 |
commit | 0c2d06d8a5a6bb61b42857ac2c21c579b11a6f1c (patch) | |
tree | abcd5992aaa3f02f0c0b5e14a4673317b6749fca /conn_default.go | |
parent | 9e686cd714a371ad5f35f356fe88f018fa5e92e6 (diff) | |
download | wireguard-go-fd/propagate-DSCP-bits.tar.gz wireguard-go-fd/propagate-DSCP-bits.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 'conn_default.go')
-rw-r--r-- | conn_default.go | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/conn_default.go b/conn_default.go index 6f17de5..1b25863 100644 --- a/conn_default.go +++ b/conn_default.go @@ -133,26 +133,29 @@ func (bind *NativeBind) Close() error { return err2 } -func (bind *NativeBind) ReceiveIPv4(buff []byte) (int, Endpoint, error) { +// TODO: implement TOS +func (bind *NativeBind) ReceiveIPv4(buff []byte) (int, Endpoint, byte, error) { if bind.ipv4 == nil { - return 0, nil, syscall.EAFNOSUPPORT + return 0, nil, 0, syscall.EAFNOSUPPORT } n, endpoint, err := bind.ipv4.ReadFromUDP(buff) if endpoint != nil { endpoint.IP = endpoint.IP.To4() } - return n, (*NativeEndpoint)(endpoint), err + return n, (*NativeEndpoint)(endpoint), 0, err } -func (bind *NativeBind) ReceiveIPv6(buff []byte) (int, Endpoint, error) { +// TODO: implement TOS +func (bind *NativeBind) ReceiveIPv6(buff []byte) (int, Endpoint, byte, error) { if bind.ipv6 == nil { - return 0, nil, syscall.EAFNOSUPPORT + return 0, nil, 0, syscall.EAFNOSUPPORT } n, endpoint, err := bind.ipv6.ReadFromUDP(buff) - return n, (*NativeEndpoint)(endpoint), err + return n, (*NativeEndpoint)(endpoint), 0, err } -func (bind *NativeBind) Send(buff []byte, endpoint Endpoint) error { +// TODO: implement TOS +func (bind *NativeBind) Send(buff []byte, endpoint Endpoint, tos byte) error { var err error nend := endpoint.(*NativeEndpoint) if nend.IP.To4() != nil { |