Help solve the problem with connecting proxy IPv6
Hello! Unfortunately, the library does not work correctly with Ipv6 proxy. I kindly ask you to help me to solve this problem.
The crux of the problem is this:
- I am using client.start() method to authorize my account along with proxy ipV6.
- There are no errors when executing the client.connect() method. And the connection is successful.

Connection is via Ipv6 data center:
2001:067c:04e8:f004:0000:0000:0000:000a:80
- Further, after entering the phone number, Telegram automatically switches to another Data Center (dcId: 2), after which a connection error occurs:
WebSocket connection failed.

Connection is via Ipv6 data center:
2001:067c:04e8:f002:0000:0000:0000:000a:80
- I tried to solve this problem by changing the Data Center to a working one, but ended up with a different error:
Auth key unset

Data centers that I have tried:
- 2001:b28:f23d:f001::a
- 2001:b28:f23d:f003::a
- 2001:67c:4e8:f004::a
- 2001:b28:f23f:f005::a
But in the end the error was the same as described above.
I used different proxies, checked them in the desktop version of telegram - they all work fine. If anyone has any solution, I would be very grateful if you share it.
Code I used (with working proxy):
const { Api, TelegramClient } = require("telegram");
const { StringSession } = require("telegram/sessions");
const input = require("input");
const apiId = 1;
const apiHash = "b6b154c3707471f5339bd661645ed3d6";
const session = new StringSession("");
const client = new TelegramClient(session, apiId, apiHash, {
connectionRetries: 2,
useIPV6: true,
langCode: 'en',
systemLangCode: 'en',
proxy: {
ip: "45.89.19.41",
port: 7711,
username: "FFhf0l",
password: "bBlM1c6JSG",
MTProxy: false,
socksType: 5,
timeout: 20,
}
})
let start = async()=>{
await client.connect()
.then(response => {
console.log("Connect");
})
.catch(error => {
console.log("Error: "+error);
})
await client.start({
phoneNumber: async () => await input.text("number ?"),
password: async () => await input.text("password?"),
phoneCode: async () => await input.text("Code ?"),
onError: (err) => {
throw new Error(err)
},
})
.then(response => {
console.log("Ok!");
console.log(client.session.save());
})
.catch(error => {
console.log("Error: "+error);
})
}
start();
In general, the problem turned out to be in data centers. Each number has its own region, and depending on it, Telegram allocates a specific Data Center. And unfortunately not every proxy ipV6 can connect to this DC.