mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-10-31 04:35:13 +08:00
update 2026-10-08 20:05:36
This commit is contained in:
1 parent
4d8fedd7c6
commit
2f8de8b88d
228 files changed
+37327
-7
No files matched your search
+104
@@ -0,0 +1,104 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=honk
|
||||
PKG_VERSION:=2026.10.8_pre1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
# Raw upstream release tag. It keeps the dots in qualifiers (e.g. v0.0.1.beta.49)
|
||||
# because that is what the GitHub release asset name uses.
|
||||
HONK_RELEASE_TAG:=debug.2026.10.8.native-api.1
|
||||
HONK_ASSET_TAG:=debug
|
||||
|
||||
# SHA256 of each release tarball, kept in sync by scripts/update_honk_version.sh.
|
||||
HONK_HASH_X86_64:=edf2ff65507e89bc32d3fe643c3efa89ac35537931e80f9bce882488a3f289f4
|
||||
HONK_HASH_AARCH64:=11e6552df24fe9437903cdc00ac54334edf73f3aebce9c3f3e923ec1b690d4cb
|
||||
|
||||
PKG_LICENSE:=AGPL-3.0-only
|
||||
PKG_LICENSE_FILE:=LICENSE
|
||||
PKG_MAINTAINER:=luci-app-honk maintainers
|
||||
|
||||
ifeq ($(ARCH),x86_64)
|
||||
HONK_TARGET:=x86_64-unknown-linux-musl
|
||||
HONK_HASH:=$(HONK_HASH_X86_64)
|
||||
else ifeq ($(ARCH),aarch64)
|
||||
HONK_TARGET:=aarch64-unknown-linux-musl
|
||||
HONK_HASH:=$(HONK_HASH_AARCH64)
|
||||
endif
|
||||
|
||||
# Default to the stock-malloc build: lower RSS high-water on small gateways.
|
||||
# Use an empty suffix to switch back to the mimalloc build (faster QUIC).
|
||||
HONK_SUFFIX:=-stock
|
||||
HONK_ASSET:=honk-core-$(HONK_ASSET_TAG)-$(HONK_TARGET)$(HONK_SUFFIX).tar.gz
|
||||
|
||||
PKG_SOURCE:=$(HONK_ASSET)
|
||||
PKG_SOURCE_URL:=https://github.com/Glassyiris/honk/releases/download/$(HONK_RELEASE_TAG)/
|
||||
PKG_HASH:=$(HONK_HASH)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/honk
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Web Servers/Proxies
|
||||
TITLE:=honk - eBPF transparent proxy engine (dae-compatible)
|
||||
URL:=https://github.com/Glassyiris/honk
|
||||
DEPENDS:=@(x86_64||aarch64) \
|
||||
+ca-bundle +ip-full \
|
||||
+kmod-sched-core +kmod-sched-bpf +kmod-veth +kmod-nft-queue \
|
||||
+v2ray-geoip +v2ray-geosite \
|
||||
+@KERNEL_XDP_SOCKETS \
|
||||
+HONK_USE_VMLINUX_BTF:vmlinux-btf
|
||||
endef
|
||||
|
||||
define Package/honk/config
|
||||
choice
|
||||
prompt "BTF source for CO-RE"
|
||||
default HONK_USE_KERNEL_BTF
|
||||
depends on PACKAGE_honk
|
||||
|
||||
config HONK_USE_KERNEL_BTF
|
||||
bool "Use kernel BTF (integrated)"
|
||||
depends on KERNEL_DEBUG_INFO_BTF
|
||||
|
||||
config HONK_USE_VMLINUX_BTF
|
||||
bool "Use vmlinux-btf package"
|
||||
endchoice
|
||||
endef
|
||||
|
||||
define Package/honk/conffiles
|
||||
/etc/honk/config.dae
|
||||
/etc/honk/config.d/
|
||||
/etc/honk/state/
|
||||
/etc/config/honk
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(TAR) -xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip-components=1
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/honk/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/honk-core $(1)/usr/bin/honk-core
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/honk/config.d
|
||||
$(INSTALL_CONF) $(CURDIR)/files/config.dae $(1)/etc/honk/config.dae
|
||||
$(INSTALL_CONF) $(CURDIR)/files/config.d/node.dae $(1)/etc/honk/config.d/node.dae
|
||||
$(INSTALL_CONF) $(CURDIR)/files/config.d/route.dae $(1)/etc/honk/config.d/route.dae
|
||||
$(INSTALL_CONF) $(CURDIR)/files/config.d/dns.dae $(1)/etc/honk/config.d/dns.dae
|
||||
$(INSTALL_CONF) $(CURDIR)/files/config.d/api.dae $(1)/etc/honk/config.d/api.dae
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) $(CURDIR)/files/honk.config $(1)/etc/config/honk
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(CURDIR)/files/honk.init $(1)/etc/init.d/honk
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,honk))
|
||||
Whitespace-only changes.
@@ -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://one.one.one.one: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,30 @@
|
||||
# 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'
|
||||
}
|
||||
|
||||
assets {
|
||||
geodata {
|
||||
geosite: 'https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/release/geosite.dat'
|
||||
geoip: 'https://raw.githubusercontent.com/QiuSimons/geoip-moedove/refs/heads/main/geoip.dat'
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
config honk 'config'
|
||||
option enabled '0'
|
||||
option advanced '0'
|
||||
option dashboard 'none'
|
||||
option config_file '/etc/honk/config.dae'
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
#!/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 /etc/honk/state /var/log/honk
|
||||
chmod -R u=rwX,go= /etc/honk 2>/dev/null || true
|
||||
chmod 700 /etc/honk /etc/honk/config.d /etc/honk/state 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
|
||||
|
||||
local dns_list WANS
|
||||
. /lib/functions/network.sh
|
||||
unset -v __NETWORK_CACHE
|
||||
__network_ifstatus WANS "" "[@.route[@.target='0.0.0.0' && !@.table]].interface" 2>/dev/null
|
||||
set -- $WANS
|
||||
|
||||
if [ $# -eq 1 ]; then
|
||||
dns_list=$(ubus call "network.interface.$1" status 2>/dev/null | \
|
||||
jsonfilter -e '@["dns-server"][*]' 2>/dev/null)
|
||||
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
|
||||
fi
|
||||
|
||||
[ -z "$dns_list" ] && dns_list="119.29.29.29 223.5.5.5"
|
||||
|
||||
[ -f /tmp/resolv.conf ] || touch /tmp/resolv.conf
|
||||
grep -E '^(search|domain) ' /tmp/resolv.conf > "$RESOLV_HONK" 2>/dev/null
|
||||
|
||||
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() {
|
||||
while grep -q ' /tmp/resolv\.conf ' /proc/mounts; do
|
||||
mount -o remount,rw,bind /tmp/resolv.conf 2>/dev/null
|
||||
umount /tmp/resolv.conf 2>/dev/null || break
|
||||
done
|
||||
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"
|
||||
|
||||
if [ ! -x "$PROG" ]; then
|
||||
logger -t honk "not starting: $PROG is missing or not executable"
|
||||
return 1
|
||||
fi
|
||||
|
||||
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
|
||||
start
|
||||
fi
|
||||
}
|
||||
Reference in new issue
Block a user