在 routeros 中用 container 运行 sing-box
warning:
这篇文章距离上次修改已过348天,其中的内容可能已经有所变动。
先做镜像:
docker pull gzxhwq/sing-box:1.11.14
docker save -o sing-box.tar gzxhwq/sing-box
把 sing-box.tar 文件上传到 routeros 中
配置文件 config.json 如下:
{
"log": {
"level": "error",
"disabled": true
},
"dns": {
"strategy": "ipv4_only",
"servers": [
{
"tag": "cloudflare",
"address": "https://1.1.1.1/dns-query",
"detour": "proxy"
},
{
"tag": "local",
"address": "223.5.5.5",
"detour": "direct"
},
{
"tag": "block",
"address": "rcode://success"
}
],
"rules": [
{
"rule_set": "geosite-cn",
"server": "local",
"disable_cache": true
}
]
},
"inbounds": [
{
"type": "tun",
"tag": "tun-in",
"interface_name": "tun0",
"address": [
"172.19.0.1/30"
],
"auto_route": true,
"strict_route": false,
"sniff": true
}
],
"outbounds": [
{
"type": "hysteria2",
"tag": "proxy",
"server": "VPS 地址",
"server_port": 端口,
"password": "密码",
"obfs": {
"type": "salamander",
"password": "obfs密码"
},
"tls": {
"enabled": true,
"server_name": "VPS 地址",
"insecure": true
}
}
],
"route": {
"auto_detect_interface": true,
"rule_set": [
{
"tag": "geosite-cn",
"type": "local",
"format": "binary",
"path": "./rule-set/geosite-geolocation-cn.srs"
},
{
"tag": "geoip-cn",
"type": "local",
"format": "binary",
"path": "./rule-set/geoip-cn.srs"
}
],
"rules": [
{
"protocol": "dns",
"outbound": "proxy"
},
{
"rule_set": [
"geosite-cn",
"geoip-cn"
],
"action": "direct"
},
{
"outbound": "proxy"
}
]
}
}