mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-30 14:55:13 +08:00
🦄 Sync 2026-09-27 22:25:23
This commit is contained in:
1 parent
67a7165b7e
commit
4c6d0df36f
67 files changed
+415
-8397
No files matched your search
@@ -0,0 +1,23 @@
|
||||
# dns.dae
|
||||
dns {
|
||||
bind: 'tcp+udp://[::]:53530'
|
||||
client_subnet: auto
|
||||
#ipversion_prefer: 4
|
||||
upstream {
|
||||
local: 'udp://127.0.0.1:53' -> direct
|
||||
remote: 'tcp+udp://dns.google:53'
|
||||
}
|
||||
routing {
|
||||
request {
|
||||
qtype(https) -> reject
|
||||
qname(geosite: gfw) -> remote
|
||||
fallback: local
|
||||
}
|
||||
response {
|
||||
upstream(remote) -> accept
|
||||
qname(geosite: private) -> accept
|
||||
ip(geoip: cn) -> accept
|
||||
fallback: remote
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
# node.dae
|
||||
node {
|
||||
node1: 'xxx'
|
||||
node2: 'xxx'
|
||||
}
|
||||
|
||||
subscription {
|
||||
# 短形式:默认 86400s 刷新一次
|
||||
sub: 'http://sub'
|
||||
|
||||
# 短形式 + UA:仍然只能默认 86400s
|
||||
sub_ua: 'http://sub'(honk/1.0 like)
|
||||
|
||||
# 块形式:可以自定义定时刷新周期
|
||||
sub2: {
|
||||
url: 'http://sub'
|
||||
ua: 'honk/1.0'
|
||||
interval: '10000s' # 每 10000 秒刷新一次
|
||||
}
|
||||
|
||||
# 禁用定期刷新
|
||||
sub3: {
|
||||
url: 'http://sub'
|
||||
interval: 0
|
||||
}
|
||||
}
|
||||
|
||||
group {
|
||||
proxy {
|
||||
filter: subtag(sub) && !name(keyword: 'ExpireAt:')
|
||||
filter: name(node1, node2)
|
||||
policy: score
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
# route.dae
|
||||
routing {
|
||||
pname(dnsmasq, zerotier-one) -> direct(must)
|
||||
dip(224.0.0.0/3, 'ff00::/8', geoip: private) -> direct
|
||||
domain(geosite: category-bank-cn, geosite: boc@!cn, geosite: synology) -> direct
|
||||
|
||||
# block quic, if u node has poor quic support, enable this line
|
||||
# l4proto(udp) && dport(443) -> block
|
||||
|
||||
domain(geosite: spotify) -> proxy
|
||||
domain(geosite: category-doh) -> proxy
|
||||
domain(geosite: tiktok) -> proxy
|
||||
domain(geosite: category-ai-!cn, geosite: github) -> proxy
|
||||
domain(geosite: gfw) -> proxy
|
||||
|
||||
dip(geoip: telegram) -> proxy
|
||||
|
||||
dip(geoip: cn) -> direct
|
||||
# geoip:cn always using chiness asn, can use domain rule to override
|
||||
# domain(geosite: cn) -> direct
|
||||
|
||||
# using proxy for ssh, http, https, and common ports, avoid (bt, or other p2p)
|
||||
# dport(22, 80, 443, 8080, 6443, 9090) -> proxy
|
||||
|
||||
# fallback: direct
|
||||
fallback: proxy
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
# config.dae
|
||||
# Load all honk files placed in ./config.d/.
|
||||
include {
|
||||
config.d/*.dae
|
||||
}
|
||||
|
||||
global {
|
||||
log_level: warn
|
||||
check_interval: 600s
|
||||
check_tolerance: 30ms
|
||||
lan_interface: br-lan
|
||||
wan_interface: auto
|
||||
auto_config_kernel_parameter: true
|
||||
data_dir: '/etc/honk'
|
||||
log_file: '/var/log/honk/honk.log'
|
||||
store_subscribe: true
|
||||
# if u not using dns bind, set dial_mode to domain++ prefer
|
||||
dial_mode: domain
|
||||
bootstrap_resolver: '223.5.5.5:53'
|
||||
tcp_check_url: 'https://www.gstatic.com/generate_204'
|
||||
tcp_check_http_method: HEAD
|
||||
udp_check_dns: 'dns.google.com:53', '8.8.8.8', '2001:4860:4860::8888'
|
||||
}
|
||||
|
||||
# using for enable experimental features
|
||||
# native-api, clash-api, cache-file
|
||||
#experimental {
|
||||
# native_api {
|
||||
# enabled: true
|
||||
# listen: '0.0.0.0:9527'
|
||||
# secret: 'honk'
|
||||
# ui: '/etc/honk/dashboard'
|
||||
# }
|
||||
# clash_api {
|
||||
# external_controller: '0.0.0.0:9090'
|
||||
# external_ui: '/etc/honk/zashboard'
|
||||
# secret: ''
|
||||
# default_mode: 'Rule'
|
||||
# }
|
||||
# cache_file {
|
||||
# enabled: true
|
||||
# path: '/etc/honk/cache.db'
|
||||
# cache_id: ''
|
||||
# store_fakeip: false #in this time, this field will be ignored
|
||||
# }
|
||||
#}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
config honk 'config'
|
||||
option enabled '0'
|
||||
option advanced '0'
|
||||
option dashboard 'doona'
|
||||
option config_file '/etc/honk/config.dae'
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
USE_PROCD=1
|
||||
START=96
|
||||
STOP=10
|
||||
|
||||
extra_command "hot_reload" "Hot-reload service"
|
||||
|
||||
CONF="honk"
|
||||
PROG="/usr/bin/honk-core"
|
||||
# honk-core hardcodes dae-compatible datapath names (dae0/dae0peer + daens);
|
||||
# these are the real interface/netns names, not leftover dae config.
|
||||
HONK_HOST_IFACE="dae0"
|
||||
HONK_PEER_IFACE="dae0peer"
|
||||
HONK_NETNS_NAME="daens"
|
||||
HONK_NETNS_PATH="/run/netns/$HONK_NETNS_NAME"
|
||||
RESOLV_HONK="/tmp/resolv.conf.honk"
|
||||
|
||||
set_chmod_640() {
|
||||
mkdir -p /etc/honk/config.d
|
||||
chmod -R 640 /etc/honk/ 2>/dev/null || true
|
||||
}
|
||||
|
||||
cleanup_netns() {
|
||||
ip netns del "$HONK_NETNS_NAME" 2>/dev/null || true
|
||||
umount "$HONK_NETNS_PATH" 2>/dev/null || true
|
||||
rm -f "$HONK_NETNS_PATH" 2>/dev/null || true
|
||||
ip link del "$HONK_HOST_IFACE" 2>/dev/null || true
|
||||
ip link del "$HONK_PEER_IFACE" 2>/dev/null || true
|
||||
}
|
||||
|
||||
hijack_resolv_conf() {
|
||||
grep -q ' /tmp/resolv\.conf ' /proc/mounts && return 0
|
||||
|
||||
grep -E '^(search|domain) ' /tmp/resolv.conf > "$RESOLV_HONK" 2>/dev/null
|
||||
|
||||
local dns_list LOGICAL_WAN
|
||||
. /lib/functions/network.sh
|
||||
network_find_wan LOGICAL_WAN 2>/dev/null
|
||||
if [ -n "$LOGICAL_WAN" ]; then
|
||||
dns_list=$(ubus call "network.interface.$LOGICAL_WAN" status 2>/dev/null | \
|
||||
jsonfilter -e '@["dns-server"][*]' 2>/dev/null)
|
||||
fi
|
||||
|
||||
if [ -z "$dns_list" ] && [ -f "/tmp/resolv.conf.d/resolv.conf.auto" ]; then
|
||||
dns_list=$(awk '/^nameserver/{print $2}' "/tmp/resolv.conf.d/resolv.conf.auto")
|
||||
fi
|
||||
|
||||
[ -z "$dns_list" ] && dns_list="119.29.29.29 223.5.5.5"
|
||||
|
||||
for dns in $dns_list; do
|
||||
echo "nameserver $dns" >> "$RESOLV_HONK"
|
||||
done
|
||||
|
||||
mount --bind "$RESOLV_HONK" /tmp/resolv.conf
|
||||
mount -o remount,ro,bind /tmp/resolv.conf
|
||||
}
|
||||
|
||||
restore_resolv_conf() {
|
||||
grep -q ' /tmp/resolv\.conf ' /proc/mounts || return 0
|
||||
mount -o remount,rw,bind /tmp/resolv.conf 2>/dev/null
|
||||
umount /tmp/resolv.conf 2>/dev/null
|
||||
rm -f "$RESOLV_HONK"
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local enabled config_file
|
||||
|
||||
config_load "$CONF"
|
||||
config_get_bool enabled "config" "enabled" "0"
|
||||
[ "$enabled" -eq "1" ] || return 1
|
||||
|
||||
config_get config_file "config" "config_file" "/etc/honk/config.dae"
|
||||
|
||||
set_chmod_640
|
||||
cleanup_netns
|
||||
hijack_resolv_conf
|
||||
|
||||
procd_open_instance "$CONF"
|
||||
procd_set_param env DAE_LOCATION_ASSET="/usr/share/v2ray"
|
||||
procd_set_param command "$PROG" --config "$config_file"
|
||||
procd_set_param netdev "$HONK_HOST_IFACE" "$HONK_PEER_IFACE"
|
||||
procd_set_param limits core="unlimited"
|
||||
procd_set_param limits nofile="1000000 1000000"
|
||||
procd_set_param term_timeout 8
|
||||
procd_set_param respawn 3600 5 5
|
||||
procd_set_param stderr 1
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
service_stopped() {
|
||||
restore_resolv_conf
|
||||
cleanup_netns
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "$CONF"
|
||||
}
|
||||
|
||||
hot_reload() {
|
||||
set_chmod_640
|
||||
if /etc/init.d/honk running; then
|
||||
"$PROG" reload
|
||||
else
|
||||
/etc/init.d/honk restart
|
||||
fi
|
||||
}
|
||||
Reference in new issue
Block a user