xray 服务端配置

分为 socker 与 port,socket 会相对快些。

xray_server-socket 配置

{
    "log": {
      "loglevel": "warning",
      "error": "/var/log/xray/error.log",
      "access": "/var/log/xray/access.log"
    },
    "inbounds": [
      {
        "port": 443,
        "protocol": "vless",
        "settings": {
          "clients": [
            {
              "id": "yourUUID",
              "flow": "xtls-rprx-direct",
              "email": "443@gmail.com"
            }
          ],
          "decryption": "none",
          "fallbacks": [
            {
              "alpn": "h2",
              "dest": "/dev/shm/h2c.sock",
              "xver": 1
            },
            {
              "dest": "/dev/shm/h1.sock",
              "xver": 1
            },
            {
              "path": "/wsgooutsidewithvmess520",
              "dest": "@vless-ws",
              "xver": 1
            }
          ]
        },
        "streamSettings": {
          "network": "tcp",
          "security": "xtls",
          "xtlsSettings": {
            "alpn":[
              "h2",
              "http/1.1"
            ],
            "minVersion": "1.3",
            "cipherSuites": "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256",
            "certificates": [
              {
                "ocspStapling": 3600,
                "certificateFile": "/usr/local/etc/ssl/6649371_api.echoxu.cn.pem",
                "keyFile": "/usr/local/etc/ssl/6649371_api.echoxu.cn.key"
              }
            ]
          }
        },
        "sniffing": {
          "enabled": true,
          "destOverride": [
            "http",
            "tls"
          ]
        }
      },
      {
        "listen": "@vless-ws",
        "protocol": "vless",
        "settings": {
          "clients": [
            {
              "id": "yourUUID",
              "email": "2001@gmail.com"
            }
          ],
          "decryption": "none"
        },
        "streamSettings": {
          "network": "ws",
          "security": "none",
          "wsSettings": {
            "acceptProxyProtocol": true,
            "path": "/wsgooutsidewithvmess520"
          }
        },
        "sniffing": {
          "enabled": true,
          "destOverride": [
            "http",
            "tls"
          ]
        }
      }
    ],
    "routing": {
        "domainStrategy": "IPIfNonMatch",
        "rules": [
            {
                "type": "field",
                "domain": [
                    "geosite:category-ads-all"
                ],
                "outboundTag": "blocked"
            },
            {
                "type": "field",
                "ip": [
                    "geoip:private"
                ],
                "outboundTag": "blocked"
            }
        ]
    },
    "outbounds": [
      {
        "protocol": "freedom",
        "settings": {}
      },
      {
        "tag": "blocked",
        "protocol": "blackhole",
        "settings": {}
      }
    ]
  }
  

xray_server-port 配置

{
    "log": {
        "access": "/var/log/xray/access.log",
        "error": "/var/log/xray/error.log",
        "loglevel": "warning"
    },
    "dns": {
        "servers": [
            "https+local://1.1.1.1/dns-query",
            "localhost"
        ],
        "queryStrategy": "UseIPv4"
    },
    "routing": {
        "domainStrategy": "IPIfNonMatch",
        "rules": [
            {
                "type": "field",
                "domain": [
                    "geosite:category-ads-all"
                ],
                "outboundTag": "block"
            },
            {
                "type": "field",
                "ip": [
                    "geoip:cn",
                    "geoip:private"
                ],
                "outboundTag": "block"
            }
        ]
    },
    "inbounds": [
        {
            "port": 443,
            "protocol": "vless",
            "settings": {
                "clients": [
                    {
                        "id": "yourUUID",
                        "flow": "xtls-rprx-direct",
                        "email": "443@gmail.com"
                    }
                ],
                "decryption": "none",
                "fallbacks": [
                    {
                        "alpn": "h2",
                        "dest": "8002",
                        "xver": 1
                    },
                    {
                        "dest": "8001",
                        "xver": 1
                    },
                    {
                        "path": "/wsgooutsidewithvmess520",
                        "dest": 2001,
                        "xver": 1
                    }
                ]
            },
            "streamSettings": {
                "network": "tcp",
                "security": "xtls",
                "xtlsSettings": {
                    "alpn":[
                        "h2",
                        "http/1.1"
                    ],
                    "minVersion": "1.3",
                    "cipherSuites": "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256",
                    "certificates": [
                        {
                            "ocspStapling": 3600,
                            "certificateFile": "/usr/local/etc/ssl/6649371_api.echoxu.cn.pem",
                            "keyFile": "/usr/local/etc/ssl/6649371_api.echoxu.cn.key"
                        }
                    ]
                }
            },
            "sniffing": {
                "enabled": true,
                "destOverride": [
                  "http",
                  "tls"
                ]
            }
        },
        {
            "listen": "127.0.0.1",
            "port": 2001,
            "protocol": "vless",
            "settings": {
              "clients": [
                {
                  "id": "yourUUID",
                  "email": "2001@gmail.com"
                }
              ],
              "decryption": "none"
            },
            "streamSettings": {
              "network": "ws",
              "security": "none",
              "wsSettings": {
                "acceptProxyProtocol": true,
                "path": "/wsgooutsidewithvmess520"
              }
            },
            "sniffing": {
              "enabled": true,
              "destOverride": [
                "http",
                "tls"
              ]
            }
        }
    ],
    "outbounds": [
        {
            "protocol": "freedom",
            "settings": {},
            "tag": "direct"
        },
        {
            "protocol": "blackhole",
            "settings": {},
            "tag": "block"
        }
    ]
}
上次更新:
贡献者: iEchoxu