...
1
2
3
4
5 package ipv6
6
7
8
9 func (c *genericOpt) TrafficClass() (int, error) {
10 if !c.ok() {
11 return 0, errInvalidConn
12 }
13 so, ok := sockOpts[ssoTrafficClass]
14 if !ok {
15 return 0, errNotImplemented
16 }
17 return so.GetInt(c.Conn)
18 }
19
20
21
22 func (c *genericOpt) SetTrafficClass(tclass int) error {
23 if !c.ok() {
24 return errInvalidConn
25 }
26 so, ok := sockOpts[ssoTrafficClass]
27 if !ok {
28 return errNotImplemented
29 }
30 return so.SetInt(c.Conn, tclass)
31 }
32
33
34 func (c *genericOpt) HopLimit() (int, error) {
35 if !c.ok() {
36 return 0, errInvalidConn
37 }
38 so, ok := sockOpts[ssoHopLimit]
39 if !ok {
40 return 0, errNotImplemented
41 }
42 return so.GetInt(c.Conn)
43 }
44
45
46
47 func (c *genericOpt) SetHopLimit(hoplim int) error {
48 if !c.ok() {
49 return errInvalidConn
50 }
51 so, ok := sockOpts[ssoHopLimit]
52 if !ok {
53 return errNotImplemented
54 }
55 return so.SetInt(c.Conn, hoplim)
56 }
57
View as plain text