Accept IPv6 address literals (with embedded scope ids) in IReactorTCP.listenTCP
|Reported by:||Jean-Paul Calderone||Owned by:||Jean-Paul Calderone|
branch-diff, diff-cov, branch-cov, buildbot
As an early step towards good IPv6 support, the reactor needs to be able to set up listening TCP ports on IPv6 addresses. Since previously it was an error to pass an IPv6 literal to any listenTCP implementation, we can begin supporting that without breaking any existing software.
Nothing about how IPv4 support is provided will change - IPv4 address literals and hostnames will continue to listen only on an IPv4 address. The default will still be to listen on INADDR_ANY, which does not include an IPv6 addresses.
IListeningPort will return an
IPv6Address from its
When a connection is established to the server, the factory's
buildProtocol method will be invoked with an
IPv6Address instance giving the peer's address.
The protocol will be connected to an
ITCPTransport implementation which also returns
IPv6Address instances from its
ITCPTransport.getHost are documented as returning
IPv4Address instances. This should probably change.
IPv6Address is very similar to
IPv4Address. It has
port attributes. It might even be possible to use the same class for each of these, but having two makes it easier to tell the address family apart so I think it's a good idea. If we ever support scopeid or flowid more explicitly, it may be useful to expose those as attributes on
IPv6Address as well.
Once this is resolved, Twisted servers should be able to listen for TCP connections on IPv6 addresses, eg
::. Note that where the platform requires the scope id,
listenTCP will require the scope id.
Change History (16)
comment:6 Changed 6 years ago by
|Branch:||branches/listentcp-ipv6-5084 → branches/listentcp-ipv6-5084-2|
comment:7 Changed 6 years ago by
|Branch:||branches/listentcp-ipv6-5084-2 → branches/listentcp-ipv6-5084-3|
comment:13 Changed 5 years ago by
|Branch:||branches/listentcp-ipv6-5084-3 → branches/listentcp-ipv6-5084-4|