mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-05 09:54:06 +08:00
🌴 Sync 2026-03-05 23:51:42
This commit is contained in:
1 parent
97c049ed0a
commit
0acff03804
14253 files changed
+3893239
No files matched your search
@@ -0,0 +1,80 @@
|
||||
config general
|
||||
option transparent_proxy_enable '1'
|
||||
option tproxy_enable_udp '1'
|
||||
option server 'clashmeta'
|
||||
|
||||
option tproxy_port '7892'
|
||||
option packet_mark_id '255'
|
||||
list whitelist_process_uids '346'
|
||||
list whitelist_process_gids '346'
|
||||
option lan_interface 'br-lan'
|
||||
|
||||
# file descriptor limit
|
||||
option rlimit_nofile '8192 16384'
|
||||
# memory limit
|
||||
option rlimit_data '314572800 314572800'
|
||||
|
||||
option dnsmasq_takeover_enable '0'
|
||||
option dns_port '5353'
|
||||
# option dns_count '0'
|
||||
|
||||
list wan_bypass_rules '114.114.114.114'
|
||||
list wan_forward_rules '8.8.8.8'
|
||||
|
||||
option wan_forward_rule_file '/etc/mihomo/forwardlist.txt'
|
||||
option wan_bypass_rule_file '/etc/mihomo/chnlist.txt'
|
||||
|
||||
|
||||
config server 'clashmeta'
|
||||
option alias 'Clash Meta (mihomo)'
|
||||
option server_type 'mihomo'
|
||||
option executable_path '/usr/bin/mihomo'
|
||||
|
||||
option config_type 'directory'
|
||||
# option config_type 'file'
|
||||
|
||||
option config_directory '/etc/mihomo'
|
||||
option config_file '/etc/mihomo/config.yml'
|
||||
|
||||
|
||||
config server 'clash'
|
||||
option alias 'Clash / Clash Premium'
|
||||
option server_type 'mihomo'
|
||||
option executable_path '/usr/bin/clash'
|
||||
|
||||
option config_type 'directory'
|
||||
# option config_type 'file'
|
||||
|
||||
option config_directory '/etc/clash'
|
||||
option config_file '/etc/clash/config.yml'
|
||||
|
||||
|
||||
config server 'xray'
|
||||
option server_type 'xray'
|
||||
option executable_path '/usr/bin/xray'
|
||||
|
||||
option config_type 'directory'
|
||||
# option config_type 'file'
|
||||
|
||||
option config_directory '/etc/xray'
|
||||
option config_file '/etc/xray/config.json'
|
||||
|
||||
|
||||
config server 'v2ray'
|
||||
option server_type 'xray'
|
||||
option executable_path '/usr/bin/v2ray'
|
||||
|
||||
option config_type 'directory'
|
||||
# option config_type 'file'
|
||||
|
||||
option config_directory '/etc/v2ray'
|
||||
option config_file '/etc/v2ray/config.json'
|
||||
|
||||
|
||||
config lan_hosts 'example_bypass'
|
||||
option macaddr '22:11:33:44:55:66'
|
||||
option bypassed '1'
|
||||
|
||||
config lan_hosts 'example_forward'
|
||||
option macaddr '66:55:44:33:22:11'
|
||||
option bypassed '0'
|
||||
+138
@@ -0,0 +1,138 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=90
|
||||
STOP=15
|
||||
USE_PROCD=1
|
||||
NAME=jederproxy
|
||||
|
||||
. $IPKG_INSTROOT/lib/functions/jederproxy.sh
|
||||
|
||||
uci_get_global_config() {
|
||||
local key="$1"
|
||||
local default_value="$2"
|
||||
local value=$(uci -q get ${NAME}.@general[0].$key)
|
||||
echo ${value:=$default_value}
|
||||
}
|
||||
|
||||
start_jederproxy_process() {
|
||||
process=$1
|
||||
cwd=$2
|
||||
cmd=$3
|
||||
shift 3
|
||||
|
||||
log "Starting $process from $cmd inside $cwd"
|
||||
procd_open_instance
|
||||
procd_set_param respawn 1 1 0
|
||||
|
||||
procd_set_param env JP_TARGET_WD="$cwd"
|
||||
procd_set_param command "/usr/libexec/jederproxy/jederproxy_jail"
|
||||
procd_append_param command "$cmd"
|
||||
for arg in "$@"; do
|
||||
procd_append_param command "$arg"
|
||||
done
|
||||
|
||||
local rlimit_nofile
|
||||
local rlimit_data
|
||||
rlimit_nofile="$(uci_get_global_config rlimit_nofile)"
|
||||
rlimit_data="$(uci_get_global_config rlimit_data)"
|
||||
|
||||
if [ ! -z "${rlimit_nofile}" ] ; then
|
||||
log "set limit nofile=${rlimit_nofile}"
|
||||
procd_set_param limits "nofile=${rlimit_nofile}"
|
||||
fi
|
||||
if [ ! -z "${rlimit_data}" ] ; then
|
||||
log "set limit data=${rlimit_data}"
|
||||
procd_set_param limits "data=${rlimit_data}"
|
||||
fi
|
||||
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_set_param file /etc/config/jederproxy
|
||||
procd_set_param pidfile /var/run/jederproxy.pid
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
setup_dnsmasq() {
|
||||
local dns_port=$(uci_get_global_config dns_port)
|
||||
local dns_count=$(uci_get_global_config dns_count 0)
|
||||
|
||||
echo "# Generated dnsmasq configurations by luci-app-jederproxy" > /tmp/dnsmasq.d/jederproxy.conf
|
||||
echo "strict-order" >> /tmp/dnsmasq.d/jederproxy.conf
|
||||
echo "server=/#/127.0.0.1#${dns_port}" >> /tmp/dnsmasq.d/jederproxy.conf
|
||||
local cur_port
|
||||
for cur_port in $(seq ${dns_port} $(expr ${dns_port} + ${dns_count})); do
|
||||
echo "server=127.0.0.1#${cur_port}" >> /tmp/dnsmasq.d/jederproxy.conf
|
||||
done
|
||||
|
||||
log $(cat /tmp/dnsmasq.d/jederproxy.conf)
|
||||
/etc/init.d/dnsmasq restart > /dev/null 2>&1
|
||||
}
|
||||
|
||||
flush_dnsmasq() {
|
||||
[ -f "/tmp/dnsmasq.d/jederproxy.conf" ] && rm /tmp/dnsmasq.d/jederproxy.conf
|
||||
/etc/init.d/dnsmasq restart > /dev/null 2>&1
|
||||
}
|
||||
|
||||
system_configure() {
|
||||
[ "$(uci_get_global_config transparent_proxy_enable)" == "1" ] || return 0
|
||||
log "Setting dnsmasq and firewall for transparent proxy..."
|
||||
[ "$(uci_get_global_config dnsmasq_takeover_enable)" == "1" ] && setup_dnsmasq
|
||||
setup_firewall
|
||||
}
|
||||
|
||||
system_deconfigure() {
|
||||
log "Resetting dnsmasq and firewall configurations..."
|
||||
[ "$(uci_get_global_config dnsmasq_takeover_enable)" == "1" ] && flush_dnsmasq
|
||||
flush_firewall
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local active_server server_type executable_path config_type config_directory config_file
|
||||
config_load $NAME
|
||||
|
||||
mkdir -p /var/etc/jederproxy
|
||||
|
||||
active_server=$(uci_get_global_config server)
|
||||
|
||||
config_get server_type "$active_server" server_type
|
||||
config_get executable_path "$active_server" executable_path
|
||||
config_get config_type "$active_server" config_type
|
||||
config_get config_directory "$active_server" config_directory
|
||||
config_get config_file "$active_server" config_file
|
||||
|
||||
local working_directory=""
|
||||
if [ "$config_type" = "directory" ]; then
|
||||
working_directory="$config_directory"
|
||||
elif [ "$config_type" = "file" ]; then
|
||||
working_directory=$(dirname "$config_file")
|
||||
fi
|
||||
|
||||
if [ "$server_type" = "mihomo" ]; then
|
||||
if [ "$config_type" = "directory" ]; then
|
||||
start_jederproxy_process mihomo "$working_directory" "$executable_path" -d "$config_directory"
|
||||
elif [ "$config_type" = "file" ]; then
|
||||
start_jederproxy_process mihomo "$working_directory" "$executable_path" -f "$config_file"
|
||||
fi
|
||||
elif [ "$server_type" = "xray" ]; then
|
||||
if [ "$config_type" = "directory" ]; then
|
||||
start_jederproxy_process xray "$working_directory" "$executable_path" -confdir "$config_directory"
|
||||
elif [ "$config_type" = "file" ]; then
|
||||
start_jederproxy_process xray "$working_directory" "$executable_path" run -c "$config_file"
|
||||
fi
|
||||
|
||||
fi
|
||||
system_configure || system_deconfigure
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
system_deconfigure
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "jederproxy"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
include "/var/etc/jederproxy/*.nft"
|
||||
Reference in new issue
Block a user