mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-22 23:59:41 +08:00
resolver: the system's name servers and hosts file by default
Without nserver (or fakeresolve) names were resolved by the C library. 3proxy's own resolver is now the default, with the system's name servers: up to 3 from /etc/resolv.conf, on Windows from the registry (set for the system, set for an interface with an address, Tcpip6 interfaces, then those DHCP gave). With none found, the C library as before. nserver takes up to 3 as well (MAXNSERVERS), a fourth is warned about. The name servers in force belong to the process, not a configuration: nserver lines are kept aside while a configuration is read and replace them only once it is committed, so a reload resolves with those in force until then. Resolutions and dnspr read a copy of them. The system's are read at start, before the configuration and a chroot in it, and are in force while it is read, so its host names resolve with them; read again at a commit, and checked every 5 seconds from the main loop while the default is in force. What cannot be read then (within a chroot) stays as last read. The hosts file, read with them, is imported into tables of its own while the default is in force: its first address of a family for a name. A name is looked up as one nsrecord made first, then the hosts file, then the name cache, then name servers. A changed file replaces what was imported. No name cache is made for it: without nscache nothing is cached, as before. The name cache's keys are host names of any case now: DNS names are. Tests: sysdns, a name of the hosts file answered by dnspr without nserver, in any case, and not with one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8517a5675b
commit
d5e78a0900
11 files changed
+589
-45
No files matched your search
@@ -500,14 +500,28 @@ experimental.</p>
|
||||
|
||||
<p style="margin-left:9%; margin-top: 1em"><b>nserver</b>
|
||||
<i><ipaddr></i>[:<i>port</i>][/<i>tcp</i>] <br>
|
||||
Nameserver to use for name resolutions. If none specified
|
||||
system routines for name resolution is used. Optional port
|
||||
number may be specified. If optional /tcp is added to IP
|
||||
Nameserver to use for name resolutions; up to 3, asked in
|
||||
order. Optional port number may be specified. If optional /tcp is added to IP
|
||||
address, name resolution is performed over TCP. An IPv6 address
|
||||
has to be enclosed in square brackets: <br>
|
||||
<b>nserver 1.1.1.1</b> <br>
|
||||
<b>nserver [2001:4860:4860::8844]</b> <br>
|
||||
<b>nserver [2001:4860:4860::8844]:5353/tcp</b></p>
|
||||
<b>nserver [2001:4860:4860::8844]:5353/tcp</b> <br>
|
||||
If none is specified (and there is no <b>fakeresolve</b>),
|
||||
the system's name servers are used: up to 3 from
|
||||
<i>/etc/resolv.conf</i>, on Windows from the registry (those
|
||||
set for the system, those set for an interface, then those
|
||||
DHCP gave). Names in the hosts file (<i>/etc/hosts</i>, on
|
||||
Windows <i>%SystemRoot%\System32\drivers\etc\hosts</i>)
|
||||
are answered from it, before them, and names in the
|
||||
configuration are resolved this way too. Both are read
|
||||
before the configuration, so before a <b>chroot</b>, and
|
||||
checked for changes every 5 seconds; what cannot be read
|
||||
later (within a <b>chroot</b>) stays as last read. If no
|
||||
name server is found, the system routines for name
|
||||
resolution are used. The <b>nserver</b> lines of a
|
||||
configuration take effect when it is loaded: during a
|
||||
reload the name servers in force are used.</p>
|
||||
|
||||
|
||||
<p style="margin-left:9%; margin-top: 1em"><b>authnserver</b>
|
||||
@@ -533,9 +547,11 @@ rather than per-service.</p>
|
||||
Adds static record to nscache. <b>nscache</b> must be
|
||||
enabled and must come first, because the record is placed in
|
||||
the table it allocates - <b>nscache6</b> for a record naming
|
||||
an IPv6 address - and <b>nserver</b> must be set as well:
|
||||
without it the system resolver is used and static records
|
||||
are never consulted. If 0.0.0.0 is used as a hostaddr host
|
||||
an IPv6 address - and names must be resolved by name servers
|
||||
(<b>nserver</b>, or the system's ones by default): with the
|
||||
system routines for name resolution static records are never
|
||||
consulted. A static record takes precedence over the hosts
|
||||
file. If 0.0.0.0 is used as a hostaddr host
|
||||
will never resolve, it can be used to blacklist something or
|
||||
together with <b>dialer</b> command to set up UDL for
|
||||
dialing.</p>
|
||||
|
||||
Reference in new issue
Block a user