计算机 · 2021年12月9日 0

v2ray

v2ray作为代理

官网教程

以docker的方式使用v2ray

docker pull v2fly/v2fly-core

服务器端配置文件:

{
    "inbounds": [
        {
            "port": 12345, // 服务器监听端口
            "protocol": "vmess",
            "settings": {
                "clients": [
                    {
                        "id": "b831381d-6324-4d53-ad4f-8cda48b30811"
                    }
                ]
            }
        }
    ],
    "outbounds": [
        {
            "protocol": "freedom"
        }
    ]
}
docker run -d -it -v ~/etc/v2ray:/etc/v2ray -p 12345:12345  v2fly/v2fly-core:latest

客户端配置文件:

{
    "log": {
        "access": "/etc/v2ray/access.log",
        "error": "/etc/v2ray/error.log",
        "loglevel": "/etc/v2ray/debug"
    },
    "inbounds": [
        {
            "port": 1081, // SOCKS 代理端口,在浏览器中需配置代理并指向这个端口
            "listen": "0.0.0.0",
            "protocol": "socks",
            "settings": {
                "udp": true
            }
        }
    ],
    "outbounds": [
        {
            "protocol": "vmess",
            "settings": {
                "vnext": [
                    {
                        "address": "1.2.3.4", // 服务器地址,请修改为你自己的服务器 ip 或域名
                        "port": 12345, // 服务器端口
                        "users": [
                            {
                                "id": "b831381d-6324-4d53-ad4f-8cda48b30811"
                            }
                        ]
                    }
                ]
            }
        },
        {
            "protocol": "freedom",
            "tag": "direct"
        }
    ],
    "routing": {
        "domainStrategy": "IPOnDemand",
        "rules": [
            {
                "type": "field",
                "ip": [
                    "geoip:private"
                ],
                "outboundTag": "direct"
            }
        ]
    }
}

客户端命令:

docker run -d -v ~/apps/v2ray:/etc/v2ray -p 1081:1081 v2fly/v2fly-core:latest

服务器端、客户端都启动后,配置浏览器使用本地的socks5代理即可。可以考虑使用SwitchyOmega。

v2ray内网穿透

v2ray的进阶选项

1.使用kcp或者quic作传输通道

https://99orange.xyz/2021/09/14/v2raykcp/

貌似udp流量被针对了?试了下kcp怎么试都不成功?还是只能用tcp。

2.动态端口

动态变更每次传输的服务器端口

https://toutyrater.github.io/advanced/dynamicport.html

3.http伪装

https://toutyrater.github.io/advanced/httpfake.html

增加http的请求头和回复来将v2ray流量伪装成为http流量。

这个toutyrater的说明文档写得比较清晰易懂。

其他说明文档:

https://www.v2ray.com/chapter_02/transport/h2.html