's'
This commit is contained in:
parent
fedfec65cf
commit
eb4d4d68b3
499
config.yaml
Normal file
499
config.yaml
Normal file
@ -0,0 +1,499 @@
|
||||
port: 7890
|
||||
socks-port: 7891
|
||||
allow-lan: false
|
||||
mode: rule
|
||||
log-level: info
|
||||
geodata-mode: true
|
||||
geo-auto-update: true
|
||||
geodata-loader: standard
|
||||
geo-update-interval: 24
|
||||
geox-url:
|
||||
geoip: https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.dat
|
||||
geosite: >-
|
||||
https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geosite.dat
|
||||
mmdb: >-
|
||||
https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/country.mmdb
|
||||
asn: >-
|
||||
https://github.com/xishang0128/geoip/releases/download/latest/GeoLite2-ASN.mmdb
|
||||
rule-providers:
|
||||
geolocation-cn:
|
||||
type: http
|
||||
format: mrs
|
||||
behavior: domain
|
||||
url: >-
|
||||
https://gh.sageer.me/https://github.com/MetaCubeX/meta-rules-dat/raw/refs/heads/meta/geo/geosite/geolocation-cn.mrs
|
||||
path: ./ruleset/geolocation-cn.mrs
|
||||
interval: 86400
|
||||
geolocation-!cn:
|
||||
type: http
|
||||
format: mrs
|
||||
behavior: domain
|
||||
url: >-
|
||||
https://gh.sageer.me/https://github.com/MetaCubeX/meta-rules-dat/raw/refs/heads/meta/geo/geosite/geolocation-!cn.mrs
|
||||
path: ./ruleset/geolocation-!cn.mrs
|
||||
interval: 86400
|
||||
private:
|
||||
type: http
|
||||
format: mrs
|
||||
behavior: ipcidr
|
||||
url: >-
|
||||
https://gh.sageer.me/https://github.com/MetaCubeX/meta-rules-dat/raw/refs/heads/meta/geo/geoip/private.mrs
|
||||
path: ./ruleset/private.mrs
|
||||
interval: 86400
|
||||
cn:
|
||||
type: http
|
||||
format: mrs
|
||||
behavior: domain
|
||||
url: >-
|
||||
https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/cn.yaml
|
||||
path: ./ruleset/cn.mrs
|
||||
interval: 86400
|
||||
dns:
|
||||
enable: true
|
||||
ipv6: false
|
||||
respect-rules: true
|
||||
enhanced-mode: fake-ip
|
||||
nameserver:
|
||||
- https://120.53.53.53/dns-query
|
||||
- https://223.5.5.5/dns-query
|
||||
proxy-server-nameserver:
|
||||
- https://120.53.53.53/dns-query
|
||||
- https://223.5.5.5/dns-query
|
||||
nameserver-policy:
|
||||
geosite:cn,private:
|
||||
- https://120.53.53.53/dns-query
|
||||
- https://223.5.5.5/dns-query
|
||||
geosite:geolocation-!cn:
|
||||
- https://dns.cloudflare.com/dns-query
|
||||
- https://dns.google/dns-query
|
||||
proxies:
|
||||
|
||||
# 落地代理
|
||||
- name: proxycheap
|
||||
# 前置代理
|
||||
dialer-proxy: dialer
|
||||
type: socks5
|
||||
server: 23.188.208.5
|
||||
port: 12441
|
||||
username: hack
|
||||
password: xKQhx2naJL
|
||||
|
||||
# type: socks5
|
||||
# server: 192.204.0.72
|
||||
# port: 12324
|
||||
# username: 14acc9ad9e029
|
||||
# password: 65ab9719f5
|
||||
|
||||
# tls: true
|
||||
# fingerprint: xxxx
|
||||
# skip-cert-verify: true
|
||||
# udp: true
|
||||
# ip-version: ipv6
|
||||
|
||||
- name: socks5
|
||||
type: socks5
|
||||
server: 92.112.6.88
|
||||
port: 12324
|
||||
username: 14acc9ad9e029
|
||||
password: 65ab9719f5
|
||||
# tls: true
|
||||
# fingerprint: xxxx
|
||||
# skip-cert-verify: true
|
||||
# udp: true
|
||||
# ip-version: ipv6
|
||||
|
||||
|
||||
- name: "242af835-singbox_hysteria"
|
||||
type: hysteria2
|
||||
server: 107.173.7.226
|
||||
# server: hy2.nomadro.com
|
||||
port: 34814
|
||||
ports: 30000-31000
|
||||
password: 1f28cd23-d223-4eaa-a786-4a010d674cbc
|
||||
sni: hy2.nomadro.com
|
||||
skip-cert-verify: true
|
||||
alpn:
|
||||
- h3
|
||||
up: "1000 Mbps"
|
||||
down: "1000 Mbps"
|
||||
# congestion_control: bbr # 优化带宽利用率
|
||||
- name: hackrobot-singbox_tuic
|
||||
type: tuic
|
||||
server: 107.173.7.226
|
||||
port: 33935
|
||||
ports: 32000-40000
|
||||
uuid: 1f28cd23-d223-4eaa-a786-4a010d674cbc
|
||||
password: 1f28cd23-d223-4eaa-a786-4a010d674cbc
|
||||
|
||||
# 可选优化字段(以下均为官方推荐写法)
|
||||
alpn:
|
||||
- h3
|
||||
udp-relay-mode: native # 原生 UDP 转发模式
|
||||
congestion-controller: bbr # 拥塞控制算法:bbr/cubic/new_reno
|
||||
disable-sni: false # 保留 SNI,用于伪装域名
|
||||
reduce-rtt: true # 启用 0-RTT 握手以降低延迟
|
||||
request-timeout: 8000 # 连接超时时间(毫秒)
|
||||
heartbeat-interval: 10000 # 心跳包间隔(毫秒)
|
||||
tls: true
|
||||
sni: hy2.nomadro.com # 若使用域名证书建议填写
|
||||
skip-cert-verify: true # 测试阶段跳过证书验证
|
||||
fast-open: true # 启用 TCP Fast-Open
|
||||
max-open-streams: 20 # 最大并发流数量
|
||||
max-udp-relay-packet-size: 1500 # 最大 UDP 包大小(字节)
|
||||
udp: true # 启用 UDP 支持
|
||||
- name: "VLESS_Reality_Vision"
|
||||
type: vless
|
||||
server: 107.173.7.226 # 替换为域名
|
||||
port: 21730 # 修改端口为21730
|
||||
uuid: 1f28cd23-d223-4eaa-a786-4a010d674cbc
|
||||
flow: xtls-rprx-vision
|
||||
encryption: none
|
||||
network: tcp
|
||||
|
||||
tls: true
|
||||
servername: hy2.nomadro.com
|
||||
alpn:
|
||||
- h2
|
||||
- http/1.1
|
||||
client-fingerprint: chrome
|
||||
skip-cert-verify: true
|
||||
|
||||
reality-opts:
|
||||
public-key: ppipIkuEvHMBaMMg42C1lsRX_igSZPlDDZDBVY1UdzM
|
||||
short-id: 6ba85179e30d4fc2
|
||||
server-names:
|
||||
- hy2.nomadro.com
|
||||
flow: xtls-rprx-vision
|
||||
|
||||
smux:
|
||||
enabled: false
|
||||
|
||||
- name: "242af835-singbox_hysteria2"
|
||||
type: hysteria2
|
||||
server: 23.94.99.206
|
||||
# server: hy2.nomadro.com
|
||||
port: 32941
|
||||
ports: 30000-31000
|
||||
password: fda6eb84-7b47-473f-abcb-82a5addece55
|
||||
sni: web3.nomadro.com
|
||||
skip-cert-verify: true
|
||||
alpn:
|
||||
- h3
|
||||
up: "1000 Mbps"
|
||||
down: "1000 Mbps"
|
||||
# congestion_control: bbr # 优化带宽利用率
|
||||
- name: hackrobot-singbox_tuic2
|
||||
type: tuic
|
||||
server: 23.94.99.206
|
||||
port: 10831
|
||||
ports: 32000-33000
|
||||
uuid: fda6eb84-7b47-473f-abcb-82a5addece55
|
||||
password: fda6eb84-7b47-473f-abcb-82a5addece55
|
||||
|
||||
# 可选优化字段(以下均为官方推荐写法)
|
||||
alpn:
|
||||
- h3
|
||||
udp-relay-mode: native # 原生 UDP 转发模式
|
||||
congestion-controller: bbr # 拥塞控制算法:bbr/cubic/new_reno
|
||||
disable-sni: false # 保留 SNI,用于伪装域名
|
||||
reduce-rtt: true # 启用 0-RTT 握手以降低延迟
|
||||
request-timeout: 8000 # 连接超时时间(毫秒)
|
||||
heartbeat-interval: 10000 # 心跳包间隔(毫秒)
|
||||
tls: true
|
||||
sni: web3.nomadro.com # 若使用域名证书建议填写
|
||||
skip-cert-verify: true # 测试阶段跳过证书验证
|
||||
fast-open: true # 启用 TCP Fast-Open
|
||||
max-open-streams: 20 # 最大并发流数量
|
||||
max-udp-relay-packet-size: 1500 # 最大 UDP 包大小(字节)
|
||||
udp: true # 启用 UDP 支持
|
||||
- name: "VLESS_Reality_Vision2"
|
||||
type: vless
|
||||
server: 23.94.99.206 # 替换为域名
|
||||
port: 35925 # 修改端口为21730
|
||||
uuid: fda6eb84-7b47-473f-abcb-82a5addece55
|
||||
flow: xtls-rprx-vision
|
||||
encryption: none
|
||||
network: tcp
|
||||
|
||||
tls: true
|
||||
servername: web3.nomadro.com
|
||||
alpn:
|
||||
- h2
|
||||
- http/1.1
|
||||
client-fingerprint: chrome
|
||||
skip-cert-verify: true
|
||||
|
||||
reality-opts:
|
||||
public-key: JhJEy3-xC5sux3iBJ1Ryc8jO5F6CKsZsQjzG0BSN_g0
|
||||
short-id: 6ba85179e30d4fc2
|
||||
server-names:
|
||||
- web3.nomadro.com
|
||||
flow: xtls-rprx-vision
|
||||
|
||||
smux:
|
||||
enabled: false
|
||||
|
||||
- name: "5d723acc-singbox_hysteria2"
|
||||
type: hysteria2
|
||||
server: vpn.nomadro.live
|
||||
port: 42220
|
||||
password: 5d723acc-7454-4d36-8c95-7dd4ac7345f0
|
||||
sni: vpn.nomadro.live
|
||||
skip-cert-verify: true
|
||||
alpn:
|
||||
- h3
|
||||
up: "1000 Mbps"
|
||||
down: "1000 Mbps"
|
||||
|
||||
- name: "5d723acc-singbox_hysteria3"
|
||||
type: hysteria2
|
||||
server: vpn.nomadro.live
|
||||
port: 42220
|
||||
password: 5d723acc-7454-4d36-8c95-7dd4ac7345f0
|
||||
sni: vpn.nomadro.live
|
||||
skip-cert-verify: true
|
||||
alpn:
|
||||
- h3
|
||||
up: "1000 Mbps"
|
||||
down: "1000 Mbps"
|
||||
- name: "5d723acc-singbox_tuic3"
|
||||
type: tuic
|
||||
server: vpn.nomadro.live
|
||||
port: 11090
|
||||
ports: 32000-40000
|
||||
uuid: 5d723acc-7454-4d36-8c95-7dd4ac7345f0
|
||||
password: 5d723acc-7454-4d36-8c95-7dd4ac7345f0
|
||||
alpn:
|
||||
- h3
|
||||
udp-relay-mode: native
|
||||
congestion-controller: bbr
|
||||
disable-sni: false
|
||||
reduce-rtt: true
|
||||
request-timeout: 8000
|
||||
heartbeat-interval: 10000
|
||||
tls: true
|
||||
sni: vpn.nomadro.live
|
||||
skip-cert-verify: true
|
||||
fast-open: true
|
||||
max-open-streams: 20
|
||||
max-udp-relay-packet-size: 1500
|
||||
udp: true
|
||||
- name: "5d723acc-VLESS_Reality_Vision3"
|
||||
type: vless
|
||||
server: vpn.nomadro.live
|
||||
port: 10166
|
||||
uuid: 5d723acc-7454-4d36-8c95-7dd4ac7345f0
|
||||
flow: xtls-rprx-vision
|
||||
encryption: none
|
||||
network: tcp
|
||||
tls: true
|
||||
servername: vpn.nomadro.live
|
||||
alpn:
|
||||
- h2
|
||||
- http/1.1
|
||||
client-fingerprint: chrome
|
||||
skip-cert-verify: true
|
||||
reality-opts:
|
||||
public-key: O7N27RFEB0aZA22B9MCaMuScNL8o4mEJ1L59ckwMdQo
|
||||
short-id: 6ba85179e30d4fc2
|
||||
server-names:
|
||||
- vpn.nomadro.live
|
||||
flow: xtls-rprx-vision
|
||||
smux:
|
||||
enabled: false
|
||||
|
||||
- name: "6958e927-VLESS_Reality_Vision4"
|
||||
type: vless
|
||||
server: 192.3.193.172
|
||||
port: 22308
|
||||
uuid: 6958e927-7c34-4f3f-a0fe-1bc2d3fe47ed
|
||||
flow: xtls-rprx-vision
|
||||
encryption: none
|
||||
network: tcp
|
||||
tls: true
|
||||
servername: www.java.com
|
||||
alpn:
|
||||
- h2
|
||||
- http/1.1
|
||||
client-fingerprint: chrome
|
||||
skip-cert-verify: true
|
||||
reality-opts:
|
||||
public-key: bIDtmG9P4Ny2bA1EmL0QKxBYkrvWIo-ZNJ4dzmub1h8
|
||||
short-id: 6ba85179e30d4fc2
|
||||
server-names:
|
||||
- www.java.com
|
||||
flow: xtls-rprx-vision
|
||||
smux:
|
||||
enabled: false
|
||||
|
||||
- name: "6958e927-singbox_tuic4"
|
||||
type: tuic
|
||||
server: vpn2.nomadro.live
|
||||
port: 21925
|
||||
ports: 32000-40000
|
||||
uuid: 6958e927-7c34-4f3f-a0fe-1bc2d3fe47ed
|
||||
password: 6958e927-7c34-4f3f-a0fe-1bc2d3fe47ed
|
||||
alpn:
|
||||
- h3
|
||||
udp-relay-mode: quic
|
||||
congestion-controller: bbr
|
||||
disable-sni: false
|
||||
reduce-rtt: true
|
||||
request-timeout: 8000
|
||||
heartbeat-interval: 10000
|
||||
tls: true
|
||||
sni: vpn2.nomadro.live
|
||||
skip-cert-verify: true
|
||||
fast-open: true
|
||||
max-open-streams: 20
|
||||
max-udp-relay-packet-size: 1500
|
||||
udp: true
|
||||
|
||||
- name: leafHY2
|
||||
type: hysteria2
|
||||
server: proxy.smallzhiyuns.com
|
||||
port: 25050
|
||||
ports: 30000-31000 # 保持这个范围
|
||||
password: 1c8bafc8-f9cc-4168-a6c2-a57fc6a76eee
|
||||
sni: proxy.smallzhiyuns.com
|
||||
up: "200 Mbps" # 先降低测试
|
||||
down: "200 Mbps"
|
||||
alpn:
|
||||
- h3 # 只留 h3
|
||||
skip-cert-verify: false # 先试不跳过(如果证书正规);如果还是超时,再改回 true
|
||||
fast-open: true
|
||||
retry: 60
|
||||
retry_interval: 5
|
||||
|
||||
|
||||
- name: "leafvless"
|
||||
type: vless
|
||||
server: 104.223.57.113
|
||||
port: 31364
|
||||
uuid: d8165fe1-57e4-424c-8674-4559e22790dc
|
||||
flow: xtls-rprx-vision
|
||||
udp: true
|
||||
packet-encoding: xudp
|
||||
|
||||
tls: true
|
||||
servername: proxy.smallzhiyuns.com
|
||||
client-fingerprint: chrome
|
||||
skip-cert-verify: true
|
||||
reality-opts:
|
||||
public-key: W-2MnNH5XiSstFwh9IyMcMFcdvTH32brc0N9d7e1Q3w
|
||||
short-id: 6ba85179e30d4fc2
|
||||
network: tcp
|
||||
smux:
|
||||
enabled: false
|
||||
|
||||
- name: leaftuic
|
||||
type: tuic
|
||||
server: proxy.smallzhiyuns.com
|
||||
port: 29121
|
||||
uuid: d8165fe1-57e4-424c-8674-4559e22790dc
|
||||
password: d8165fe1-57e4-424c-8674-4559e22790dc
|
||||
|
||||
# 可选优化字段(参考官方推荐)
|
||||
alpn:
|
||||
- h3
|
||||
udp-relay-mode: native
|
||||
congestion-controller: bbr
|
||||
disable-sni: false
|
||||
reduce-rtt: true
|
||||
request-timeout: 8000
|
||||
heartbeat-interval: 10000
|
||||
tls: true
|
||||
sni: hy2.smallzhiyuns.com
|
||||
skip-cert-verify: true
|
||||
fast-open: true
|
||||
max-open-streams: 20
|
||||
max-udp-relay-packet-size: 1500
|
||||
udp: true
|
||||
|
||||
proxy-groups:
|
||||
- type: select
|
||||
name: 🚀 节点选择
|
||||
proxies:
|
||||
- DIRECT
|
||||
- REJECT
|
||||
- ⚡ 自动选择
|
||||
- proxycheap
|
||||
- 242af835-singbox_hysteria
|
||||
- hackrobot-singbox_tuic
|
||||
- VLESS_Reality_Vision
|
||||
- 242af835-singbox_hysteria2
|
||||
- hackrobot-singbox_tuic2
|
||||
- VLESS_Reality_Vision2
|
||||
- 5d723acc-singbox_hysteria3
|
||||
- 5d723acc-singbox_tuic3
|
||||
- 5d723acc-VLESS_Reality_Vision3
|
||||
- 6958e927-singbox_tuic4
|
||||
- 6958e927-VLESS_Reality_Vision4
|
||||
- leafHY2
|
||||
- leafvless
|
||||
- leaftuic
|
||||
- name: dialer
|
||||
type: select
|
||||
proxies:
|
||||
- 242af835-singbox_hysteria
|
||||
- hackrobot-singbox_tuic
|
||||
- VLESS_Reality_Vision
|
||||
- 242af835-singbox_hysteria2
|
||||
- hackrobot-singbox_tuic2
|
||||
- VLESS_Reality_Vision2
|
||||
- 5d723acc-singbox_hysteria3
|
||||
- 5d723acc-singbox_tuic3
|
||||
- 5d723acc-VLESS_Reality_Vision3
|
||||
- 6958e927-singbox_tuic4
|
||||
- 6958e927-VLESS_Reality_Vision4
|
||||
- leafHY2
|
||||
- leafvless
|
||||
- leaftuic
|
||||
|
||||
- name: ⚡ 自动选择
|
||||
type: url-test
|
||||
proxies:
|
||||
- 242af835-singbox_hysteria
|
||||
- hackrobot-singbox_tuic
|
||||
- VLESS_Reality_Vision
|
||||
url: https://www.gstatic.com/generate_204
|
||||
interval: 300
|
||||
lazy: false
|
||||
- type: select
|
||||
name: 🏠 私有网络
|
||||
proxies:
|
||||
- 🚀 节点选择
|
||||
- DIRECT
|
||||
- REJECT
|
||||
- ⚡ 自动选择
|
||||
- 242af835-singbox_hysteria2
|
||||
- type: select
|
||||
name: 🔒 国内服务
|
||||
proxies:
|
||||
- 🚀 节点选择
|
||||
- DIRECT
|
||||
- REJECT
|
||||
- ⚡ 自动选择
|
||||
- 242af835-singbox_hysteria2
|
||||
- type: select
|
||||
name: 🌐 非中国
|
||||
proxies:
|
||||
- 🚀 节点选择
|
||||
- DIRECT
|
||||
- REJECT
|
||||
- ⚡ 自动选择
|
||||
- 242af835-singbox_hysteria2
|
||||
- type: select
|
||||
name: 🐟 漏网之鱼
|
||||
proxies:
|
||||
- 🚀 节点选择
|
||||
- DIRECT
|
||||
- REJECT
|
||||
- ⚡ 自动选择
|
||||
- 242af835-singbox_hysteria2
|
||||
rules:
|
||||
- RULE-SET,geolocation-cn,🔒 国内服务
|
||||
- RULE-SET,geolocation-!cn,🌐 非中国
|
||||
- RULE-SET,private,🏠 私有网络,no-resolve
|
||||
- RULE-SET,cn,🔒 国内服务,no-resolve
|
||||
- MATCH,🐟 漏网之鱼
|
||||
@ -38,6 +38,11 @@ SHELLCRASH_AUTO_START_ON_WEB_PANEL=0
|
||||
SHELLCRASH_ATTACH_WHEN_DIRECT_OK=0
|
||||
SHELLCRASH_ATTACH_NEKO=auto
|
||||
SHELLCRASH_ATTACH_FFMPEG=auto
|
||||
# Neko 专用 ShellCrash mixed listener(与 FFmpeg 的 7890/tuic3 出口隔离)
|
||||
NEKO_SHELLCRASH_PROXY_PORT=7894
|
||||
SHELLCRASH_NEKO_PROXY_NODE=proxycheap
|
||||
# 留空则自动使用 http://host.docker.internal:${NEKO_SHELLCRASH_PROXY_PORT}
|
||||
# NEKO_BROWSER_PROXY=
|
||||
NETWORK_PROBE_GOOGLE_URL=https://www.google.com/generate_204
|
||||
NETWORK_PROBE_YOUTUBE_URL=https://www.youtube.com/generate_204
|
||||
NETWORK_PROBE_DOUYIN_URL=https://live.douyin.com/
|
||||
|
||||
@ -48,6 +48,8 @@ SHELLCRASH_AUTO_START_ON_WEB_PANEL="${SHELLCRASH_AUTO_START_ON_WEB_PANEL:-0}"
|
||||
SHELLCRASH_ATTACH_WHEN_DIRECT_OK="${SHELLCRASH_ATTACH_WHEN_DIRECT_OK:-0}"
|
||||
SHELLCRASH_ATTACH_NEKO="${SHELLCRASH_ATTACH_NEKO:-auto}"
|
||||
SHELLCRASH_ATTACH_FFMPEG="${SHELLCRASH_ATTACH_FFMPEG:-auto}"
|
||||
NEKO_SHELLCRASH_PROXY_PORT="${NEKO_SHELLCRASH_PROXY_PORT:-7894}"
|
||||
SHELLCRASH_NEKO_PROXY_NODE="${SHELLCRASH_NEKO_PROXY_NODE:-proxycheap}"
|
||||
NETWORK_PROBE_GOOGLE_URL="${NETWORK_PROBE_GOOGLE_URL:-https://www.google.com/generate_204}"
|
||||
NETWORK_PROBE_YOUTUBE_URL="${NETWORK_PROBE_YOUTUBE_URL:-https://www.youtube.com/generate_204}"
|
||||
NETWORK_PROBE_DOUYIN_URL="${NETWORK_PROBE_DOUYIN_URL:-https://live.douyin.com/}"
|
||||
@ -1081,6 +1083,22 @@ shellcrash_mix_port() {
|
||||
printf '%s' "$port"
|
||||
}
|
||||
|
||||
shellcrash_neko_proxy_port() {
|
||||
local port="${NEKO_SHELLCRASH_PROXY_PORT:-7894}"
|
||||
case "$port" in
|
||||
''|*[!0-9]*) port=7894 ;;
|
||||
esac
|
||||
printf '%s' "$port"
|
||||
}
|
||||
|
||||
neko_shellcrash_proxy_enabled() {
|
||||
[ "${ENABLE_NEKO:-1}" = "1" ] || return 1
|
||||
case "$SHELLCRASH_ATTACH_NEKO" in
|
||||
0|false|FALSE|off|OFF|none|NONE|direct|DIRECT) return 1 ;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
|
||||
shellcrash_config_available() {
|
||||
[ -s "$SHELLCRASH_DIR/yamls/config.yaml" ] || [ -s "/tmp/ShellCrash/config.yaml" ]
|
||||
}
|
||||
@ -1164,13 +1182,20 @@ NFT
|
||||
fi
|
||||
}
|
||||
|
||||
ensure_shellcrash_proxy_ports_for_docker() {
|
||||
ensure_shellcrash_docker_proxy_access "$(shellcrash_mix_port)"
|
||||
if neko_shellcrash_proxy_enabled; then
|
||||
ensure_shellcrash_docker_proxy_access "$(shellcrash_neko_proxy_port)"
|
||||
fi
|
||||
}
|
||||
|
||||
shellcrash_proxy_available() {
|
||||
local port="$1"
|
||||
[ "${ENABLE_SHELLCRASH:-1}" = "1" ] || return 1
|
||||
if unit_exists shellcrash.service && ! unit_active shellcrash.service; then
|
||||
return 1
|
||||
fi
|
||||
ensure_shellcrash_docker_proxy_access "$port" >/dev/null 2>&1 || true
|
||||
ensure_shellcrash_proxy_ports_for_docker >/dev/null 2>&1 || true
|
||||
if have ss; then
|
||||
ss -ltn 2>/dev/null | awk -v p=":$port" '
|
||||
$4 ~ p"$" && $4 !~ /(^|:)127\.0\.0\.1:/ && $4 !~ /\[::1\]:/ { found=1 }
|
||||
@ -1197,7 +1222,7 @@ resolve_neko_browser_proxy() {
|
||||
;;
|
||||
esac
|
||||
local port
|
||||
port="$(shellcrash_mix_port)"
|
||||
port="$(shellcrash_neko_proxy_port)"
|
||||
if shellcrash_proxy_available "$port"; then
|
||||
printf 'http://host.docker.internal:%s' "$port"
|
||||
return 0
|
||||
@ -1206,7 +1231,7 @@ resolve_neko_browser_proxy() {
|
||||
return 0
|
||||
fi
|
||||
shellcrash_autostart_if_needed >/dev/null 2>&1 || true
|
||||
port="$(shellcrash_mix_port)"
|
||||
port="$(shellcrash_neko_proxy_port)"
|
||||
if shellcrash_proxy_available "$port"; then
|
||||
printf 'http://host.docker.internal:%s' "$port"
|
||||
fi
|
||||
@ -1503,7 +1528,7 @@ service_shellcrash_start() {
|
||||
kv message "ShellCrash is not installed"
|
||||
exit 1
|
||||
fi
|
||||
ensure_shellcrash_docker_proxy_access "$(shellcrash_mix_port)" >/dev/null 2>&1 || true
|
||||
ensure_shellcrash_proxy_ports_for_docker >/dev/null 2>&1 || true
|
||||
service_neko_reconfigure_for_shellcrash_change
|
||||
kv message "ShellCrash started"
|
||||
}
|
||||
@ -1529,7 +1554,7 @@ service_shellcrash_restart() {
|
||||
kv message "ShellCrash is not installed"
|
||||
exit 1
|
||||
fi
|
||||
ensure_shellcrash_docker_proxy_access "$(shellcrash_mix_port)" >/dev/null 2>&1 || true
|
||||
ensure_shellcrash_proxy_ports_for_docker >/dev/null 2>&1 || true
|
||||
service_neko_reconfigure_for_shellcrash_change
|
||||
kv message "ShellCrash restarted"
|
||||
}
|
||||
@ -1660,7 +1685,7 @@ EOF
|
||||
exit 1
|
||||
fi
|
||||
ensure_shellcrash_web_panel >/dev/null 2>&1 || true
|
||||
ensure_shellcrash_docker_proxy_access "$(shellcrash_mix_port)" >/dev/null 2>&1 || true
|
||||
ensure_shellcrash_proxy_ports_for_docker >/dev/null 2>&1 || true
|
||||
service_neko_reconfigure_for_shellcrash_change
|
||||
|
||||
selected=""
|
||||
@ -2079,13 +2104,8 @@ service_neko_status() {
|
||||
kv host "${HOSTNAME_ALIAS}.local"
|
||||
kv port "$NEKO_HTTP_PORT_1"
|
||||
kv url "http://${HOSTNAME_ALIAS}.local:${NEKO_HTTP_PORT_1}"
|
||||
browser_proxy="${NEKO_BROWSER_PROXY:-}"
|
||||
if [ -z "$browser_proxy" ]; then
|
||||
case "$SHELLCRASH_ATTACH_NEKO" in
|
||||
0|false|FALSE|off|OFF|none|NONE|direct|DIRECT) browser_proxy=direct ;;
|
||||
*) browser_proxy=auto ;;
|
||||
esac
|
||||
fi
|
||||
browser_proxy="$(resolve_neko_browser_proxy)"
|
||||
[ -n "$browser_proxy" ] || browser_proxy=direct
|
||||
kv detail "image=$(resolve_neko_image); supervisor_conf=$(resolve_neko_supervisor_conf); start_url=${NEKO_START_URL}; nat1to1=${target_nat1to1:-unset}; instances=${running_count}/${total_count}; ports=${ports%,}; profiles=${profiles%,}; screen=${NEKO_DESKTOP_SCREEN}; shm=${NEKO_SHM_SIZE}; fps=${NEKO_MAX_FPS}; bitrate=${NEKO_VIDEO_BITRATE}; render=${NEKO_BROWSER_RENDER_MODE}; proxy=${browser_proxy}${reconfigure_detail}; containers=${states}"
|
||||
}
|
||||
|
||||
|
||||
@ -28,6 +28,9 @@ MAX_FILES_PER_ROOT = 256
|
||||
BASH_BIN = "/bin/bash" if Path("/bin/bash").is_file() else (shutil.which("bash") or "bash")
|
||||
SHELLCRASH_DEFAULT_PROFILE = "LsRzcR3pHoA9.yaml"
|
||||
SHELLCRASH_DEFAULT_NODE = "5d723acc-singbox_tuic3"
|
||||
SHELLCRASH_NEKO_LISTENER_NAME = "neko-mixed"
|
||||
SHELLCRASH_NEKO_PROXY_PORT = 7894
|
||||
SHELLCRASH_NEKO_PROXY_NODE = "proxycheap"
|
||||
SHELLCRASH_PROFILE_STAGE = BASE_DIR / ".process_runner" / "shellcrash-profile.yaml"
|
||||
SHELLCRASH_WEB_PANEL_PORT = 9999
|
||||
SHELLCRASH_WEB_PANEL_PATH = "/ui/"
|
||||
@ -404,6 +407,71 @@ def _ensure_shellcrash_lan_direct_rules(data: dict[str, Any]) -> None:
|
||||
data["rules"] = missing + rules
|
||||
|
||||
|
||||
def _neko_shellcrash_listener_port() -> int:
|
||||
return _coerce_shellcrash_port(
|
||||
os.environ.get("NEKO_SHELLCRASH_PROXY_PORT", SHELLCRASH_NEKO_PROXY_PORT),
|
||||
SHELLCRASH_NEKO_PROXY_PORT,
|
||||
)
|
||||
|
||||
|
||||
def _neko_shellcrash_proxy_node() -> str:
|
||||
return (os.environ.get("SHELLCRASH_NEKO_PROXY_NODE") or SHELLCRASH_NEKO_PROXY_NODE).strip()
|
||||
|
||||
|
||||
def _ensure_shellcrash_neko_listener(data: dict[str, Any]) -> dict[str, Any]:
|
||||
port = _neko_shellcrash_listener_port()
|
||||
node = _neko_shellcrash_proxy_node()
|
||||
proxies = data.get("proxies") or []
|
||||
if not isinstance(proxies, list):
|
||||
proxies = []
|
||||
node_found = any(isinstance(item, dict) and item.get("name") == node for item in proxies)
|
||||
|
||||
listeners = data.get("listeners")
|
||||
if not isinstance(listeners, list):
|
||||
listeners = []
|
||||
|
||||
updated = False
|
||||
for item in listeners:
|
||||
if not isinstance(item, dict):
|
||||
continue
|
||||
if item.get("name") != SHELLCRASH_NEKO_LISTENER_NAME:
|
||||
continue
|
||||
item["type"] = "mixed"
|
||||
item["port"] = port
|
||||
item["listen"] = "0.0.0.0"
|
||||
if node_found:
|
||||
item["proxy"] = node
|
||||
updated = True
|
||||
break
|
||||
|
||||
if not updated and node_found:
|
||||
listeners.append(
|
||||
{
|
||||
"name": SHELLCRASH_NEKO_LISTENER_NAME,
|
||||
"type": "mixed",
|
||||
"port": port,
|
||||
"listen": "0.0.0.0",
|
||||
"proxy": node,
|
||||
}
|
||||
)
|
||||
updated = True
|
||||
|
||||
if updated:
|
||||
data["listeners"] = listeners
|
||||
|
||||
warning = ""
|
||||
if node and not node_found:
|
||||
warning = f"Neko proxy node not found: {node}; skipped dedicated listener"
|
||||
return {
|
||||
"listener": SHELLCRASH_NEKO_LISTENER_NAME,
|
||||
"port": port,
|
||||
"node": node,
|
||||
"node_found": node_found,
|
||||
"listener_applied": updated and node_found,
|
||||
"warning": warning,
|
||||
}
|
||||
|
||||
|
||||
def _normalize_shellcrash_yaml(content: str, target_node: str) -> tuple[str, dict[str, Any]]:
|
||||
try:
|
||||
import yaml
|
||||
@ -440,12 +508,17 @@ def _normalize_shellcrash_yaml(content: str, target_node: str) -> tuple[str, dic
|
||||
data["external-ui-url"] = str(data.get("external-ui-url") or "")
|
||||
data["log-level"] = "info"
|
||||
_ensure_shellcrash_lan_direct_rules(data)
|
||||
neko_listener = _ensure_shellcrash_neko_listener(data)
|
||||
neko_warning = str(neko_listener.get("warning") or "").strip()
|
||||
if neko_warning:
|
||||
warning = f"{warning}; {neko_warning}".strip("; ").strip()
|
||||
normalized = yaml.safe_dump(data, allow_unicode=True, sort_keys=False, width=4096)
|
||||
return normalized, {
|
||||
"target_node": target_node,
|
||||
"target_node_found": target_node_found,
|
||||
"default_groups": default_groups,
|
||||
"warning": warning,
|
||||
"neko_listener": neko_listener,
|
||||
"bytes": len(normalized.encode("utf-8")),
|
||||
}
|
||||
|
||||
@ -494,6 +567,7 @@ async def apply_shellcrash_profile(
|
||||
"target_node_found": bool(meta["target_node_found"]),
|
||||
"default_groups": meta["default_groups"],
|
||||
"warning": warning,
|
||||
"neko_listener": meta.get("neko_listener") or {},
|
||||
"bytes": meta["bytes"],
|
||||
"selected": info.get("selected", ""),
|
||||
"service": status,
|
||||
|
||||
@ -291,6 +291,42 @@ rules:
|
||||
self.assertIn("IP-CIDR,192.168.0.0/16,DIRECT,no-resolve", data["rules"])
|
||||
self.assertEqual(data["rules"][-1], "MATCH,PROXY")
|
||||
|
||||
def test_shellcrash_normalize_adds_neko_dedicated_listener(self) -> None:
|
||||
content = """
|
||||
proxies:
|
||||
- name: proxycheap
|
||||
type: socks5
|
||||
server: 23.188.208.5
|
||||
port: 12441
|
||||
- name: 5d723acc-singbox_tuic3
|
||||
type: tuic
|
||||
server: vpn.nomadro.live
|
||||
port: 11090
|
||||
proxy-groups:
|
||||
- name: dialer
|
||||
type: select
|
||||
proxies:
|
||||
- 5d723acc-singbox_tuic3
|
||||
- name: 🚀 节点选择
|
||||
type: select
|
||||
proxies:
|
||||
- proxycheap
|
||||
- 5d723acc-singbox_tuic3
|
||||
rules:
|
||||
- MATCH,🚀 节点选择
|
||||
"""
|
||||
normalized, meta = _normalize_shellcrash_yaml(content, "5d723acc-singbox_tuic3")
|
||||
data = yaml.safe_load(normalized)
|
||||
listeners = data.get("listeners") or []
|
||||
self.assertTrue(meta["neko_listener"]["listener_applied"])
|
||||
self.assertEqual(meta["neko_listener"]["port"], 7894)
|
||||
self.assertEqual(meta["neko_listener"]["node"], "proxycheap")
|
||||
self.assertEqual(len(listeners), 1)
|
||||
self.assertEqual(listeners[0]["name"], "neko-mixed")
|
||||
self.assertEqual(listeners[0]["port"], 7894)
|
||||
self.assertEqual(listeners[0]["proxy"], "proxycheap")
|
||||
self.assertEqual(listeners[0]["listen"], "0.0.0.0")
|
||||
|
||||
def test_shellcrash_service_controller_syncs_runtime_config_before_start(self) -> None:
|
||||
script = Path("scripts/linux/service_ctl.sh").read_text(encoding="utf-8")
|
||||
common = Path("scripts/linux/lib/common.sh").read_text(encoding="utf-8")
|
||||
|
||||
@ -213,8 +213,12 @@ class NekoConfigTests(unittest.TestCase):
|
||||
self.assertIn("chown -R \"$owner\" \"$prof\"", script)
|
||||
self.assertIn("resolve_neko_browser_proxy()", script)
|
||||
self.assertIn("shellcrash_mix_port()", script)
|
||||
self.assertIn("shellcrash_neko_proxy_port()", script)
|
||||
self.assertIn("shellcrash_proxy_available()", script)
|
||||
self.assertIn("ensure_shellcrash_docker_proxy_access()", script)
|
||||
self.assertIn("ensure_shellcrash_proxy_ports_for_docker()", script)
|
||||
self.assertIn("neko_shellcrash_proxy_enabled()", script)
|
||||
self.assertIn("SHELLCRASH_NEKO_PROXY_NODE", script)
|
||||
self.assertIn("ip saddr 172.16.0.0/12 tcp dport", script)
|
||||
self.assertIn('chmod +x "$launch"', script)
|
||||
self.assertIn("copy_neko_tampermonkey_seed_dir()", script)
|
||||
|
||||
74
d2ypp2/tools/dedupe_douyin_urls.py
Normal file
74
d2ypp2/tools/dedupe_douyin_urls.py
Normal file
@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env python3
|
||||
import re
|
||||
import sys
|
||||
from collections import OrderedDict
|
||||
from pathlib import Path
|
||||
|
||||
pat = re.compile(r"(https://live\.douyin\.com/\d+),主播:\s*(.+)")
|
||||
key_pat = re.fullmatch
|
||||
|
||||
|
||||
def parse(text: str):
|
||||
channels = OrderedDict()
|
||||
current = None
|
||||
current_key = None
|
||||
for line in text.splitlines():
|
||||
line = line.strip().lstrip("\ufeff")
|
||||
if not line:
|
||||
continue
|
||||
m = pat.match(line)
|
||||
if m:
|
||||
if current:
|
||||
channels[current]["urls"].append(m.groups())
|
||||
elif re.fullmatch(r"[a-z0-9]{4}(-[a-z0-9]{4}){4}", line):
|
||||
current_key = line
|
||||
else:
|
||||
current = line
|
||||
channels[current] = {"key": current_key or "", "urls": []}
|
||||
return channels
|
||||
|
||||
|
||||
def main() -> int:
|
||||
text = Path(sys.argv[1]).read_text(encoding="utf-8") if len(sys.argv) > 1 else sys.stdin.read()
|
||||
channels = parse(text)
|
||||
all_entries = []
|
||||
dupes_cross = {}
|
||||
seen_global = {}
|
||||
for ch, info in channels.items():
|
||||
seen = set()
|
||||
deduped = []
|
||||
for url, name in info["urls"]:
|
||||
all_entries.append((url, name, ch))
|
||||
if url in seen:
|
||||
continue
|
||||
seen.add(url)
|
||||
deduped.append((url, name))
|
||||
if url in seen_global:
|
||||
dupes_cross.setdefault(url, set()).update([seen_global[url], ch])
|
||||
else:
|
||||
seen_global[url] = ch
|
||||
info["deduped"] = deduped
|
||||
|
||||
unique = OrderedDict()
|
||||
for url, name, _ in all_entries:
|
||||
unique.setdefault(url, name)
|
||||
|
||||
total = sum(len(v["urls"]) for v in channels.values())
|
||||
print(f"原始条目: {total}")
|
||||
print(f"去重后唯一 URL: {len(unique)}")
|
||||
print(f"重复条目: {total - len(unique)}")
|
||||
print("\n=== 跨频道重复 ===")
|
||||
for url in sorted(dupes_cross, key=lambda u: u.rsplit("/", 1)[-1]):
|
||||
name = unique[url]
|
||||
print(f"{url},主播: {name}")
|
||||
print(f" -> {', '.join(sorted(dupes_cross[url]))}")
|
||||
print("\n=== 各频道去重后 ===")
|
||||
for ch, info in channels.items():
|
||||
print(f"\n## {ch} | key={info['key']} | {len(info['deduped'])} 条")
|
||||
for url, name in info["deduped"]:
|
||||
print(f"{url},主播: {name}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Loading…
Reference in New Issue
Block a user