chika0801 / Xray-examples

Xray 配置示例
https://github.com/XTLS/Xray-core
606 stars 107 forks source link

Reality + VLESS (without vision) + Trojan combo with fallbacks #25

Closed meaqese closed 10 months ago

meaqese commented 10 months ago

Hi! I want to configure Xray and combine Reality + VLESS (none flow) (grpc) + Trojan. I've tried make this combo with fallbacks, but its not working with Reality.

chika0801 commented 10 months ago

VLESS + gRPC + TLS, you can replace the VLESS protocol with the Trojan protocol.

I don't think it's necessary to make a configuration that is compatible with both VLESS + gRPC + TLS and Trojan + gRPC + TLS in the form of 2 combinations.

Are you trying to be compatible with both in one configuration? I don't want to think about ways to implement it, I don't think it's necessary, these 2 end up with the same functionality.

meaqese commented 10 months ago

Heh, really, u are right, so now I want to implement only Reality + (Trojan + gRPC). And if its possible, I want to add default Trojan without grpc.

chika0801 commented 10 months ago

trojan protocol you just need to replace a little bit of the content of the

{
    "log": {
        "loglevel": "warning"
    },
    "routing": {
        "domainStrategy": "IPIfNonMatch",
        "rules": [
            {
                "type": "field",
                "port": "443",
                "network": "udp",
                "outboundTag": "block"
            },
            {
                "type": "field",
                "ip": [
                    "geoip:cn",
                    "geoip:private"
                ],
                "outboundTag": "block"
            }
        ]
    },
    "inbounds": [
        {
            "listen": "0.0.0.0",
            "port": 443,
            "protocol": "trojan",
            "settings": {
                "clients": [
                    {
                        "password":"your_password",
                    }
                ],
                "decryption": "none"
            },
            "streamSettings": {
                "network": "grpc",
                "security": "reality",
                "realitySettings": {
                    "dest": "www.lovelive-anime.jp:443", // 目标网站最低标准:国外网站,支持 TLSv1.3、X25519 与 H2,域名非跳转用(主域名可能被用于跳转到 www)
                    "serverNames": [ // 客户端可用的 serverName 列表,暂不支持 * 通配符
                        "www.lovelive-anime.jp" // Chrome - 输入 "dest" 的网址 - F12 - 安全 - F5 - 主要来源(安全),填 证书 SAN 的值
                    ],
                    "privateKey": "2KZ4uouMKgI8nR-LDJNP1_MHisCJOmKGj9jUjZLncVU", // 执行 xray x25519 生成,填 "Private key" 的值
                    "shortIds": [ // 客户端可用的 shortId 列表,可用于区分不同的客户端
                        "6ba85179e30d4fc2" // 0 到 f,长度为 2 的倍数,长度上限为 16,可留空,或执行 openssl rand -hex 8 生成
                    ]
                },
                "grpcSettings": {
                    "serviceName": "lovelive" // gRPC 服务名称
                }
            },
            "sniffing": {
                "enabled": true,
                "destOverride": [
                    "http",
                    "tls",
                    "quic"
                ]
            }
        }
    ],
    "outbounds": [
        {
            "protocol": "freedom",
            "tag": "direct"
        },
        {
            "protocol": "blackhole",
            "tag": "block"
        }
    ]
}
chika0801 commented 10 months ago

https://github.com/XTLS/Xray-examples/tree/main/Trojan-TCP-XTLS

You can find other examples here

meaqese commented 10 months ago

trojan protocol you just need to replace a little bit of the content of the

{
    "log": {
        "loglevel": "warning"
    },
    "routing": {
        "domainStrategy": "IPIfNonMatch",
        "rules": [
            {
                "type": "field",
                "port": "443",
                "network": "udp",
                "outboundTag": "block"
            },
            {
                "type": "field",
                "ip": [
                    "geoip:cn",
                    "geoip:private"
                ],
                "outboundTag": "block"
            }
        ]
    },
    "inbounds": [
        {
            "listen": "0.0.0.0",
            "port": 443,
            "protocol": "trojan",
            "settings": {
                "clients": [
                    {
                        "password":"your_password",
                    }
                ],
                "decryption": "none"
            },
            "streamSettings": {
                "network": "grpc",
                "security": "reality",
                "realitySettings": {
                    "dest": "www.lovelive-anime.jp:443", // 目标网站最低标准:国外网站,支持 TLSv1.3、X25519 与 H2,域名非跳转用(主域名可能被用于跳转到 www)
                    "serverNames": [ // 客户端可用的 serverName 列表,暂不支持 * 通配符
                        "www.lovelive-anime.jp" // Chrome - 输入 "dest" 的网址 - F12 - 安全 - F5 - 主要来源(安全),填 证书 SAN 的值
                    ],
                    "privateKey": "2KZ4uouMKgI8nR-LDJNP1_MHisCJOmKGj9jUjZLncVU", // 执行 xray x25519 生成,填 "Private key" 的值
                    "shortIds": [ // 客户端可用的 shortId 列表,可用于区分不同的客户端
                        "6ba85179e30d4fc2" // 0 到 f,长度为 2 的倍数,长度上限为 16,可留空,或执行 openssl rand -hex 8 生成
                    ]
                },
                "grpcSettings": {
                    "serviceName": "lovelive" // gRPC 服务名称
                }
            },
            "sniffing": {
                "enabled": true,
                "destOverride": [
                    "http",
                    "tls",
                    "quic"
                ]
            }
        }
    ],
    "outbounds": [
        {
            "protocol": "freedom",
            "tag": "direct"
        },
        {
            "protocol": "blackhole",
            "tag": "block"
        }
    ]
}

Thank you very much) But this is not what is needed) I wanted to implement several protocols. Reality, Trojan (gRPC), Trojan (default) using Fallbacks. Each protocol separately.

chika0801 commented 10 months ago

https://github.com/XTLS/Xray-examples/tree/main/All-in-One-fallbacks-Nginx

https://github.com/lxhao61/integrated-examples/tree/main

You want N-in-1, you can parameterise the 2 links above, I never use the N-in-1 configuration myself.

meaqese commented 10 months ago

Thank you)