Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请求支持sing-box #252

Closed
ladit opened this issue Jan 11, 2024 · 3 comments
Closed

请求支持sing-box #252

ladit opened this issue Jan 11, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@ladit
Copy link
Contributor

ladit commented Jan 11, 2024

sing-box是一款日益完善的工具,其配置文件是json。一些参考资料:

{
    "dns": {
        "servers": [
            {
                "tag": "dnspod-doh",
                "address": "https://1.12.12.12/dns-query",
                "detour": "direct"
            },
            {
                "tag": "remote",
                "address": "fakeip"
            },
            {
                "tag": "block",
                "address": "rcode://success"
            }
        ],
        "rules": [
            {
                "rule_set": "geosite-category-ads-all",
                "server": "block"
            },
            {
                "outbound": "any",
                "server": "dnspod-doh"
            },
            {
                "query_type": [
                    "A",
                    "AAAA"
                ],
                "server": "remote"
            }
        ],
        "fakeip": {
            "enabled": true,
            "inet4_range": "198.18.0.0/15",
            "inet6_range": "fc00::/18"
        },
        "independent_cache": true
    },
    "inbounds": [
        {
            "type": "tun",
            "inet4_address": "172.19.0.1/30",
            "inet6_address": "fdfe:dcba:9876::1/126",
            "auto_route": true,
            "strict_route": true,
            "sniff": true
        }
    ],
    "outbounds": [
        {
            "type": "direct",
            "tag": "direct",
            "tcp_fast_open": false,
            "tcp_multi_path": true
        },
        {
            "type": "block",
            "tag": "block"
        },
        {
            "type": "dns",
            "tag": "dns"
        },
        {
            "type": "selector",
            "tag": "proxy",
            "outbounds": [
                "auto",
                "{{ getNodeNames(nodeList, undefined, '", "') }}"
            ],
            "interrupt_exist_connections": false
        },
        {
            "type": "urltest",
            "tag": "auto",
            "outbounds": [
                "{{ getNodeNames(nodeList, undefined, '", "') }}"
            ],
            "interrupt_exist_connections": false
        },
        {{ getSingBoxNodes(nodeList) }}
    ],
    "route": {
        "rules": [
            {
                "type": "logical",
                "mode": "or",
                "rules": [
                    {
                        "protocol": "dns"
                    },
                    {
                        "port": 53
                    }
                ],
                "outbound": "dns"
            },
            {
                "ip_is_private": true,
                "outbound": "direct"
            },
            {
                "clash_mode": "Direct",
                "outbound": "direct"
            },
            {
                "clash_mode": "Global",
                "outbound": "proxy"
            },
            {
                "geosite": "geosite-category-ads-all",
                "outbound": "block"
            },
            {
                "type": "logical",
                "mode": "and",
                "rules": [
                    {
                        "rule_set": "geosite-geolocation-!cn",
                        "invert": true
                    },
                    {
                        "rule_set": [
                            "geoip-cn",
                            "geosite-cn"
                        ]
                    }
                ],
                "outbound": "direct"
            }
        ],
        "rule_set": [
            {
                "tag": "geosite-category-ads-all",
                "type": "remote",
                "format": "binary",
                "url": "https://cdn.jsdelivr.net/gh/SagerNet/sing-geosite@rule-set/geosite-category-ads-all.srs"
            },
            {
                "type": "remote",
                "tag": "geosite-geolocation-!cn",
                "format": "binary",
                "url": "https://cdn.jsdelivr.net/gh/SagerNet/sing-geosite@rule-set/geosite-geolocation-!cn.srs"
            },
            {
                "tag": "geosite-cn",
                "type": "remote",
                "format": "binary",
                "url": "https://cdn.jsdelivr.net/gh/SagerNet/sing-geosite@rule-set/geosite-cn.srs"
            },
            {
                "tag": "geoip-cn",
                "type": "remote",
                "format": "binary",
                "url": "https://cdn.jsdelivr.net/gh/SagerNet/sing-geoip@rule-set/geoip-cn.srs"
            }
        ],
        "auto_detect_interface": true
    },
    "experimental": {
        "cache_file": {
            "enabled": true
        },
        "clash_api": {
            "external_controller": "127.0.0.1:9090"
        }
    }
}

其中"{{ getNodeNames(nodeList, undefined, '", "') }}"根据现有文档,应该可转成"node1", "node2", "node3"
{{ getSingBoxNodes(nodeList) }}期望输出这里定义的有效outbound,例如:

{
            "type": "shadowsocks",
            "tag": "node1",
            "server": "",
            "server_port": 1,
            "method": "",
            "password": "",
            "tcp_fast_open": false,
            "tcp_multi_path": true
},
{
            "type": "shadowsocks",
            "tag": "node2",
            "server": "",
            "server_port": 1,
            "method": "",
            "password": "",
            "tcp_fast_open": false,
            "tcp_multi_path": true
}
@WuhanSy
Copy link

WuhanSy commented Jan 25, 2024

+1

@geekdada geekdada added the enhancement New feature or request label Feb 24, 2024
@ladit
Copy link
Contributor Author

ladit commented Apr 14, 2024

created a PR for this issue.

@geekdada
Copy link
Member

geekdada commented May 1, 2024

@geekdada geekdada closed this as completed May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants