pulse-server: add support for IPv6

Add support for listening on IPv6 addresses.
The following address formats are supported:
 * tcp:[<ipv6-addr>]:<port>,
 * tcp:<ipv4-addr>:<port>,
 * tcp:<port>, and
 * unix:<path>.

The IP addresses are parsed using `inet_pton()`,
only the formats supported by that function
are accepted.

The IPv6 address must be surrounded by square brackets,
they do not mean "optional" here. Specifying only the
port is equivalent to the following two addresses:
 * [::]:<port>, and
 * 0.0.0.0:<port>.

Address parsing has been made stricter: the port
must always be specified explicitly.

Fixes #1216.
This commit is contained in:
Barnabás Pőcze 2021-05-26 04:00:08 +02:00
parent 279470bc07
commit 48f03f85a7
4 changed files with 521 additions and 191 deletions

View file

@ -33,7 +33,9 @@ context.modules = [
# the addresses this server listens on
server.address = [
"unix:native"
# "tcp:4713"
# "tcp:4713" # IPv4 and IPv6 on all addresses
# "tcp:[::]:9999" # IPv6 on all addresses
# "tcp:127.0.0.1:8888" # IPv4 on a single address
]
#pulse.min.req = 256/48000 # 5ms
#pulse.default.req = 960/48000 # 20 milliseconds