mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-10-30 04:05:13 +08:00
update 2026-10-07 18:47:42
This commit is contained in:
1 parent
617f7ca2a6
commit
bd061545ed
4832 files changed
+1693456
No files matched your search
@@ -0,0 +1,44 @@
|
||||
|
||||
config v2raya 'config'
|
||||
option enabled '0'
|
||||
|
||||
# Listening address
|
||||
option address '0.0.0.0:2017'
|
||||
|
||||
# Make sure your IPv6 network works fine before you turn it on.
|
||||
# Optional values: auto, on, off.
|
||||
option ipv6_support 'auto'
|
||||
|
||||
# Experimental feature. Make sure you have installed nftables.
|
||||
# Optional values: auto, on, off.
|
||||
option nftables_support 'auto'
|
||||
|
||||
# Optional values: trace, debug, info, warn or error
|
||||
option log_level 'info'
|
||||
|
||||
# Maximum number of days to keep log files
|
||||
option log_max_days '3'
|
||||
|
||||
option log_disable_color '1'
|
||||
|
||||
option log_disable_timestamp '0'
|
||||
|
||||
# Executable v2ray binary path. Auto-detect if put it empty
|
||||
option v2ray_bin ''
|
||||
|
||||
# Additional v2ray config directory, files in it will be combined with config generated by v2rayA
|
||||
option v2ray_confdir ''
|
||||
|
||||
# The executable file to run in the transparent proxy life-cycle.
|
||||
# v2rayA will pass in the --transparent-type (tproxy, redirect)
|
||||
# and --stage (pre-start, post-start, pre-stop, post-stop) arguments.
|
||||
option transparent_hook ''
|
||||
|
||||
# The executable file to run in the v2ray-core life-cycle.
|
||||
# v2rayA will pass in the --stage (pre-start, post-start, pre-stop, post-stop) argument.
|
||||
option core_hook ''
|
||||
|
||||
# The executable file to run in the v2ray-core life-cycle.
|
||||
# v2rayA will pass in the --stage (pre-start, post-start, pre-stop, post-stop) argument.
|
||||
option plugin_manager ''
|
||||
|
||||
Executable
+75
@@ -0,0 +1,75 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2021 Tianling Shen <cnsztl@immortalwrt.org>
|
||||
|
||||
USE_PROCD=1
|
||||
START=99
|
||||
|
||||
CONF="v2raya"
|
||||
PROG="/usr/bin/v2raya"
|
||||
|
||||
is_enabled() {
|
||||
local enabled
|
||||
config_get_bool enabled "$1" "$2" "${3:-0}"
|
||||
if [ "$enabled" -eq "1" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
append_env() {
|
||||
procd_append_param env "V2RAYA_$(echo "$1" | tr "[a-z]" "[A-Z]")"="$2"
|
||||
}
|
||||
|
||||
append_env_arg() {
|
||||
local value
|
||||
config_get value "$1" "$2" $3
|
||||
[ -n "$value" ] && append_env "$2" "$value"
|
||||
}
|
||||
|
||||
append_env_bool() {
|
||||
is_enabled "$1" "$2" && append_env "$2" "true"
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load "$CONF"
|
||||
|
||||
is_enabled "config" "enabled" || return 1
|
||||
|
||||
procd_open_instance "$CONF"
|
||||
procd_set_param command "$PROG"
|
||||
procd_set_param env XDG_DATA_HOME="/usr/share"
|
||||
|
||||
append_env "config" "/etc/v2raya"
|
||||
append_env "log_file" "/var/log/v2raya/v2raya.log"
|
||||
|
||||
append_env_arg "config" "address" "0.0.0.0:2017"
|
||||
append_env_arg "config" "ipv6_support" "auto"
|
||||
append_env_arg "config" "nftables_support" "auto"
|
||||
append_env_arg "config" "log_level" "info"
|
||||
append_env_arg "config" "log_max_days" "3"
|
||||
append_env_arg "config" "v2ray_bin"
|
||||
append_env_arg "config" "v2ray_confdir"
|
||||
append_env_arg "config" "transparent_hook"
|
||||
append_env_arg "config" "core_hook"
|
||||
append_env_arg "config" "plugin_manager"
|
||||
append_env_bool "config" "log_disable_color"
|
||||
append_env_bool "config" "log_disable_timestamp"
|
||||
|
||||
procd_set_param limits core="unlimited"
|
||||
procd_set_param limits nofile="1000000 1000000"
|
||||
procd_set_param respawn
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "$CONF"
|
||||
}
|
||||
Reference in new issue
Block a user