Skip to content

Instantly share code, notes, and snippets.

@ihciah ihciah/README.MD
Last active Nov 22, 2019

Embed
What would you like to do?
V2ray MTProto through Shadowsocks

V2ray MTProto through Shadowsocks

Why use it

The MTProto is easy to block; shadowsocks is hard to identify but cannot work without a client.

You can deylop this docker image to run a relay inside the firewall (China/Russia etc.), it provide a MTProto and all the packets will be sent through shadowsocks protocol.

How to run

Modify the v2ray.conf, change the port, secret, and the other 4 settings in servers for shadowsocks configure.

Then put these 2 files in a folder and run docker-compose up -d.

Other info

It is based on V2ray. Also, I wrote some similar programs: inner-shadowsocks, shadowsocks-with-socks-auth to provide a Socks5 through shadowsocks. But for telegram, they are not recommended, because the Socks5 credential is transported in plain.

UPDATE: I add a pre-connection pool to the original v2ray in a ugly way, but it works. It can reduce a lot of "Connecting" time.

version: "3"
services:
v2ray:
image: ihciah/v2ray
container_name: v2ray
restart: always
command: v2ray -config=/etc/v2ray/config.json
network_mode: "host"
volumes:
- ./v2ray.conf:/etc/v2ray/config.json
{
"inbounds": [
{
"port": 12345,
"protocol": "mtproto",
"settings": {
"users": [
{
"secret": "YOURTGMTPROTOSECRET"
}
]
},
"tag": "tg-in"
}
],
"outbounds": [
{
"protocol": "shadowsocks",
"settings": {
"servers": [
{
"address": "SSSERVER",
"method": "SSMETHOD",
"password": "SSPASSWORD",
"port": SSPORT
}
]
},
"tag": "OUTSIDE"
},
{
"protocol": "mtproto",
"proxySettings": {
"tag": "OUTSIDE"
},
"settings": {},
"tag": "tg-out"
}
],
"routing": {
"rules": [
{
"inboundTag": [
"tg-in"
],
"outboundTag": "tg-out",
"type": "field"
}
]
}
}
@ihciah

This comment has been minimized.

Copy link
Owner Author

ihciah commented Jun 1, 2019

Known problem: The v2ray does not have a connection pool or some mechanisms like pre-connect, which will cause the "Connecting" status lasts for very long time.

@ihciah

This comment has been minimized.

Copy link
Owner Author

ihciah commented Jun 2, 2019

Pre-connection pool is implemented in an ugly way.
It is not well-implemented, for example, it does not check the connection status in pool, which will cause slow connection.
It only works in this case. If you use v2ray for other proxy, the modified version may not work.

@dimqua

This comment has been minimized.

Copy link

dimqua commented Nov 22, 2019

run a relay inside the firewall (China/Russia etc.), it provide a MTProto

In case of Russia, this configuration will not work for a long time. Because of even Russia-hosted MTProxies could be blocked by the government. That means you have to run V2Ray on the client (or in your own local network, for example).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.