Skip to content

Instantly share code, notes, and snippets.

@yujincheng08
Forked from eycorsican/ss_v2ray_plugin.md
Created June 17, 2019 05:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yujincheng08/d49b0f91737869905e4440399e127b1b to your computer and use it in GitHub Desktop.
Save yujincheng08/d49b0f91737869905e4440399e127b1b to your computer and use it in GitHub Desktop.

Links

Install ss-server: https://github.com/shadowsocks/shadowsocks-libev

Download v2ray-plugin: https://github.com/shadowsocks/v2ray-plugin/releases

Download v2ray: https://github.com/v2ray/v2ray-core/releases

Server side

> ss-server -c server_config.json --plugin v2ray-plugin_linux_amd64 --plugin-opts "server;mode=websocket;path=/;loglevel=info"
> cat server_config.json
{
    "server_port":<server_port>,
    "password":"<password>",
    "timeout":600,
    "method":"chacha20-ietf-poly1305"
}

Client side

> v2ray -config client_config.json
> cat client_config.json
{
    "log": {
        "loglevel": "info"
    },
    "inbounds": [
        {
            "port": 1086,
            "listen": "127.0.0.1",
            "protocol": "socks",
            "settings": {
                "auth": "noauth",
                "udp": true
            }
        }
    ],
    "outbounds": [
        {
            "tag": "protocol_layer",
            "protocol": "shadowsocks",
            "settings": {
                "servers": [
                    {
                        "method": "chacha20-poly1305",
                        "port": <server_port>, // doesn't really matter since we are redirecting traffic in transport_layer
                        "password": "<password>",
                        "address": "<server_address>" // doesn't really matter since we are redirecting traffic in transport_layer
                    }
                ]
            },
            "proxySettings": {
                "tag": "transport_layer"
            }
        },
        {
            "tag": "transport_layer",
            "protocol": "freedom",
            "settings": {
                "redirect": "<server_address>:<server_port>"
            },
            "streamSettings": {
                "wsSettings": {
                    "path": "/"
                },
                "network": "ws",
                "security": "none"
            },
            "mux": {
                "enabled": true
            }
        }
    ],
    "routing": {
        "domainStrategy": "IPIfNonMatch",
        "rule": [
            {
                "type": "field",
                "network": "tcp,udp",
                "outboundTag": "protocol_layer"
            }
        ]
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment