From 3c78c6a880807d78efa754aeb7a559d99d3b6b57 Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 10 Aug 2025 10:03:42 +0000 Subject: [PATCH] custom mdns domain, closes #549 --- copyparty/__main__.py | 1 + copyparty/mdns.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/copyparty/__main__.py b/copyparty/__main__.py index 8c630115..5c2771fe 100644 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -1201,6 +1201,7 @@ def add_zc_mdns(ap): ap2.add_argument("--zm-lh", metavar="PATH", type=u, default="", help="link a specific folder for http shares") ap2.add_argument("--zm-lf", metavar="PATH", type=u, default="", help="link a specific folder for ftp shares") ap2.add_argument("--zm-ls", metavar="PATH", type=u, default="", help="link a specific folder for smb shares") + ap2.add_argument("--zm-fqdn", metavar="FQDN", type=u, default="--name.local", help="the domain to announce; NOTE: using anything other than .local is nonstandard and could cause problems") ap2.add_argument("--zm-mnic", action="store_true", help="merge NICs which share subnets; assume that same subnet means same network") ap2.add_argument("--zm-msub", action="store_true", help="merge subnets on each NIC -- always enabled for ipv6 -- reduces network load, but gnome-gvfs clients may stop working, and clients cannot be in subnets that the server is not") ap2.add_argument("--zm-noneg", action="store_true", help="disable NSEC replies -- try this if some clients don't see copyparty") diff --git a/copyparty/mdns.py b/copyparty/mdns.py index a9d36fe7..0dde707d 100644 --- a/copyparty/mdns.py +++ b/copyparty/mdns.py @@ -76,7 +76,8 @@ class MDNS(MCast): if not self.args.zm_nwa_1: set_avahi_379() - zs = self.args.name + ".local." + zs = self.args.zm_fqdn or (self.args.name + ".local") + zs = zs.replace("--name", self.args.name).rstrip(".") + "." zs = zs.encode("ascii", "replace").decode("ascii", "replace") self.hn = "-".join(x for x in zs.split("?") if x) or ( "vault-{}".format(random.randint(1, 255))