1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2022 Dengfeng Liu <liu_df@qq.com>
4 # This is free software, licensed under the GNU General Public License v3.
5 # See /LICENSE for more information.
19 echo "[$name]" >> "$config"
22 uci_validate_section xfrpc xfrpc
"$name" \
23 'type:or("tcp", "http", "https")' \
24 'local_ip:ipaddr:127.0.0.1' \
27 echo "type = $type" >> "$config"
28 echo "local_ip = $local_ip" >> "$config"
29 echo "local_port = $local_port" >> "$config"
32 config_get remote_port
"$name" remote_port
33 echo "remote_port = $remote_port" >> "$config"
36 config_get custom_domains
"$name" custom_domains
37 echo "custom_domains = $custom_domains" >> "$config"
42 if [ "$name" = "common" ]; then
43 uci_validate_section xfrpc xfrpc
"$name" \
44 'server_addr:ipaddr' \
45 'server_port:uinteger'
47 echo "server_addr = $server_addr" >> "$config"
48 echo "server_port = $server_port" >> "$config"
55 procd_add_reload_trigger
"$NAME"
59 local conf_file
="/var/etc/$NAME.ini"
64 uci_validate_section xfrpc xfrpc init \
68 if [ $disabled = 1 ]; then
69 echo "xfrpc service disabled"
73 config_foreach handle_xfrpc xfrpc
"$conf_file"
76 procd_set_param
command "$PROG" -c "$conf_file" -f -d $loglevel
77 procd_set_param
file "$conf_file"
78 procd_set_param respawn