MCPcopy Create free account
hub / github.com/prometheus/procfs / parseNetRouteLine

Function parseNetRouteLine

net_route.go:81–143  ·  view source on GitHub ↗
(fields []string)

Source from the content-addressed store, hash-verified

79}
80
81func parseNetRouteLine(fields []string) (*NetRouteLine, error) {
82 if len(fields) != routeLineColumns {
83 return nil, fmt.Errorf("invalid routeline, num of digits: %d", len(fields))
84 }
85 iface := fields[0]
86 if iface == blackholeRepresentation {
87 iface = blackholeIfaceName
88 }
89 destination, err := strconv.ParseUint(fields[1], 16, 32)
90 if err != nil {
91 return nil, err
92 }
93 gateway, err := strconv.ParseUint(fields[2], 16, 32)
94 if err != nil {
95 return nil, err
96 }
97 flags, err := strconv.ParseUint(fields[3], 10, 32)
98 if err != nil {
99 return nil, err
100 }
101 refcnt, err := strconv.ParseUint(fields[4], 10, 32)
102 if err != nil {
103 return nil, err
104 }
105 use, err := strconv.ParseUint(fields[5], 10, 32)
106 if err != nil {
107 return nil, err
108 }
109 metric, err := strconv.ParseUint(fields[6], 10, 32)
110 if err != nil {
111 return nil, err
112 }
113 mask, err := strconv.ParseUint(fields[7], 16, 32)
114 if err != nil {
115 return nil, err
116 }
117 mtu, err := strconv.ParseUint(fields[8], 10, 32)
118 if err != nil {
119 return nil, err
120 }
121 window, err := strconv.ParseUint(fields[9], 10, 32)
122 if err != nil {
123 return nil, err
124 }
125 irtt, err := strconv.ParseUint(fields[10], 10, 32)
126 if err != nil {
127 return nil, err
128 }
129 routeline := &NetRouteLine{
130 Iface: iface,
131 Destination: uint32(destination),
132 Gateway: uint32(gateway),
133 Flags: uint32(flags),
134 RefCnt: uint32(refcnt),
135 Use: uint32(use),
136 Metric: uint32(metric),
137 Mask: uint32(mask),
138 MTU: uint32(mtu),

Callers 1

parseNetRouteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…