parseNetClassIface scans predefined files in /sys/class/net/ directory and gets their contents.
(devicePath string)
| 229 | // parseNetClassIface scans predefined files in /sys/class/net/<iface> |
| 230 | // directory and gets their contents. |
| 231 | func parseNetClassIface(devicePath string) (*NetClassIface, error) { |
| 232 | interfaceClass := NetClassIface{} |
| 233 | |
| 234 | files, err := os.ReadDir(devicePath) |
| 235 | if err != nil { |
| 236 | return nil, err |
| 237 | } |
| 238 | |
| 239 | for _, f := range files { |
| 240 | if !f.Type().IsRegular() { |
| 241 | continue |
| 242 | } |
| 243 | if err := ParseNetClassAttribute(devicePath, f.Name(), &interfaceClass); err != nil { |
| 244 | return nil, err |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | return &interfaceClass, nil |
| 249 | } |
no test coverage detected