...
1
2
3
4
5
6
7 package quic
8
9 import (
10 "encoding/binary"
11
12 "golang.org/x/sys/unix"
13 )
14
15
16 const (
17 udpECNSupport = true
18 udpInvalidLocalAddrIsError = true
19 )
20
21
22
23
24 func parseIPTOS(b []byte) (ecnBits, bool) {
25
26 if len(b) != 1 {
27 return 0, false
28 }
29 return ecnBits(b[0] & ecnMask), true
30 }
31
32 func appendCmsgECNv4(b []byte, ecn ecnBits) []byte {
33
34
35 b, data := appendCmsg(b, unix.IPPROTO_IP, unix.IP_TOS, 4)
36 binary.NativeEndian.PutUint32(data, uint32(ecn))
37 return b
38 }
39
View as plain text