mirror of
				https://github.com/v2fly/v2ray-examples.git
				synced 2025-11-04 11:55:38 +08:00 
			
		
		
		
	adjust vless-h2c-caddy2
This commit is contained in:
		
							
								
								
									
										10
									
								
								VLESS-H2C-Caddy2/Caddyfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								VLESS-H2C-Caddy2/Caddyfile
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
xx.com {
 | 
			
		||||
    root * /var/www
 | 
			
		||||
    file_server
 | 
			
		||||
    
 | 
			
		||||
    reverse_proxy /path 127.0.0.1:2001 {
 | 
			
		||||
        transport http {
 | 
			
		||||
          versions h2c
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										5
									
								
								VLESS-H2C-Caddy2/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								VLESS-H2C-Caddy2/README.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
# 原理图:
 | 
			
		||||
v2ray client <--- H2 ---> caddy2 <--- H2C ---> v2ray server
 | 
			
		||||
 | 
			
		||||
注意:
 | 
			
		||||
目前仅 caddy2 的 v2.2.0-rc.1 版及以后完美支持 v2ray 的 H2C,实现 H2(HTTP/2)应用。
 | 
			
		||||
							
								
								
									
										68
									
								
								VLESS-H2C-Caddy2/client.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								VLESS-H2C-Caddy2/client.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,68 @@
 | 
			
		||||
{
 | 
			
		||||
  "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":""
 | 
			
		||||
              }
 | 
			
		||||
            ]
 | 
			
		||||
          }
 | 
			
		||||
        ]
 | 
			
		||||
      },
 | 
			
		||||
      "streamSettings":{
 | 
			
		||||
        "network":"h2",
 | 
			
		||||
        "security":"tls",
 | 
			
		||||
        "httpSettings":{
 | 
			
		||||
          "host":[
 | 
			
		||||
            "xx.com"
 | 
			
		||||
          ],
 | 
			
		||||
          "path":"/path"
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "tag":"direct",
 | 
			
		||||
      "protocol":"freedom",
 | 
			
		||||
      "settings":{}
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "tag":"blocked",
 | 
			
		||||
      "protocol":"blackhole",
 | 
			
		||||
      "settings":{}
 | 
			
		||||
    }
 | 
			
		||||
  ],
 | 
			
		||||
  "routing":{
 | 
			
		||||
    "domainStrategy":"IPOnDemand",
 | 
			
		||||
    "rules":[
 | 
			
		||||
      {
 | 
			
		||||
        "type":"field",
 | 
			
		||||
        "ip":[
 | 
			
		||||
          "geoip:private"
 | 
			
		||||
        ],
 | 
			
		||||
        "outboundTag":"direct"
 | 
			
		||||
      }
 | 
			
		||||
    ]
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										54
									
								
								VLESS-H2C-Caddy2/server.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								VLESS-H2C-Caddy2/server.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,54 @@
 | 
			
		||||
{
 | 
			
		||||
  "log": {
 | 
			
		||||
    "loglevel": "warning"
 | 
			
		||||
  },
 | 
			
		||||
  "inbounds": [
 | 
			
		||||
    {
 | 
			
		||||
      "port": 2001,
 | 
			
		||||
      "listen": "127.0.0.1",
 | 
			
		||||
      "protocol": "vless",
 | 
			
		||||
      "settings": {
 | 
			
		||||
        "clients": [
 | 
			
		||||
          {
 | 
			
		||||
            "id": "",
 | 
			
		||||
            "email": "love@v2fly.org"
 | 
			
		||||
          }
 | 
			
		||||
        ]
 | 
			
		||||
      },
 | 
			
		||||
      "streamSettings": {
 | 
			
		||||
        "security": "none",
 | 
			
		||||
        "network": "h2",
 | 
			
		||||
        "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"
 | 
			
		||||
      }
 | 
			
		||||
    ]
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
		Reference in New Issue
	
	Block a user