V2Ray多协议共存
-update
想折腾的朋友,"效率成瘾患者",想测试一下多种不同模式之间的速度差别吗?不需要去不断地运行脚本切换配置了。修改V2ray配置文件多开几个模式就是了。
如果要测试不经过Caddy的不同协议,把v2ray的inbound里多配置几条入站。
如果要测试不同协议的ws+tls的模式,让Caddyfile多几条分流的设置,反代到v2ray的不同端口,再在v2ray的不同端口上设置不同的协议。
示例:
V2ray 的 config.json
{
"log": {
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log",
"loglevel": "warning"
},
"inbounds": [
{ // VLESS + WebSocket + TLS
"listen": "localhost",
"port": 32888, // ***VLESS的内部端口
"protocol": "vless", // ***
"settings": {
"clients": [
{
"id": "a85f0d78-9ad0-5fb7-b6fb-c1614b0e4428", // ***VLESS的UUID
"level": 1,
"alterId": 0
}
],
"decryption": "none"
},
"streamSettings": {
"network": "ws" // ***
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
},
{ // Vmess + WebSocket + TLS
"listen": "localhost",
"port": 32889, // ***Vmess的内部端口
"protocol": "vmess", // ***
"settings": {
"clients": [
{
"id": "a85f0d78-9ad0-5fb7-b6fb-c1614b0e4428", // ***Vmess的UUID
"level": 1,
"alterId": 0
}
],
"decryption": "none"
},
"streamSettings": {
"network": "ws" // ***
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
},
{ // Vmess + TCP
"port": 32890, // ***
"protocol": "vmess", // ***
"settings": {
"clients": [
{
"id": "a85f0d78-9ad0-5fb7-b6fb-c1614b0e4428", // ***
"level": 1,
"alterId": 0
}
],
"decryption": "none"
},
"streamSettings": {
"network": "tcp" // ***
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {
"domainStrategy": "UseIP"
},
"tag": "direct"
},
{
"protocol": "blackhole",
"settings": {},
"tag": "blocked"
},
{
"protocol": "mtproto",
"settings": {},
"tag": "tg-out"
}
],
"dns": {
"servers": [
"https+local://8.8.8.8/dns-query",
"8.8.8.8",
"1.1.1.1",
"localhost"
]
},
"routing": {
"domainStrategy": "IPOnDemand",
"rules": [
{
"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"
],
"outboundTag": "blocked"
},
{
"type": "field",
"inboundTag": ["tg-in"],
"outboundTag": "tg-out"
},
{
"type": "field",
"protocol": [
"bittorrent"
],
"outboundTag": "blocked"
}
]
},
"transport": {
"kcpSettings": {
"uplinkCapacity": 100,
"downlinkCapacity": 100,
"congestion": true
}
}
}
Caddy V2 的配置文件 Caddyfile
cftk.ga{tls Y3JhenlwZWFjZQ@gmail.comencode gziphandle_path /c1614b0e4428 { # ***VLESS的path参数reverse_proxy localhost:32888 # ***VLESS的内部端口}handle_path /c1614b0e4429 { # ***Vmess的path参数reverse_proxy localhost:32889 # ***Vmess的内部端口}handle {reverse_proxy https://zelikk.blogspot.com {header_up Host {upstream_hostport}header_up X-Forwarded-Host {host}}}}
Caddy V1 的配置文件可以参考这里的思路:【多域名+多路径的v2ray多用户使用方案】
===================
update
Caddy V2.5.0
你的域名 # 改这里{tls Y3JhenlwZWFjZQ@gmail.comencode gziphandle_path /分流path { # 改这里reverse_proxy localhost:你的v2ray内部端口 # 改这里}handle {reverse_proxy https://你反代伪装的网站 { # 改这里trusted_proxies 0.0.0.0/0header_up Host {upstream_hostport}}}}
评论
发表评论