Check '::' really supports both IPv6 and IPv4

socket.has_dualstack_ipv6() checks current runtime environment
really works with both IPv6 and IPv4.
This commit is contained in:
YOKOTA Hiroshi 2023-11-20 20:43:56 +09:00
parent 8a400c83b2
commit dc4ba2e18b

View File

@ -11,6 +11,7 @@ from collections import OrderedDict, namedtuple
from functools import partial from functools import partial
from itertools import zip_longest from itertools import zip_longest
from operator import attrgetter from operator import attrgetter
from socket import has_dualstack_ipv6
from calibre.constants import config_dir from calibre.constants import config_dir
from calibre.utils.localization import _ from calibre.utils.localization import _
@ -110,7 +111,7 @@ raw_options = (
' there are more than this number of items. Set to zero to disable.'), ' there are more than this number of items. Set to zero to disable.'),
_('The interface on which to listen for connections'), _('The interface on which to listen for connections'),
'listen_on', '::', 'listen_on', '::' if has_dualstack_ipv6() else '0.0.0.0',
_('The default is to listen on all available IPv6 and IPv4 interfaces. You can change this to, for' _('The default is to listen on all available IPv6 and IPv4 interfaces. You can change this to, for'
' example, "127.0.0.1" to only listen for connections from the local machine, or' ' example, "127.0.0.1" to only listen for connections from the local machine, or'
' to "::" to listen to all incoming IPv6 and IPv4 connections.'), ' to "::" to listen to all incoming IPv6 and IPv4 connections.'),