View Source partisan_peer_discovery_dns (partisan v5.0.0-rc.16)
An implementation of the partisan_peer_discovery_agent
behaviour that uses DNS for service discovery.
It is enabled by using the following options in the sys.conf file
bash
{partisan, [
{peer_discovery, [
{type, partisan_peer_discovery_dns},
{config, #{
record_type => fqdns,
query => "foo.local",
node_basename => "foo"
}}
]}
]}
Checking if a DNS query
If you are experiencing an issue with Partisan not finding the peers using DNS you might want to check the configuration is correct.
One way of doing that is by doing the following on your Erlang shell:
1> Config = #{
record_type => fqdns,
query => "foo.local",
node_basename => "foo"
}.
2> {ok, State} = partisan_peer_discovery_dns:init(Config).
3> partisan_peer_discovery_dns:lookup(Config, 1000).
The last line should return the result
Summary
Types
-type nameserver() :: {string_or_type(inet:ip_address()), string_or_type(1..65535)} | binary() | string().
-type options() :: #{alt_nameservers => [nameserver()], nameservers => [nameserver()], inet6 => string_or_type(boolean())}.
-type record_type() :: string_or_type(a | aaaa | srv | fqdns).
Functions
-spec init(Opts :: config() | deprecated_config()) -> {ok, State :: any()} | {error, Reason :: any()}.