Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
IPv6 support #1696
Conversation
glyph
added some commits
Dec 11, 2016
matrixbot
commented
Dec 12, 2016
|
Can one of the admins verify this patch? |
matrixbot
commented
Dec 12, 2016
|
Can one of the admins verify this patch? |
matrixbot
commented
Dec 12, 2016
|
Can one of the admins verify this patch? |
|
One problem though is that the default |
|
@matrixbot test this please |
|
Seems I missed to add the fixed imports originally, so the tests would need to be re-run. |
uh, is this a known issue? |
|
@matrixbot ok to test |
|
@kyrias no idea why that build stalled, but I restarted it and now it errors with:
|
? |
|
It may be worth noting that the empty string may cause Twisted to listen on IPv6 addresses as well, depending on your platform; |
|
For the record: I had a brief IRL discussion with @erikjohnston and @NegativeMjark and others this morning about what we do about ipv6-only HSes. Obviously we risk a major split-brain problem if some servers can't talk to others 'cos they're either ipv6 or ipv4 only. For now, the suggestion is to mandate that servers expose ipv4 publicly (but if any given pair of servers happen to do ipv6 then they'll use it). I guess this is the same semantics as email. If anyone has any smarter solutions then we're all ears. |
|
It would also be a good idea to be able to specify multiple bind_addresses, and I have this implemented uncommitted locally already. |
This was referenced Dec 18, 2016
| + return None | ||
| + return SpiderEndpoint( | ||
| + reactor, uri.host, uri.port, self.blacklist, self.whitelist, | ||
| + endpoint=endpoint_factory, endpoint_kw_args=dict(timeout=15), |
ara4n
Dec 18, 2016
Owner
what's the rationale for using dict() rather than {} here? i think the existing code style is to use {}...
kyrias
Dec 18, 2016
Contributor
I just didn't change that part, but it seems dict() is used in a bunch of places as well
λ git grep ' dict\(' | wc -l
61
I can certainly change it to {} instead though.
ara4n
Dec 18, 2016
Owner
looking through the results of that grep, none of those uses seem to be for constants like this, which is only why it jumped out as looking weird. it's trivial, but probably worth fixing. (disclaimer: i'm hardly a python expert, but trying to help fill in whilst @erikjohnston is out)
glyph
Dec 18, 2016
Contributor
The rationale is as follows:
- This dictionary is going to be used as
**kw, meaning it needs to be nativestrmapped to some object. - To facilitate python 3 portability, all modules should slowly be getting as many
__future__imports as possible, to make the py2 environment and the py3 environment consistent. One such import isfrom __future__ import unicode_literals. - If you rely on
""to produce a nativestr, this assumption will be broken withunicode_literalsimported. - However,
dict(**kw)will producekwunaltered; meaning, it will be a nativestreven if a quoted string would produce aunicode.
So this is generally a habit I believe one should get into for py3 hygiene.
ara4n
Dec 18, 2016
Owner
okay, i'm happy to defer (and yield, for that matter) to python wisdom here ;)
njsmith
Dec 20, 2016
One such import is
from __future__ import unicode_literals
FWIW, Guido says you shouldn't use unicode_literals and they're going to add a warning about this to the official docs. (See recent thread on python-dev.)
glyph
Dec 20, 2016
Contributor
Hrm. I'm not sure I fully agree with that thread, but definitely unicode_literals is not without its pitfalls. Nevertheless, dict(**kw) is a clearer expression of the intent of "I intend to use this for keywords".
|
the multiple bind_addresses PR has ended up at #1709 - thanks @kyrias! Doing a quick review here, the only thing that screams out as being missing is to kick the dependency for https://github.com/matrix-org/synapse/blob/master/synapse/python_dependencies.py? Otherwise I think I'm happy to merge this as an experimental feature (modulo random stylistic niggle) |
ara4n
assigned
kyrias
Dec 18, 2016
ara4n
merged commit a58e4e0
into
matrix-org:develop
Dec 19, 2016
kyrias
deleted the
kyrias:ipv6
branch
Dec 20, 2016
|
Really glad to help. (Thanks to Rackspace for sponsoring my time to work on open source infrastructure like this in the Twisted ecosystem... :)) |
kyrias commentedDec 12, 2016
I've been testing it out in a clean private testing environment with 2 IPv4 and one IPv6 homeservers running, and it seems to be working pretty well so far.
(Supersedes #1689 and #1690)