由于 Xray 本身是一个代理工具,它可以通过配置文件来控制代理行为。在这里,我们可以使用 Xray 的配置文件来实现禁用除了 www.baidu.com 之外的所有 80 和 443 端口。

首先,我们需要在 Xray 的配置文件中添加以下内容:

{
    "inbounds": [
        {
            "port": 1080,
            "protocol": "socks",
            "settings": {
                "auth": "noauth",
                "udp": true
            }
        }
    ],
    "outbounds": [
        {
            "protocol": "vmess",
            "settings": {
                "vnext": [
                    {
                        "address": "your-vps-ip",
                        "port": 443,
                        "users": [
                            {
                                "id": "your-uuid",
                                "alterId": 64
                            }
                        ]
                    }
                ]
            },
            "streamSettings": {
                "network": "tcp",
                "security": "tls",
                "tlsSettings": {
                    "allowInsecure": false,
                    "serverName": "your-domain.com"
                }
            }
        }
    ],
    "routing": {
        "rules": [
            {
                "type": "field",
                "domain": [
                    "domain:baidu.com"
                ],
                "outboundTag": "direct"
            },
            {
                "type": "field",
                "outboundTag": "block",
                "network": "tcp,udp"
            }
        ],
        "strategy": "rules"
    },
    "dns": {
        "servers": [
            "8.8.8.8",
            "8.8.4.4"
        ]
    }
}

在此配置文件中,我们指定了一个入站代理端口(1080),一个出站协议(VMess),以及一个出站服务器地址和 UUID。此外,我们还指定了一个路由规则,该规则允许访问百度域名,但将所有其他流量路由到一个名为“block”的出站标签中。

最后,我们需要在 Xray 启动命令中指定该配置文件:

xray -config /path/to/config.json

这样,Xray 就会根据我们的配置来禁用除了 www.baidu.com 之外的所有 80 和 443 端口

Xray 禁用除了wwwbaiducom 之外所有80 443端口

原文地址: http://www.cveoy.top/t/topic/eCKg 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录