# `Sys.Linux.Proc.NetDev`
[🔗](https://github.com/harmont-dev/hyper/blob/main/lib/sys/linux/proc/net_dev.ex#L1)

Parses `/proc/net/dev` into per-interface byte counters.

The file opens with two header lines and then one line per interface:

    Inter-|   Receive  ...                  |  Transmit ...
     face |bytes  packets ...               |bytes  packets ...
    enp1s0: 187188513509 68447977 0 ...      112751842436 64224487 0 ...

Each data line is `<ifname>: <8 receive counters> <8 transmit counters>`, where
receive `bytes` is the 1st counter and transmit `bytes` is the 9th. Rather than
trust the header or assume a fixed column count, a line is taken only if it
matches `name: <digits...>`: the two header rows do not (no `name:` followed by a
number), and an interface name may itself contain a `:` (an IP alias such as
`eth0:0`), which a naive split on the first colon would mangle.

Every interface is returned as-is - loopback, bridges, docker/veth, and tunnels
included. Which interfaces count toward a metric is the caller's policy.

# `parse`

```elixir
@spec parse(String.t()) :: [Sys.Linux.Proc.NetDev.Interface.t()]
```

Parse a `/proc/net/dev` payload into one `Interface` per interface line.

# `read`

```elixir
@spec read() :: {:ok, [Sys.Linux.Proc.NetDev.Interface.t()]} | {:error, File.posix()}
```

Read and parse `/proc/net/dev`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
