mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 09:22:31 -06:00
optional linklocal ipv6 support (firefox/ie11 only)
This commit is contained in:
parent
9a28afcb48
commit
6cd6dadd06
|
@ -651,6 +651,7 @@ def run_argparse(
|
||||||
ap2 = ap.add_argument_group('network options')
|
ap2 = ap.add_argument_group('network options')
|
||||||
ap2.add_argument("-i", metavar="IP", type=u, default="::", help="ip to bind (comma-sep.), default: all IPv4 and IPv6")
|
ap2.add_argument("-i", metavar="IP", type=u, default="::", help="ip to bind (comma-sep.), default: all IPv4 and IPv6")
|
||||||
ap2.add_argument("-p", metavar="PORT", type=u, default="3923", help="ports to bind (comma/range)")
|
ap2.add_argument("-p", metavar="PORT", type=u, default="3923", help="ports to bind (comma/range)")
|
||||||
|
ap2.add_argument("--ll", action="store_true", help="enable link-local IPv6 (supported by ie11 and firefox (not chrome)) -- breaks some mdns clients")
|
||||||
ap2.add_argument("--rproxy", metavar="DEPTH", type=int, default=1, help="which ip to keep; [\033[32m0\033[0m]=tcp, [\033[32m1\033[0m]=origin (first x-fwd), [\033[32m2\033[0m]=cloudflare, [\033[32m3\033[0m]=nginx, [\033[32m-1\033[0m]=closest proxy")
|
ap2.add_argument("--rproxy", metavar="DEPTH", type=int, default=1, help="which ip to keep; [\033[32m0\033[0m]=tcp, [\033[32m1\033[0m]=origin (first x-fwd), [\033[32m2\033[0m]=cloudflare, [\033[32m3\033[0m]=nginx, [\033[32m-1\033[0m]=closest proxy")
|
||||||
ap2.add_argument("--s-wr-sz", metavar="B", type=int, default=256*1024, help="socket write size in bytes")
|
ap2.add_argument("--s-wr-sz", metavar="B", type=int, default=256*1024, help="socket write size in bytes")
|
||||||
ap2.add_argument("--s-wr-slp", metavar="SEC", type=float, default=0, help="debug: socket write delay in seconds")
|
ap2.add_argument("--s-wr-slp", metavar="SEC", type=float, default=0, help="debug: socket write delay in seconds")
|
||||||
|
|
|
@ -320,7 +320,9 @@ class MDNS(MCast):
|
||||||
def eat(self, buf: bytes, addr: tuple[str, int], sck: socket.socket) -> None:
|
def eat(self, buf: bytes, addr: tuple[str, int], sck: socket.socket) -> None:
|
||||||
cip = addr[0]
|
cip = addr[0]
|
||||||
v6 = ":" in cip
|
v6 = ":" in cip
|
||||||
if cip.startswith("169.254") or v6 and not cip.startswith("fe80"):
|
if cip.startswith("169.254") or (
|
||||||
|
v6 and not cip.startswith("fe80") and not self.args.ll
|
||||||
|
):
|
||||||
return
|
return
|
||||||
|
|
||||||
cache = self.rx6 if v6 else self.rx4
|
cache = self.rx6 if v6 else self.rx4
|
||||||
|
|
|
@ -183,7 +183,9 @@ class MCast(object):
|
||||||
srv.ips[oth_ip.split("/")[0]] = ipaddress.ip_network(oth_ip, False)
|
srv.ips[oth_ip.split("/")[0]] = ipaddress.ip_network(oth_ip, False)
|
||||||
|
|
||||||
# gvfs breaks if a linklocal ip appears in a dns reply
|
# gvfs breaks if a linklocal ip appears in a dns reply
|
||||||
|
if not self.args.ll:
|
||||||
srv.ips = {k: v for k, v in srv.ips.items() if not k.startswith("fe80")}
|
srv.ips = {k: v for k, v in srv.ips.items() if not k.startswith("fe80")}
|
||||||
|
|
||||||
if not srv.ips:
|
if not srv.ips:
|
||||||
self.log("no routable IPs on {}; skipping [{}]".format(netdev, ip), 3)
|
self.log("no routable IPs on {}; skipping [{}]".format(netdev, ip), 3)
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -128,7 +128,7 @@ class TcpSrv(object):
|
||||||
title_vars = [x[1:] for x in self.args.wintitle.split(" ") if x.startswith("$")]
|
title_vars = [x[1:] for x in self.args.wintitle.split(" ") if x.startswith("$")]
|
||||||
t = "available @ {}://{}:{}/ (\033[33m{}\033[0m)"
|
t = "available @ {}://{}:{}/ (\033[33m{}\033[0m)"
|
||||||
for ip, desc in sorted(eps.items(), key=lambda x: x[1]):
|
for ip, desc in sorted(eps.items(), key=lambda x: x[1]):
|
||||||
if ip.startswith("fe80"):
|
if ip.startswith("fe80") and not self.args.ll:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
for port in sorted(self.args.p):
|
for port in sorted(self.args.p):
|
||||||
|
|
Loading…
Reference in a new issue