Maps the configured subdomains to the LAN address when the server is on the same network within a hosts file
src | ||
.gitignore | ||
build.zig | ||
build.zig.zon | ||
README.md |
local-etc-hosts-updater
Queries the mDNS record for a given .local address, and maps it to the given subdomains inside a hosts file
Linux >5.1 only due to SO_BINDTOIFINDEX socket option.
Usage
CLI Args
local-etc-hosts-updater <local_domain> <ip_version> <scope_id>
local_domain
is the local domain to be queriedip_version
is an enum.- 4 will query for an IPv4 address in the
192.168.0.0/16
subnet - 6 will query for a ULA IPv6 address in the
fd00::/8
subnet - 0 will do both
- 4 will query for an IPv4 address in the
scope_id
is either the name of the interface, or the corresponding numeric interface index. The index is largely for unrooted android limitations.
ENV vars
OLD_HOSTS_PATH
path to the current hosts fileTARGET_DOMAIN
public domain for the subdomainsSUBDOMAIN_LIST
space separated list of subdomains to map