Skip to content

Instantly share code, notes, and snippets.

@jimmylu2333
Last active November 5, 2023 15:01
Show Gist options
  • Save jimmylu2333/bf2252ade4d4ecd901e27bdee2015ad5 to your computer and use it in GitHub Desktop.
Save jimmylu2333/bf2252ade4d4ecd901e27bdee2015ad5 to your computer and use it in GitHub Desktop.
v2ray配置文件 - v2ray client configuration
{
"policy" : {
"levels": {
"0": {
"handshake": 4,
"connIdle": 300,
"uplinkOnly": 300,
"downlinkOnly": 300
}
}
},
"dns": {
"hosts": {},
"servers": [
"223.5.5.5",
"114.114.114.114",
"8.8.8.8",
"8.8.4.4",
"localhost"
]
},
"outboundDetour" : [
{
"protocol" : "freedom",
"tag" : "direct",
"settings" : {}
},
{
"protocol": "blackhole",
"settings": {},
"tag": "block"
}
],
"inboundDetour": [
{
"protocol": "dokodemo-door",
"port": 10000,
"settings": {
"address": "000.000.000.000",
"port": 10000,
"network": "tcp,udp"
}
}
],
"inbound" : {
"listen" : "127.0.0.1",
"port" : 1086,
"protocol" : "socks",
"settings" : {
"auth" : "noauth",
"udp" : false,
"ip" : "127.0.0.1"
}
},
"log" : {
"error" : "/var/log/v2ray/error.log",
"loglevel" : "warning",
"access" : "/var/log/v2ray/access.log"
},
"routing" : {
"strategy" : "rules",
"settings" : {
"domainStrategy" : "IPIfNonMatch",
"rules" : [
{
"port" : "1-52",
"type" : "field",
"outboundTag" : "direct"
},
{
"domain": [
"tanx.com"
],
"type": "field",
"outboundTag": "block"
},
{
"port" : "54-79",
"type" : "field",
"outboundTag" : "direct"
},
{
"port" : "81-442",
"type" : "field",
"outboundTag" : "direct"
},
{
"port" : "444-65535",
"type" : "field",
"outboundTag" : "direct"
},
{
"type" : "field",
"ip" : [
"0.0.0.0\/8",
"10.0.0.0\/8",
"100.64.0.0\/10",
"127.0.0.0\/8",
"169.254.0.0\/16",
"172.16.0.0\/12",
"192.0.0.0\/24",
"192.0.2.0\/24",
"192.168.0.0\/16",
"198.18.0.0\/15",
"198.51.100.0\/24",
"203.0.113.0\/24",
"::1\/128",
"fc00::\/7",
"fe80::\/10",
"geoip:cn"
],
"outboundTag" : "direct"
},
{
"type": "chinasites",
"outboundTag": "direct"
}
]
}
},
"outbound" : {
"protocol" : "vmess",
"mux": {
"enabled": false
},
"settings" : {
"vnext" : [
{
"address" : "000.000.000.000",
"port" : 00000,
"users" : [
{
"id" : "3cfb2db1-7161-44d5-998c-e20d5b30544c",
"alterId" : 64,
"security" : "auto",
"level" : 0
}
],
"remark" : "do"
}
]
},
"streamSettings" : {
"network" : "kcp",
"kcpSettings" : {
"header" : {
"type" : "none"
},
"mtu" : 1350,
"congestion" : false,
"tti" : 20,
"uplinkCapacity" : 10,
"writeBufferSize" : 1,
"readBufferSize" : 1,
"downlinkCapacity" : 100
}
}
}
}
@jimmylu2333
Copy link
Author

jimmylu2333 commented Mar 12, 2018

说明文件

这是Linux客户端的配置文件。是我当前正在用的。使用方法是将这个配置文件替换/etc/v2ray/config.json 里面的内容即可。当然,在这之前有几个项需要改。

  1. 服务器的ip地址,在outbound里面。
  2. 服务器的ip地址,在outboundDetour里。
  3. 服务器的端口,在outbound里面
  4. uuid,在outbound里面

该配置文件可以使用的功能有。

  1. 私有地址不走代理。主要是通过routing里的 ip 段实现。
  2. 国内域名和国内域名相关的ip地址直接连接,不使用代理。国内的ip地址通过routing中的 geoip:cn 和 chinaip 这两项实现。
    国内的域名通过 chinasites这项实现。如果域名不在chinasites这个特殊变量里面。则使用dns块的设置进行dns解析得到ip地址后
    通过geoip:cn进行匹配,符合国内ip特征则直接连接不走代理。
  3. 速度测试。用于iperf的,端口是10000.参考官方速度测试部分的文章。
  4. 本地监听端口 1086(socks5)。因为 v2ray 的 http 代理我在测试过程中存在一个问题。现象是 curl www.google.com 的时候总会卡住,用 privoxy 提供 http 代理,然后转发到 socks5的1086端口就不会,所以这里我只配置了 socks 代理。
  5. mkcp支持。这里面我限制了最高上传10MBytes每秒。
  6. 请参考我的服务器端配置文件。确保服务器端和客户端配置一致。传送门

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment