TelegramMessenger / MTProxy

5.01k stars 831 forks source link

Map output traffic to different interface #311

Open p1ratrulezzz opened 5 years ago

p1ratrulezzz commented 5 years ago

Hello. Currently we have to use --nat-info 192.168.1.2:11.22.33.44 , where 11.22.33.44 is a output interface's address.

Is it possible, let's say, to set it something like

--nat-info 192.168.1.2:tun0

or

--nat-info eth0:tun0

Main reason is to use VPN network for output requests but keep using input interface of the server for inbound traffic.

Not sure, if MTproto can work in this design

TelegramClient (192.168.1.2, 1.1.1.1)-->(MTProto proxy 2.2.2.2) -->(VPN, 3.3.3.3)-->TelegramServer

I'm not Pro in C++ especially related to all this network stuff and don't understand the full MTproto protocol, so maybe this request is impossible to implement at all

HirbodBehnam commented 5 years ago

Hello One thing that you can do besides a VPN in to use ss-tunnel. But this method is a little different from what you have shown in that diagram: The first server does not have MTProto server on it. I've written a complete guide to set it up here I've also written the diagram that how the traffic will be routed.

Bouki6 commented 5 years ago

Hello. I have the same problem. i want to connect to telegram through vpn but my mt-proxy server be in my local zone. (in order to avoid monitoring and detecting the traffic). @HirbodBehnam solution works but not the way i want. i implemented same scenario with socks. and it works just fine. i wonder is there a way to do the same with mt-proxy?

p1ratrulezzz commented 5 years ago

Hm, no, I wanted an out-of-the-box solution here. To start mtproxy with some parameter like --bind-output=tun0,eth1

so the output traffic will go through the tun0 - if exists, otherwise - through eth1 and etc.

I'm not so good in C++ with networking so this is more like a feature request