View Source VintageNet.NameResolver (vintage_net v0.12.2)

This module manages the contents of "/etc/resolv.conf".

This file is used by the C standard library and by Erlang for resolving domain names. Since both C programs and Erlang can do resolution, debugging problems in this area can be confusing due to varying behavior based on who's resolving at the time. See the /etc/erl_inetrc file on the target to review Erlang's configuration.

This module assumes exclusive ownership on "/etc/resolv.conf", so if any other code in the system tries to modify the file, their changes will be lost on the next update.

It is expected that each network interface provides a configuration. This module will track configurations to network interfaces so that it can reflect which resolvers are around. Resolver order isn't handled.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Clear all entries in "/etc/resolv.conf" that are associated with the specified interface.

Completely clear out "/etc/resolv.conf".

Set the search domain and name server list for the specified interface.

Start the resolv.conf manager.

Stop the resolv.conf manager.

Link to this section Types

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

@spec clear(String.t()) :: :ok

Clear all entries in "/etc/resolv.conf" that are associated with the specified interface.

@spec clear_all() :: :ok

Completely clear out "/etc/resolv.conf".

Link to this function

setup(ifname, domain, name_servers)

View Source
@spec setup(String.t(), String.t() | nil, [VintageNet.any_ip_address()]) :: :ok

Set the search domain and name server list for the specified interface.

This replaces any entries in the /etc/resolv.conf for this interface.

@spec start_link(keyword()) :: GenServer.on_start()

Start the resolv.conf manager.

Accepted args:

  • resolvconf - path to the resolvconf file
  • additional_name_servers - list of additional servers
@spec stop() :: :ok

Stop the resolv.conf manager.