A-A+

v2ray 简易配置示例 (服务端+客户端)

2020年01月02日 15:22 学习笔记 暂无评论 阅读 161 views 次

【注意:此文章为博主原创文章!转载需注意,请带原文链接,至少也要是txt格式!】

服务端的配置文件

{
        "log": {
                "access": "C:\\v2ray\\access.log",
                "error": "C:\\v2ray\\error.log",
                "loglevel": "warning"
        },
        "inbounds": [
                {
                        "port": 8080,
                        "protocol": "vmess",
                        "settings": {
                                "clients": [
                                        {
                                                "id": "7dff5061-5252-41f2-846f-3c6e6aee997d",
                                                "level": 1,
                                                "alterId": 233
                                        }
                                ]
                        },
                        "streamSettings": {
                                "network": "tcp"
                        },
                        "sniffing": {
                                "enabled": true,
                                "destOverride": [
                                        "http",
                                        "tls"
                                ]
                        }
                }
                //include_ss
                //include_socks
                //include_mtproto
                //include_in_config
                //
        ],
        "outbounds": [
                {
                        "protocol": "freedom",
                        "settings": {
                                "domainStrategy": "UseIP"
                        },
                        "tag": "direct"
                },
                {
                        "protocol": "blackhole",
                        "settings": {},
                        "tag": "blocked"
        },
                {
                        "protocol": "mtproto",
                        "settings": {},
                        "tag": "tg-out"
                }
                //include_out_config
                //
        ],
        "transport": {
                "kcpSettings": {
            "uplinkCapacity": 100,
            "downlinkCapacity": 100,
            "congestion": true
        },
                "sockopt": {
                        "tcpFastOpen": true
                }
        }
}

如果服务端如上配置,那么客户端则如下配置:

{
  "policy": null,
  "log": {
    "access": "",
    "error": "",
    "loglevel": "warning"
  },
  "inbounds": [
    {
      "tag": "proxy",
      "port": 1080,
      "listen": "127.0.0.1",
      "protocol": "socks",
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ]
      },
      "settings": {
        "auth": "noauth",
        "udp": true,
        "ip": null,
        "address": null,
        "clients": null
      },
      "streamSettings": null
    }
  ],
  "outbounds": [
    {
      "tag": "proxy",
      "protocol": "vmess",
      "settings": {
        "vnext": [
          {
            "address": "172.25.242.164",    //这里要改成你服务端的IP
            "port": 8080,
            "users": [
              {
                "id": "7dff5061-5252-41f2-846f-3c6e6aee997d",
                "alterId": 233,
                "email": "t@t.tt",
                "security": "auto"
              }
            ]
          }
        ],
        "servers": null,
        "response": null
      },
      "streamSettings": {
        "network": "tcp",
        "security": null,
        "tlsSettings": null,
        "tcpSettings": null,
        "kcpSettings": null,
        "wsSettings": null,
        "httpSettings": null,
        "quicSettings": null
      },
      "mux": {
        "enabled": true
      }
    },
    {
      "tag": "direct",
      "protocol": "freedom",
      "settings": {
        "vnext": null,
        "servers": null,
        "response": null
      },
      "streamSettings": null,
      "mux": null
    },
    {
      "tag": "block",
      "protocol": "blackhole",
      "settings": {
        "vnext": null,
        "servers": null,
        "response": {
          "type": "http"
        }
      },
      "streamSettings": null,
      "mux": null
    }
  ],
  "stats": null,
  "api": null,
  "dns": null,
  "routing": {
    "domainStrategy": "IPIfNonMatch",
    "rules": [
      {
        "type": "field",
        "port": null,
        "inboundTag": [
          "api"
        ],
        "outboundTag": "api",
        "ip": null,
        "domain": null
      }
    ]
  }
}

服务端的bat启动脚本:

@echo off
title v2ray启动脚本
color 0a
start "v2ray" "%~dp0\wv2ray.exe"
tasklist /fi "imagename eq wv2ray.exe"
echo.
echo.
echo 程序启动成功!按任意键关闭本窗口
echo.
pause

v2ray服务端的停止bat脚本:

@echo off
title v2ray停止脚本
color 0a
echo.
tasklist|findstr "wv2ray.exe"
echo.
taskkill /f /im wv2ray.exe
pause

布施恩德可便相知重

微信扫一扫打赏

支付宝扫一扫打赏

×

给我留言