Maps the configured subdomains to the LAN address when the server is on the same network within a hosts file
Find a file
2024-05-18 13:53:12 +05:00
src Bind to interface instead of implicitly binding to first interface 2024-05-18 13:53:12 +05:00
.gitignore Add gitignore 2024-05-13 12:18:16 +05:00
build.zig Add UDP send functionality 2024-05-11 15:14:32 +05:00
build.zig.zon Init repo 2024-05-10 11:54:16 +05:00
README.md Update README 2024-05-18 00:03:16 +05:00

local-etc-hosts-updater

Queries the mDNS record for a given .local address, and maps it to the given subdomains inside a hosts file

Usage

CLI Args

local-etc-hosts-updater <local_domain> <ip_version> <scope_id>

  • local_domain is the local domain to be queried
  • ip_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
  • scope_id is the interface numeric interface index as returned by if_nametoindex. Largely just to get around limitations on an unrooted android.

ENV vars

  • OLD_HOSTS_PATH path to the current hosts file
  • TARGET_DOMAIN public domain for the subdomains
  • SUBDOMAIN_LIST space separated list of subdomains to map