Resolving IPv6 Addresses
All elements of POE's network stack that resolve host names to Internet addresses must produce IPv4 or IPv6 addresses upon request.
Internet address support may be configured in four ways.
- IPv4 only (DEFAULT if IPv6 support is not available)
- IPv6 only
- IPv4 preferred (IPv6 accepted; DEFAULT if IPv6 support is available)
- IPv6 preferred (IPv4 accepted)
Modules that resolve host names to Internet addresses must accept a new parameter (IPVersion) to indicate the preferred address family.
- IPVersion => [ 4 ], # IPv4 only
- IPVersion => [ 6 ], # IPv6 only
- IPVersion => [ 4, 6 ]
- IPVersion => [ 6, 4 ]
The default configuration will depend upon the presence of IPv6 support at compile time.
A POE::Kernel-scoped constant can override the default, for example if IPv6 addresses cause a problem when IPv6 support is loaded.
- sub POE::Kernel::IPVERSION () {[ 4, 6 ]}
In the absence of an IPVERSION constant, POE::Kernel will look for a POE_IPVERSION environment variable.
- export POE_IPVERSION=4,6
Consuming Internet Addresses
All elements of POE's core network stack that consume Internet addresses must be extended to accept and properly handle IPv6 addresses. IPv6 addresses may be identified by the presence of a colon. Absence of a colon in the address will cause it to be treated as IPv4.
- POE::Wheel::SocketFactory
- POE::Component::Server::TCP
- POE::Component::Client::TCP
In addition, the POE project must extend the following vital components to produce and/or accept IPv6 addresses upon request.
- POE::Component::Client::DNS
- POE::Component::Client::Keepalive
- POE::Component::Client::HTTP
Additional modules must be upgraded by their project teams or contributors.
Implementation
If possible, POE should provide or use code that "does the right thing".
POE's documentation must be amended to recommend best practices for IPv6 support.