telegram
telegram copied to clipboard
Bridge Setup with IPv6 only
We are trying to setup the Bridge on a IPv6-only VM (no IPv4 available at all). We have noticed that it always tries to connect to IPv4 addresses from Telegram, even if a custom server is defined like that:
# Custom server to connect to.
server:
# Set to true to use these server settings. If false, will automatically
# use production server assigned by Telegram. Set to false in production.
enabled: true
# The DC ID to connect to.
dc: 2
# The IP to connect to.
ip: 2001:067c:04e8:f002:0000:0000:0000:000d
The IP address from above is retreived like curl -s https://core.telegram.org/getProxyConfigV6
The messages in the log look like this:
[[email protected]] Attempt 3 at connecting failed: OSError: [Errno 101] Connect call failed ('149.154.167.51', 443)
telethon_sessions always contains an IPv4 address:
SELECT * FROM telethon_sessions;
session_id dc_id server_address port auth_key
---------- ----- -------------- ---- --------
bot 2 149.154.167.51 443
I fixed this by editing telethon/client/telegrambaseclient.py
When you change:
use_ipv6: bool = False,
to
use_ipv6: bool = True,
IPv6 starts working right away without any modifications to mautrix-telegram config or code.
I'll try to tidy up this fix and submit a patch when I have the time.
Any news on that?