VPS是双栈,有IPV6和IPV4,经检测发现IPV4是没有送中,IPV6是送中的。送中后观看youtube就会没有广告,一部分人会比较喜欢。有些设备是默认IPV4优先的,这样就不能使用IPV6和Youtube连接,从而达到无广告的效果。
检测IP有没有送中:
curl -4 -s "https://www.google.com/search?q=1" curl -6 -s "https://www.google.com/search?q=1" # 对ipv4和ipv6分别进行检测,返回一大堆代码说明没有送中,返回有302、www.google.com.hk等说明已经送中。
经过一番研究,成功实现了观看Youtube无广告,无关客户端是哪个协议优先。Youtube只走送中的ipv6。本例中还含有中转其他服务器的配置。
服务端配置如下:
// 1、建立一个专门的outband用于youtube出站,这里为 onlyipv6,里面要配置domain_resolver ,只解析ipv6
// 2、建立路由规则,1个规则屏蔽ipv4对youtube的出站,实际没有用,还是走了direct。singbox本身不支持出站只走ipv6
// 另1个规则指定youtube规则集走专门的 onlyipv6 出站,也就是对youtube集合里的域名只解析ipv6,服务端会对youtube发起ipv6请求
{
"log": {
"disabled": false,
"level": "warn",
"timestamp": true
},
"dns": {
"servers": [
{
"type": "local",
"tag": "defaultdns",
"detour": "directout"
}
],
"final": "defaultdns",
"strategy": "prefer_ipv4"
},
"inbounds": [
{
"type": "shadowsocks",
"tag": "ss-in",
"listen": "::",
"listen_port": 1222,
"tcp_fast_open": true,
"method": "2022-blake3-aes-128-gcm",
"password": "your password",
"multiplex": {
"enabled": true,
"padding": true, //开multiplex就必须开启,否则测速有问题
"brutal": {
"enabled": false,
"up_mbps": 1000,
"down_mbps": 1000
}
}
},
{
"type": "shadowsocks",
"tag": "ss-zz-in",
"listen": "::",
"listen_port": 2111,
"tcp_fast_open": true,
"method": "2022-blake3-aes-128-gcm",
"password": "your password",
"multiplex": {
"enabled": true,
"padding": true,
"brutal": {
"enabled": false,
"up_mbps": 1000,
"down_mbps": 1000
}
}
}
],
"outbounds": [
{
"type": "direct",
"tag": "directout",
"routing_mark": 100
},
{
"type": "direct",
"tag": "onlyipv6",
"domain_resolver": { //覆盖default_domain_resolver的ipv4优先
"server": "defaultdns",
"strategy": "ipv6_only",
"disable_cache": false
},
"routing_mark": 100
},
{
"type": "shadowsocks",
"tag": "ss_upstream",
"server": "1.2.3.4",
"server_port": 9527,
"method": "2022-blake3-aes-128-gcm",
"password": "your password"
}
],
"route": {
"rules": [
{
"action": "sniff"
},
{
"protocol": [
"bittorrent",
"quic"
],
"action": "reject",
"method": "default"
},
{
"protocol": "dns",
"action": "hijack-dns"
},
{
"inbound": [
"ss-zz-in"
],
"outbound": "ss_upstream"
},
{
// 规则对ipv4出站就屏蔽,实际并没有用,
"ip_version": 4,
"rule_set": [
"geosite_youtube"
],
"outbound": "block"
},
{
// 让youtube规则集合 走只能解析ipv6的出站
"rule_set": [
"geosite_youtube"
],
"outbound": "onlyipv6"
}
],
"rule_set": [
{
"tag": "geosite_youtube",
"type": "remote",
"format": "source",
"url": "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/refs/heads/sing/geo/geosite/youtube.json",
"download_detour": "directout",
"update_interval": "5d"
}
],
"default_domain_resolver": {
"server": "defaultdns",
"strategy": "prefer_ipv4"
}
}
}实际测试下来,访问www.google.com,左下角提示地区为美国,没有跳转到 www.google.com.hk ;访问 www.youtube.com/red 提示 YouTube Premium 在你所在的国家/地区尚未推出 。
技术不断升级,请注意文章时效性。
本站文章,欢迎转发。转载请注明出处:https://www.bandwh.com/net/2479.html
