View Source VintageNet.Route.DefaultMetric (vintage_net v0.13.5)

Default module for prioritizing network interfaces

The priority order is:

  1. Internet-connected interfaces are chosen before LAN-connected interfaces
  2. Wired Ethernet, then wifi, then mobile and then any other interfaces
  3. The interface's weight is used to resolve ties. By default, the weight is derived from the interfaces index. E.g., eth0's weight is 0 (highest priority) and eth1's weight is 1 (next highest)

Summary

Functions

Compute the routing metric for an interface with a status

Functions

Link to this function

compute_metric(ifname, info)

View Source
@spec compute_metric(VintageNet.ifname(), VintageNet.Route.InterfaceInfo.t()) ::
  VintageNet.Route.metric() | :disabled

Compute the routing metric for an interface with a status

This uses the prioritization list to figure out what number should be used for the Linux routing table metric. It could also be :disabled to indicate that a route shouldn't be added to the Linux routing tables at all.