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