mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 09:39:10 +08:00
Protocols: force the current subscription domain to be a direct rule
This commit is contained in:
parent
91c7dfc0ed
commit
c0c84efb7c
@ -54,6 +54,11 @@ class Clash
|
||||
if (!is_array($config['proxy-groups'][$k]['proxies'])) continue;
|
||||
$config['proxy-groups'][$k]['proxies'] = array_merge($config['proxy-groups'][$k]['proxies'], $proxies);
|
||||
}
|
||||
// Force the current subscription domain to be a direct rule
|
||||
$subsDomain = $_SERVER['SERVER_NAME'];
|
||||
$subsDomainRule = "DOMAIN,{$subsDomain},DIRECT";
|
||||
array_unshift($config['rules'], $subsDomainRule);
|
||||
|
||||
$yaml = Yaml::dump($config);
|
||||
$yaml = str_replace('$app_name', config('v2board.app_name', 'V2Board'), $yaml);
|
||||
return $yaml;
|
||||
|
@ -54,8 +54,10 @@ class Surfboard
|
||||
|
||||
// Subscription link
|
||||
$subsURL = config('v2board.subscribe_url', config('v2board.app_url', env('APP_URL'))) . '/api/v1/client/subscribe?token=' . $user['token'];
|
||||
$subsDomain = $_SERVER['SERVER_NAME'];
|
||||
|
||||
$config = str_replace('$subs_link', $subsURL, $config);
|
||||
$config = str_replace('$subs_domain', $subsDomain, $config);
|
||||
$config = str_replace('$proxies', $proxies, $config);
|
||||
$config = str_replace('$proxy_group', rtrim($proxyGroup, ', '), $config);
|
||||
return $config;
|
||||
|
@ -53,8 +53,10 @@ class Surge
|
||||
|
||||
// Subscription link
|
||||
$subsURL = config('v2board.subscribe_url', config('v2board.app_url', env('APP_URL'))) . '/api/v1/client/subscribe?token=' . $user['token'];
|
||||
$subsDomain = $_SERVER['SERVER_NAME'];
|
||||
|
||||
$config = str_replace('$subs_link', $subsURL, $config);
|
||||
$config = str_replace('$subs_domain', $subsDomain, $config);
|
||||
$config = str_replace('$proxies', $proxies, $config);
|
||||
$config = str_replace('$proxy_group', rtrim($proxyGroup, ', '), $config);
|
||||
return $config;
|
||||
|
@ -31,6 +31,9 @@ DOMAIN-SUFFIX,naver.com,Proxy
|
||||
DOMAIN-SUFFIX,smartmediarep.com,Proxy
|
||||
DOMAIN-SUFFIX,technews.tw,Proxy
|
||||
|
||||
# 强制订阅域名直连
|
||||
DOMAIN,$subs_domain,DIRECT
|
||||
|
||||
# 实用规则片段集
|
||||
# RULE-SET,https://cdn.jsdelivr.net/gh/Hackl0us/SS-Rule-Snippet@master/Rulesets/Surge/Basic/Apple-News.list,Proxy
|
||||
RULE-SET,https://cdn.jsdelivr.net/gh/Hackl0us/SS-Rule-Snippet@master/Rulesets/Surge/Basic/Apple-proxy.list,Proxy
|
||||
|
@ -27,6 +27,7 @@ ipv6 = true
|
||||
|
||||
test-timeout = 4
|
||||
proxy-test-url = http://www.gstatic.com/generate_204
|
||||
geoip-maxmind-url = https://cdn.jsdelivr.net/gh/Hackl0us/GeoIP2-CN@release/Country.mmdb
|
||||
|
||||
[Replica]
|
||||
hide-apple-request = true
|
||||
@ -55,6 +56,9 @@ fallback = fallback, $proxy_group, url=http://www.gstatic.com/generate_204, inte
|
||||
# 自定义规则
|
||||
## 您可以在此处插入自定义规则
|
||||
|
||||
# 强制订阅域名直连
|
||||
DOMAIN,$subs_domain,DIRECT
|
||||
|
||||
# 实用规则片段集
|
||||
# RULE-SET,https://cdn.jsdelivr.net/gh/Hackl0us/SS-Rule-Snippet@master/Rulesets/Surge/Basic/Apple-News.list,Proxy
|
||||
RULE-SET,https://cdn.jsdelivr.net/gh/Hackl0us/SS-Rule-Snippet@master/Rulesets/Surge/Basic/Apple-proxy.list,Proxy
|
||||
|
Loading…
Reference in New Issue
Block a user