crossbario / autobahn-python

WebSocket and WAMP in Python for Twisted and asyncio
https://crossbar.io/autobahn
MIT License
2.48k stars 770 forks source link

Complete IPv6 support #1165

Open oberstet opened 5 years ago

oberstet commented 5 years ago

So we want to support IPv6 in Autobahn - for all flavors. This is not the case as of today (see below).

Longer term, the "flavors" we need to cover are:

Of these, the most important is Crossbar.io, then WAMP client using ApplicationSession (as we use that in Crossbar.io for historical reasons), and then Component


I have quickly looked at the status of Twisted and Twisted endpoints relating to above (I haven't analyzed all the others).

Twisted endpoints is the "new" and recommended API of Twisted, and it supports TCP v4+6, but only TLS v4 on Twisted 18.9.0:

(cpy372_1) oberstet@intel-nuci7:~/scm/crossbario/autobahn-python$ python
Python 3.7.2 (default, Feb 25 2019, 08:26:41) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from twisted.internet.endpoints import SSL4ClientEndpoint
>>> from twisted.internet.endpoints import SSL6ClientEndpoint
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'SSL6ClientEndpoint' from 'twisted.internet.endpoints' (/home/oberstet/cpy372_1/lib/python3.7/site-packages/twisted/internet/endpoints.py)
>>> from twisted.internet.endpoints import TCP4ClientEndpoint
>>> from twisted.internet.endpoints import TCP6ClientEndpoint
>>> import twisted
>>> twisted.__version__
'18.9.0'
>>> 

Autobahn is using above here to create client connecting transports.

On crossbar.io, the same restriction (resulting from above limitation) applies: IPv6 works for TCP, but not TLS: https://github.com/crossbario/crossbar/blob/master/crossbar/common/twisted/endpoint.py#L383

oberstet commented 5 years ago

rgd Autobahn at the WebSocket level, and on Twisted:

sidenote: wading through our examples etc, I recognize this is quite hard to navigate (lots of variants etc). likely very hard or impossible for beginners. on the one hand, the large number of variants is inevitable, as Autobahn simply supports running on a lot of flavors, but on the other hand, we should provide better guidelines of what to use when. well. a day tocks in only 24 hours;)

oberstet commented 5 years ago

the ssl: client endpoint doesn’t work with IPv6, and the tls: endpoint does.

https://twistedmatrix.com/documents/current/core/howto/endpoints.html

mmmmh. not sure: does that mean that a regular TCP v6 twisted endpoints now also works for TLS?