Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Cant Auth, seems like it's trying to make a IPv6 connection on IPv4 network/internet. #105

Open
MarjovanLier opened this issue Jul 28, 2021 · 20 comments
Labels
bug Something isn't working

Comments

@MarjovanLier
Copy link

Using https://github.com/xelaj/mtproto/blob/main/examples/auth/main.go to try auth with my app ID and hash returns the floowing error.

marjo@Laptop:~/go/src/bitbucket.org/marjo/telegram/auth$ clear; go run main.go 27xxxxxxxxx
&errors.withStack{
error: &errors.withMessage{
cause: &errors.withStack{
error: &errors.withMessage{
cause: &errors.withStack{
error: &errors.withMessage{
cause: &errors.withStack{
error: &errors.withMessage{
cause: &errors.withStack{
error: &errors.withMessage{
cause: &net.AddrError{
Err: "too many colons in address",
Addr: "2001:067c:04e8:f004:0000:0000:0000:000b",
},
msg: "resolving tcp",
},
stack: &errors.stack{
0x6a7085,
0x6a76c5,
0x6abbb5,
0x6ab9e7,
0x6ac119,
0x6ad585,
0x6abf85,
0x6c9ac5,
0x6c9a29,
0x6e2970,
0x43a136,
0x46caa1,
},
},
msg: "setup connection",
},
stack: &errors.stack{
0x6a788a,
0x6abbb5,
0x6ab9e7,
0x6ac119,
0x6ad585,
0x6abf85,
0x6c9ac5,
0x6c9a29,
0x6e2970,
0x43a136,
0x46caa1,
},
},
msg: "can't connect",
},
stack: &errors.stack{
0x6abc16,
0x6ab9e7,
0x6ac119,
0x6ad585,
0x6abf85,
0x6c9ac5,
0x6c9a29,
0x6e2970,
0x43a136,
0x46caa1,
},
},
msg: "recreating connection",
},
stack: &errors.stack{
0x6ac146,
0x6ad585,
0x6abf85,
0x6c9ac5,
0x6c9a29,
0x6e2970,
0x43a136,
0x46caa1,
},
},
msg: "sending AuthSendCode",
},
stack: &errors.stack{
0x6c9b36,
0x6e2970,
0x43a136,
0x46caa1,
},
}
panic: sending AuthSendCode: recreating connection: can't connect: setup connection: resolving tcp: address 2001:067c:04e8:f004:0000:0000:0000:000b: too many colons in address

goroutine 1 [running]:
main.main()
/home/marjo/go/src/bitbucket.org/marjo/telegram/auth/main.go:70 +0x128b
exit status 2

@MarjovanLier MarjovanLier added the bug Something isn't working label Jul 28, 2021
@quenbyako
Copy link
Member

@MarjovanLier Thanks for creating this issue!

Noted your problem, i'll try to find fix as fast as i can (sorry, don't have enough time to maintain this project, still trying to find additional maintainer)

@igolaizola
Copy link

I am suffering a similar problem, in my case the error is the following:

panic: sending AuthSendCode: recreating connection: can't connect: setup connection: dialing tcp: dial tcp [2001:67c:4e8:f004::b]:443: connect: network is unreachable

This address comes from here

newIP, found := m.dclist[e.AdditionalInfo.(int)]

@igolaizola
Copy link

I've just discovered that wsl2 hasn't support for IPv6, that's why I am getting a network error: microsoft/WSL#4518

I'll try directly from windows host.

@Kliton
Copy link

Kliton commented Oct 7, 2021

Same:

panic: sending AuthSendCode: recreating connection: can't connect: setup connection: dialing tcp: dial tcp [2001:67c:4e8:f004::b]:443: connect: no route to host

Any update?

@waybackarchiver
Copy link
Contributor

Try the latest commit d0990b5

@Kliton
Copy link

Kliton commented Oct 7, 2021

@waybackarchiver Already tried, but nothing changes.
panic: sending AuthSendCode: recreating connection: can't connect: setup connection: dialing tcp: dial tcp [2001:67c:4e8:f004::b]:443: connect: no route to host

What i have noticed is that also if i use "ping6 2001:67c:4e8:f004::b" on my macbook i can't reach the data center.
So the problem is not in the ip format but maybe i just can't ping it with my macbook ( and is really strange ).
When i ping it with a online ping service i can ping the ip.

Any suggestion?

@waybackarchiver
Copy link
Contributor

It looks like can not connect the Telegram server over IPv6.

I guess should add an option to skipping IPv6 address at

mtproto/telegram/common.go

Lines 119 to 125 in d0990b5

for _, dc := range config.DcOptions {
if dc.Cdn {
continue
}
dcList[int(dc.ID)] = net.JoinHostPort(dc.IpAddress, strconv.Itoa(int(dc.Port)))
}

@Kliton
Copy link

Kliton commented Oct 7, 2021

I've filtered all ipv6 addressess:
if dc.Cdn || dc.Ipv6 {continue}

Now is connecting to this ip:
PHONE_MIGRATE_X: need to go to DC with ip:port -> 149.154.166.120:443

And now i have this error:
panic: (code 4294966892)

Any suggestion?

@waybackarchiver
Copy link
Contributor

It is a known issue same as #65

@Kliton
Copy link

Kliton commented Oct 7, 2021

So actually the lib isn't working at all for auth, right?

@waybackarchiver
Copy link
Contributor

I only got a successfully auth at the example code (examples/auth/main.go), maybe I missing something.

@Kliton
Copy link

Kliton commented Oct 20, 2021

Solved.
The problem was that i was getting PHONE_MIGRATE_4, so i had to switch to Dc[4] but dc[4] has two different addresses and the code is using the last ip ( because is replacing the ip in the dc list with key 4 ).

Change the code in "NewClient", telegram.Common.go

for _, dc := range config.DcOptions {
		if dc.Cdn {
			continue
		}
		if strings.Con; tains(dc.IpAddress, ":") {
			// ipv6
			continue
		}

		// Prevent replacing ip if one DC has more ips ( in this way i'm preserving the first ip that i have)
		_, ok := dcList[int(dc.ID)]
		if ok {
			continue
		}

		dcList[int(dc.ID)] = dc.IpAddress + ":" + strconv.Itoa(int(dc.Port))
	}

@Kliton
Copy link

Kliton commented Oct 20, 2021

And for the error: panic: (code 4294966892)

I solved as yabibi suggested in issue #65
After PHONE_MIGRATE_X you have restart connection with the dc address pointed out by message PHONE_MIGRATE_X

@waybackarchiver
Copy link
Contributor

ref: #22 (comment)

@libai0610
Copy link

libai0610 commented Nov 23, 2022

And for the error: panic: (code 4294966892)

I solved as yabibi suggested in issue #65 After PHONE_MIGRATE_X you have restart connection with the dc address pointed out by message PHONE_MIGRATE_X

I have do the change :

for _, dc := range config.DcOptions {
if dc.Cdn {
continue
}
if strings.Con; tains(dc.IpAddress, ":") {
// ipv6
continue
}

	// Prevent replacing ip if one DC has more ips ( in this way i'm preserving the first ip that i have)
	_, ok := dcList[int(dc.ID)]
	if ok {
		continue
	}

	dcList[int(dc.ID)] = dc.IpAddress + ":" + strconv.Itoa(int(dc.Port))
}

Then I got panic: (code 4294966892)
github.com/xelaj/mtproto.check(...)

How to resove it ? Could you help me, and show the detail? @Kliton

@quenbyako
Copy link
Member

This is soooooo sucks that i developed this project and i completely lost a context about all issues....

Fuck, i need to make pipelines for problem solving...

@libai0610 sorry that current community can't help you on right level, i'll try to look what's the problem and maybe come back to you, sorry for super low support level.

@libai0610
Copy link

Thank you very much. I believe it will be better and better with everyone's efforts. @quenbyako

@Robtzz
Copy link

Robtzz commented Nov 17, 2023

I only got a successfully auth at the example code (examples/auth/main.go), maybe I missing something. main.go), maybe I'm missing something.

I can't even succeed with an example

@Robtzz
Copy link

Robtzz commented Nov 19, 2023

And for the error: panic: (code 4294966892)对于错误:panic:(代码4294966892)

I solved as yabibi suggested in issue #65 I solved it as yabibi suggested in issue #65 After you have restart connection with the dc address pointed out by message 'PHONE_MIGRATE_X' 'PHONE_MIGRATE_X' restart with message ' PHONE_MIGRATE_X PHONE_MIGRATE_X indicates the DC address after the connection

Brother, I need your help too

@Robtzz
Copy link

Robtzz commented Nov 19, 2023

And for the error: panic: (code 4294966892)对于错误:panic:(代码4294966892)
I solved as yabibi suggested in issue #65 After you have restart connection with the dc address pointed out by message PHONE_MIGRATE_X``PHONE_MIGRATE_X我按照 yabibi 在问题 #65 中的建议解决了,在您重新启动与消息 PHONE_MIGRATE_X PHONE_MIGRATE_X 指出的 dc 地址的连接后

I have do the change :我已经做了改变:

for _, dc := range config.DcOptions {对于 _,DC := 范围配置。DcOptions { if dc.Cdn { 如果 dc.Cdn { continue 继续 } if strings.Con; tains(dc.IpAddress, ":") {if 字符串。缺点;tains(dc.IpAddress, “:”) { // ipv6 IPv6协议 continue 继续 }

	 Prevent replacing ip if one DC has more ips ( in this way i'm preserving the first ip that i have)
	_, ok := dcList[int(dc.ID)]
	if ok {
		continue
	}

	dcList[int(dc.ID)] = dc.IpAddress + ":" + strconv. Itoa(int(dc.Port))
}

Then I got panic: (code 4294966892) github.com/xelaj/mtproto.check (...4294966892) github.com/xelaj/mtproto.check(... )

How to resove it ? Could you help me, and show the detail? How to recover it? Can you help me and show the details? @Kliton

Did you finally deal with him?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants