From 9e7296815466d0e0049b66c19d481daea34eee7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 8 Nov 2024 16:37:14 +0100 Subject: [PATCH] add '-4/--force-ipv4' and '-6/--force-ipv6' command-line options --- docs/options.md | 2 ++ gallery_dl/option.py | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/docs/options.md b/docs/options.md index ffbe1d1f..2116da63 100644 --- a/docs/options.md +++ b/docs/options.md @@ -71,6 +71,8 @@ --http-timeout SECONDS Timeout for HTTP connections (default: 30.0) --proxy URL Use the specified proxy --source-address IP Client-side IP address to bind to + -4, --force-ipv4 Make all connections via IPv4 + -6, --force-ipv6 Make all connections via IPv6 --no-check-certificate Disable HTTPS certificate validation ## Downloader Options: diff --git a/gallery_dl/option.py b/gallery_dl/option.py index b38ad743..1d94aab9 100644 --- a/gallery_dl/option.py +++ b/gallery_dl/option.py @@ -460,6 +460,17 @@ def build_parser(): dest="source-address", metavar="IP", action=ConfigAction, help="Client-side IP address to bind to", ) + networking.add_argument( + "-4", "--force-ipv4", + dest="source-address", nargs=0, action=ConfigConstAction, + const="0.0.0.0", + help="Make all connections via IPv4", + ) + networking.add_argument( + "-6", "--force-ipv6", + dest="source-address", nargs=0, action=ConfigConstAction, const="::", + help="Make all connections via IPv6", + ) networking.add_argument( "--no-check-certificate", dest="verify", nargs=0, action=ConfigConstAction, const=False,