Validate settings
kurahaupo opened this issue · comments
Martin Kealey commented
Validate the fields and give warnings when validations fail.
In particular:
- validate the hostname field by looking in the DNS for an
A
orAAAA
record.- give a warning
- on a device with no routable IPv6 address, give a warning if the hostname has no
A
record, - on a device with no routable IPv4 address, give a warning if the hostname has no
AAAA
record
- validate the port number field as being a positive 16-bit integer (between 1 and 65535).
Among other things, this will detect the case where people try to put a URI instead of a hostname (as exemplified by #328).
Future enhancement: also permit a name that (when prefixed by _irc._tcp.
or _ircs._tcp
) has a DNS SRV
record. (This would require additional logic when connecting.)
These give a list of priority, weight, hostname, port tuples:
$ dig +short srv _irc._tcp.example.chat.
1 100 6667 loadbalancer.irc.example.chat.
2 20 194 host1.irc.example.chat.
2 80 194 bighost.irc.example.chat.
3 100 7000 fallback.irc.example.chat.
$ dig +short srv _ircs._tcp.example.chat.
1 100 6697 loadbalancer.irc.example.chat.
2 40 6697 host1.irc.example.chat.
2 20 6697 host2.irc.example.chat.
2 20 6697 host3.irc.example.chat.
2 20 6697 host4.irc.example.chat.
3 100 7001 fallback.irc.example.chat.
$ dig +short srv _irc._tcp.libera.example.lookaside.
1 1 6667 irc.libera.chat.
$ dig +short srv _ircs._tcp.libera.example.lookaside.
1 1 6697 irc.libera.chat.