Add VLESS-H3-Caddy two modes

This commit is contained in:
yuhan6665 2024-10-17 04:54:23 -04:00
parent 2fe711231a
commit bebf51e5f7
9 changed files with 311 additions and 0 deletions

View file

@ -1,6 +1,10 @@
xx.com {
log {
level DEBUG
}
root * /var/www
file_server
tls CA.crt priv.key # 换成你的证书和私钥,绝对路径
reverse_proxy /path 127.0.0.1:2001 {
transport http {

View file

@ -0,0 +1,17 @@
xx.com {
log {
level DEBUG
}
root * /var/www
file_server
tls CA.crt priv.key # 换成你的证书和私钥,绝对路径
reverse_proxy /path 127.0.0.1:2001 {
transport http {
tls
tls_client_auth CA.crt priv.key # 换成你的证书和私钥,绝对路径
tls_server_name xx.com
versions 3
}
}
}

View file

@ -0,0 +1,7 @@
# 原理图:
Xray client <--- H3 ---> Caddy2 <--- H3 ---> Xray server
注意:
由于 H3 没有解密的明文传输标准 这种模式 Caddy 解密流量之后 会重新加密 会增加少许延迟和负载
目前仅 Caddy2 的 v2.9.0-beta.2 版及以后完美支持 Xray 的 H3 入站。

View file

@ -0,0 +1,73 @@
{
"log":{},
"inbounds":[
{
"port":"1080",
"protocol":"socks",
"settings":{
"auth":"noauth",
"udp":true
}
},
{
"port":"1081",
"protocol":"http",
"settings":{}
}
],
"outbounds":[
{
"protocol":"vless",
"settings":{
"vnext":[
{
"address":"xx.com",
"port":443,
"users":[
{
"id":"",
"encryption":"none"
}
]
}
]
},
"streamSettings":{
"network":"http",
"security":"tls",
"httpSettings":{
"host":[
"xx.com"
],
"path":"/path"
}
},
"tlsSettings":{
"alpn":["h3"],
"serverName":"xx.com"
}
},
{
"tag":"direct",
"protocol":"freedom",
"settings":{}
},
{
"tag":"blocked",
"protocol":"blackhole",
"settings":{}
}
],
"routing":{
"domainStrategy":"IPOnDemand",
"rules":[
{
"type":"field",
"ip":[
"geoip:private"
],
"outboundTag":"direct"
}
]
}
}

View file

@ -0,0 +1,66 @@
{
"log": {
"loglevel": "warning"
},
"inbounds": [
{
"port": 2001,
"listen": "127.0.0.1",
"protocol": "vless",
"settings": {
"clients": [
{
"id": "",
"email": "love@example.com"
}
],
"decryption": "none"
},
"streamSettings": {
"security": "tls",
"network": "http",
"httpSettings": {
"path": "/path",
"host": [
"xx.com"
]
},
"tlsSettings": {
// "rejectUnknownSni": true,
"minVersion": "1.3",
"alpn": ["h3"],
"certificates": [
{
"certificateFile": "CA.crt", //
"keyFile": "priv.key" //
}
]
}
}
}
],
"outbounds": [
{
"tag": "direct",
"protocol": "freedom",
"settings": {}
},
{
"tag": "blocked",
"protocol": "blackhole",
"settings": {}
}
],
"routing": {
"domainStrategy": "AsIs",
"rules": [
{
"type": "field",
"ip": [
"geoip:private"
],
"outboundTag": "blocked"
}
]
}
}

View file

@ -0,0 +1,11 @@
xx.com {
log {
level DEBUG
}
root * /var/www
file_server
tls CA.crt priv.key # 换成你的证书和私钥,绝对路径
reverse_proxy /path h2c://127.0.0.1:2001 {
}
}

View file

@ -0,0 +1,5 @@
# 原理图:
Xray client <--- H3 ---> Caddy2 <--- H2C ---> Xray server
注意:
目前仅 Caddy2 的 v2.9.0-beta.2 版及以后完美支持 H3 转换 H2C 对接 Xray 的 H2C 入站。

View file

@ -0,0 +1,73 @@
{
"log":{},
"inbounds":[
{
"port":"1080",
"protocol":"socks",
"settings":{
"auth":"noauth",
"udp":true
}
},
{
"port":"1081",
"protocol":"http",
"settings":{}
}
],
"outbounds":[
{
"protocol":"vless",
"settings":{
"vnext":[
{
"address":"xx.com",
"port":443,
"users":[
{
"id":"",
"encryption":"none"
}
]
}
]
},
"streamSettings":{
"network":"http",
"security":"tls",
"httpSettings":{
"host":[
"xx.com"
],
"path":"/path"
},
"tlsSettings":{
"alpn":["h3"],
"serverName":"xx.com"
}
}
},
{
"tag":"direct",
"protocol":"freedom",
"settings":{}
},
{
"tag":"blocked",
"protocol":"blackhole",
"settings":{}
}
],
"routing":{
"domainStrategy":"IPOnDemand",
"rules":[
{
"type":"field",
"ip":[
"geoip:private"
],
"outboundTag":"direct"
}
]
}
}

View file

@ -0,0 +1,55 @@
{
"log": {
"loglevel": "warning"
},
"inbounds": [
{
"port": 2001,
"listen": "127.0.0.1",
"protocol": "vless",
"settings": {
"clients": [
{
"id": "",
"email": "love@example.com"
}
],
"decryption": "none"
},
"streamSettings": {
"security": "none",
"network": "http",
"httpSettings": {
"path": "/path",
"host": [
"xx.com"
]
}
}
}
],
"outbounds": [
{
"tag": "direct",
"protocol": "freedom",
"settings": {}
},
{
"tag": "blocked",
"protocol": "blackhole",
"settings": {}
}
],
"routing": {
"domainStrategy": "AsIs",
"rules": [
{
"type": "field",
"ip": [
"geoip:private"
],
"outboundTag": "blocked"
}
]
}
}