chika0801/sing-box-examples

有好心人指点一下1.8版本后rule set的使用方法吗

Closed this issue · 9 comments

elric8 commented

看官网琢磨的但是无法启动

{
"dns": {
"servers": [
{
"tag": "cloudflare",
"address": "https://1.1.1.1/dns-query",
"detour": "direct"
},
{
"tag": "streaming",
"address": "流媒体解锁ip"
}
],
"rules": [
{
"rule_set": [
"geosite-netflix",
"geosite-disney"
"geosite-openai"
],
"server": "streaming"
}
],
"final": "cloudflare",
"strategy": "",
"disable_cache": false,
"disable_expire": false
},
"inbounds": [
{
"type": "hysteria2",
"up_mbps": 200,
"down_mbps": 100,
"listen": "::",
"listen_port": 443,
"users": [
{
"password": "xxx"
}
],
"masquerade": "https://bing.com",
"tls": {
"enabled": true,
"alpn": [
"h3"
],
"certificate_path": "/etc/sing-box/cert/xxx.key",
"key_path": "/etc/sing-box/cert/xxx.key"
}
}
],
"outbounds": [
{
"type": "direct"
}
]
"route": {
"rule_set": [
{
"tag": "geosite-netflix",
"type": "remote",
"format": "binary",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-netflix.srs",
"download_detour": "direct"
},
{
"tag": "geosite-disney",
"type": "remote",
"format": "binary",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-disney.srs",
"download_detour": "direct"
},
{
"tag": "geosite-openai",
"type": "remote",
"format": "binary",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-openai.srs",
"download_detour": "direct"
}
],
"auto_detect_interface": true,
"final": "direct"
},
"experimental": {
"cache_file": {
"enabled": true,
"path": "cache.db",
"cache_id": "mycacheid",
"store_fakeip": true
}
}
}

有没有会的大佬指正一下感谢

你发的JSON有2个语法错误,我用在线网页检查了,这是修改后的,你试一下,要发错误信息再来问

{
"dns": {
"servers": [
{
"tag": "cloudflare",
"address": "https://1.1.1.1/dns-query",
"detour": "direct"
},
{
"tag": "streaming",
"address": "流媒体解锁ip"
}
],
"rules": [
{
"rule_set": [
"geosite-netflix",
"geosite-disney",
"geosite-openai"
],
"server": "streaming"
}
],
"final": "cloudflare",
"strategy": "",
"disable_cache": false,
"disable_expire": false
},
"inbounds": [
{
"type": "hysteria2",
"up_mbps": 200,
"down_mbps": 100,
"listen": "::",
"listen_port": 443,
"users": [
{
"password": "xxx"
}
],
"masquerade": "https://bing.com",
"tls": {
"enabled": true,
"alpn": [
"h3"
],
"certificate_path": "/etc/sing-box/cert/xxx.key",
"key_path": "/etc/sing-box/cert/xxx.key"
}
}
],
"outbounds": [
{
"type": "direct"
}
],
"route": {
"rule_set": [
{
"tag": "geosite-netflix",
"type": "remote",
"format": "binary",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-netflix.srs",
"download_detour": "direct"
},
{
"tag": "geosite-disney",
"type": "remote",
"format": "binary",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-disney.srs",
"download_detour": "direct"
},
{
"tag": "geosite-openai",
"type": "remote",
"format": "binary",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-openai.srs",
"download_detour": "direct"
}
],
"auto_detect_interface": true,
"final": "direct"
},
"experimental": {
"cache_file": {
"enabled": true,
"path": "cache.db",
"cache_id": "mycacheid",
"store_fakeip": true
}
}
}
{
	"dns": {
		"servers": [{
				"tag": "cloudflare",
				"address": "https://1.1.1.1/dns-query",
				"detour": "direct"
			},
			{
				"tag": "streaming",
				"address": "流媒体解锁ip"
			}
		],
		"rules": [{
			"rule_set": [
				"geosite-netflix",
				"geosite-disney",
				"geosite-openai"
			],
			"server": "streaming"
		}],
		"final": "cloudflare",
		"strategy": "",
		"disable_cache": false,
		"disable_expire": false
	},
	"inbounds": [{
		"type": "hysteria2",
		"up_mbps": 200,
		"down_mbps": 100,
		"listen": "::",
		"listen_port": 443,
		"sniff": true,
		"sniff_override_destination": true,
		"users": [{
			"password": "xxx"
		}],
		"masquerade": "https://bing.com",
		"tls": {
			"enabled": true,
			"alpn": [
				"h3"
			],
			"certificate_path": "/etc/sing-box/cert/xxx.key",
			"key_path": "/etc/sing-box/cert/xxx.key"
		}
	}],
	"outbounds": [{
		"type": "direct"
	}],
	"route": {
		"rule_set": [{
				"tag": "geosite-netflix",
				"type": "remote",
				"format": "binary",
				"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-netflix.srs",
				"download_detour": "direct"
			},
			{
				"tag": "geosite-disney",
				"type": "remote",
				"format": "binary",
				"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-disney.srs",
				"download_detour": "direct"
			},
			{
				"tag": "geosite-openai",
				"type": "remote",
				"format": "binary",
				"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-openai.srs",
				"download_detour": "direct"
			}
		],
		"auto_detect_interface": true,
		"final": "direct"
	},
	"experimental": {
		"cache_file": {
			"enabled": true,
			"path": "cache.db",
			"cache_id": "mycacheid",
			"store_fakeip": true
		}
	}
}
elric8 commented

@lin1123 @chika0801 感谢两位大佬,现在上班没电脑,回去就试试,thx!

elric8 commented

@lin1123 @chika0801 两位大佬的配置我都用过
报错:
FATAL[0000] create service: default detour not found: direct
sing-box.service: Main process exited, code=exited, status=1/FAILURE
sing-box.service: Failed with result 'exit-code'.

这里报错。

FATAL[0000] create service: default detour not found: direct

	"auto_detect_interface": true     //注意此处的逗号要删除
	"final": "direct"    //删除这一行
{
"type": "direct"
}

你出站配置第1个,你只写了上面的,你谢谢写tagdirect了,这问题你看作者提示的英文

default detour not found: direct
自己也能猜到的嘛

elric8 commented

@lin1123 @chika0801
可以启动了,感谢大佬,但是又出现了

Jan 15 05:44:26 ip-172-31-44-216 sing-box[12580]: INFO[0000] router: updated default interface eth0, index 2
Jan 15 05:44:36 ip-172-31-44-216 sing-box[12580]: WARN[0010] router: initialize rule-set take too much time to finish!

说是安装需要时间,但是半小时过去了,还是这个界面
我用ipconfig命令,我的vps也就一个网卡

root@ip-172-31-44-216:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 9001
inet 172.31.44.216 netmask 255.255.240.0 broadcast 172.31.47.255
inet6 fe80::96:69ff:fed1:5c67 prefixlen 64 scopeid 0x20
ether 02:96:69:d1:5c:67 txqueuelen 1000 (Ethernet)
RX packets 55733 bytes 5245768 (5.2 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 68190 bytes 17844740 (17.8 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
    inet 127.0.0.1  netmask 255.0.0.0
    inet6 ::1  prefixlen 128  scopeid 0x10<host>
    loop  txqueuelen 1000  (Local Loopback)
    RX packets 86  bytes 8871 (8.8 KB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 86  bytes 8871 (8.8 KB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

网卡应该不会错了吧

"download_detour": "direct"出站没有指定“tag“ 要么加上,要么全删除。

elric8 commented

"download_detour": "direct"出站没有指定“tag“ 要么加上,要么全删除。

搞定了,可以正常运作了感谢大佬