mtproto_proxy icon indicating copy to clipboard operation
mtproto_proxy copied to clipboard

wrong proxy link in the log file when listen_ip is set

Open FreedomPrevails opened this issue 5 years ago • 3 comments

I have two IP addresses set on eth0 (x.x.x.x) and eth0:0 (y.y.y.y) I have configured the proxy to listen on eth0:0 : listen_ip => "y.y.y.y" But it in the application.log it prints the proxy link as : https://t.me/proxy?server=x.x.x.x&port=443&secret=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa This link will not work because the proxy is not listening on x.x.x.x

FreedomPrevails avatar Aug 29 '19 04:08 FreedomPrevails

Yeah, unfortunately it's a bit difficult to decide which IP to use in this link: you can't just use listen_ip because it can be some internal NAT ip. So, proxy just uses autodetected default external IP. It can be tweaked to try to connect to IP lookup service via listen_ip, but it's a bit too complex for such a simple thing and doesn't scale well (what if server have hundred of IPs? should we call IP lookup service 100 times?).

So, there is no easy solution. My reasoning was "if you are skilled enough to assign multiple IPs, you will figure out how to craft a proper proxy link for it".

seriyps avatar Aug 29 '19 09:08 seriyps

I understand and as you said there is no perfect solution. but currently it prints a wrong link if listen_ip is set. if a server is behind NAT and it prints the link with internal private IP, the link will not work from outside of internal network, but it is correct and the admin is responsible to correct the link accordingly like any other service behind NAT. For example If you setup Apache behind NAT, it will tell you it is listening on 10.0.0.1:80, it is up to you to do proper port forwarding and etc. see how confusing it would be if it tells you that it is listening on some IP which it is not even listening on, as a network admin I will freak out ! lol Also a server behind NAT is rare nowadays, most servers and VPSes have public IPs. I think it is better to stick to general practice and provide correct information to the user, it is up to user to figure it out if he has a special configuration like NAT or anything else.

FreedomPrevails avatar Aug 29 '19 23:08 FreedomPrevails

Yep, makes sense. I will try to do smth about it.

seriyps avatar Sep 02 '19 12:09 seriyps