VintageNet.Route (vintage_net v0.11.0) View Source
Types for handling routing tables
Link to this section Summary
Types
A default route entry
A list of routing table entries
A routing table entry
A local route entry
Metric (priority) for a routing table entry
Compute a route metric value from information about the interface
An IP route rule
Linux routing table index
Link to this section Types
Specs
default_route() :: {:default_route, VintageNet.ifname(), :inet.ip_address(), metric(), table_index()}
A default route entry
The IP address is the default gateway
Specs
entries() :: [entry()]
A list of routing table entries
Specs
entry() :: rule() | default_route() | local_route()
A routing table entry
This can be turned into real Linux IP routing table entry.
Specs
local_route() :: {:local_route, VintageNet.ifname(), :inet.ip_address(), metric(), table_index()}
A local route entry
This is for routing packets to the LAN
Specs
metric() :: 0..32767
Metric (priority) for a routing table entry
Specs
route_metric_fun() :: (VintageNet.ifname(), VintageNet.Route.InterfaceInfo.t() -> metric())
Compute a route metric value from information about the interface
See VintageNet.Route.DefaultMetric.compute_metric/2
for an example. This can be
set using the :route_metric_fun
application environment key.
Specs
rule() :: {:rule, table_index(), :inet.ip_address()}
An IP route rule
If the source address matches the 3rd element, then use the routing table specified by the 2nd element.
Specs
table_index() :: 0..255 | :main | :local | :default
Linux routing table index
:main
is table 254, :local
is table 255. :default
is normally the same as :main
.