diff --git a/anki_server/README_zh-CN.md b/anki_server/README_zh-CN.md deleted file mode 100644 index 3196261..0000000 --- a/anki_server/README_zh-CN.md +++ /dev/null @@ -1,94 +0,0 @@ -# Readme for anki_server - -## 概述 - -1. 本插件用于安装、配置、启动和结束anki_server - -## 安装前提 - -1. 必须安装并启用entware和monit - -## 文件结构 - -`ASUS_ROUTER/script_bootloader/usr/anki_server/` - -| 权限 | 名称 | 属性 | 说明 | -| --------- | --------------- | -------- | ---------------- | -| rwxrwxrwx | README_zh-CN.md | 普通文件 | 说明文件 | -| rwxrwxrwx | bin | 目录 | 可执行文件目录 | -| rwxrwxrwx | etc | 目录 | 配置文件目录 | -| rwxrwxrwx | usr | 目录 | 外部软件资源目录 | -| rwxrwxrwx | var | 目录 | 可变文件目录 | - -`ASUS_ROUTER/script_bootloader/usr/anki_server/bin/` - -| 权限 | 名称 | 属性 | 说明 | -| --------- | --------------------------- | -------- | ------------------------------ | -| rwxrwxrwx | anki_server_install | 普通文件 | 插件的安装程序 | -| rwxrwxrwx | anki_server_enable.service | 普通文件 | 插件的可执行程序,用于启动程序 | -| rwxrwxrwx | anki_server_disable.service | 普通文件 | 插件的可执行程序,用于结束程序 | - -`ASUS_ROUTER/script_bootloader/usr/anki_server/etc/` - -| 权限 | 名称 | 属性 | 说明 | -| --------- | ------------------- | -------- | --------------- | -| rwxrwxrwx | config.ankiserver | 普通文件 | 安装时自动生成 | -| rwxrwxrwx | monit.d/anki_server | 普通文件 | monit.d配置文件 | - -`ASUS_ROUTER/script_bootloader/usr/anki_server/usr/` - -| 权限 | 名称 | 属性 | 说明 | -| --------- | --------------- | ---- | ------------------ | -| rwxrwxrwx | example | 目录 | 软件配置模板目录 | -| rwxrwxrwx | venv_ankiserver | 目录 | Python虚拟环境目录 | - -`ASUS_ROUTER/script_bootloader/usr/anki_server/usr/example` - -| 权限 | 名称 | 属性 | 说明 | -| --------- | --------------------------- | -------- | ---------------- | -| rwxrwxrwx | example.ini | 普通文件 | 软件配置模板文件 | -| rwxrwxrwx | logging.conf | 普通文件 | 软件配置模板文件 | -| rwxrwxrwx | supervisor-anki-server.conf | 普通文件 | 软件配置模板文件 | - -`ASUS_ROUTER/script_bootloader/usr/anki_server/var/` - -| 权限 | 名称 | 属性 | 说明 | -| --------- | ----------- | -------- | -------------- | -| rwxrwxrwx | collections | 目录 | 软件同步目录 | -| rwxrwxrwx | session.db | 普通文件 | 会话数据库 | -| rwxrwxrwx | auth.db | 普通文件 | 用户账户数据库 | - -`ASUS_ROUTER/script_bootloader/usr/anki_server/var/collections` - -| 权限 | 名称 | 属性 | 说明 | -| --------- | -------- | ---- | ------------ | -| rwxrwxrwx | <用户名> | 目录 | 用户资源目录 | - -## 安装方法 - -执行`/tmp/mnt/ASUS_ROUTER/script_bootloader/usr/anki_server/bin/anki_server_install` - - > [受支持的路由器型号](https://github.com/Entware/Entware/wiki/Install-on-Asus-stock-firmware): - > - > | 架构 | 路由器型号 | - > | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | - > | **aarch64** | GT-AC2900, GT-AC5300, GT-AX11000, RT-AC86U, RT-AX88U, RT-AX92U | - > | **armv7** | Lyra Voice, RT-AC56U, RT-AC66U B1, RT-AC68P, RT-AC68U, RT-AC87U, RT-AC88U, RT-AC1200G, RT-AC1900P, RT-AC3100, RT-AC3200, RT-AC5300, RT-ACRH13, RT-AX56U, RT-AX58U | - > | **mipsel** | RT-N16, RT-N56U, RT-N66R, RT-N600, RT-AC51U, RT-AC66U, RT-AC66R, RT-AC1200, RT-AC1750, RT-AC1750 B1 | - -## 调用方法 - -| 插件文件 | 插件调用者 | -| --------------------------- | ------------------- | -| anki_server_enable.service | monit.d/anki_server | -| anki_server_disable.service | monit.d/anki_server | - -## 使用方法 - -> 默认用户名:路由器管理页面登陆用户名 -> -> 默认密码:路由器管理页面登陆密码 -> -> 自定义同步服务器:http://<路由器IP地址>:27701 -> -> 数据集目录:`/opt/script_bootloader/usr/anki_server/var/collections/` \ No newline at end of file diff --git a/anki_server/alternative/virtualenv-16.7.9-py2.py3-none-any.whl b/anki_server/alternative/virtualenv-16.7.9-py2.py3-none-any.whl deleted file mode 100644 index 46331cd..0000000 Binary files a/anki_server/alternative/virtualenv-16.7.9-py2.py3-none-any.whl and /dev/null differ diff --git a/anki_server/bin/anki_server_disable.service b/anki_server/bin/anki_server_disable.service deleted file mode 100644 index 323bec7..0000000 --- a/anki_server/bin/anki_server_disable.service +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# NAME OF THE SERVICE -# 服务名称 -SERVICE_NAME="ANKI-SERVER" -# -# FUNCTION OF THE SERVICE -# 服务功能 -SERVICE_FUNCTION="DISABLE" -# -# USB_MOUNT_POINT: The mount point of the USB flash drive -# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 -USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" -# -# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER -# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 -SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" -# -# PRIVATE_ROOT: The root directory for this program -# 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/anki_server" -# -# PRIVATE_USR: The directory which contains all the external software resources related to this program -# 设置自定义变量PRIVATE_USR为此程序外部软件资源目录 -PRIVATE_USR="${PRIVATE_ROOT}/usr" -# -# PY_VIRT_ENV: The directory which contains the python virtual environment of this program -# 设置自定义变量PY_VIRT_ENV为此程序Python虚环境目录 -PY_VIRT_ENV="${PRIVATE_USR}/venv_ankiserver" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ---------*" -# -########## END ########## -# -# -########## DISABLE ANKI-SERVER ########## -# -source "${PY_VIRT_ENV}/bin/activate" -export LC_ALL="en_US.UTF-8" -"${PY_VIRT_ENV}/bin/ankiserverctl.py" stop -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" -# -exit 0 -# -########## END ########## \ No newline at end of file diff --git a/anki_server/bin/anki_server_enable.service b/anki_server/bin/anki_server_enable.service deleted file mode 100644 index 5619444..0000000 --- a/anki_server/bin/anki_server_enable.service +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# NAME OF THE SERVICE -# 服务名称 -SERVICE_NAME="ANKI-SERVER" -# -# FUNCTION OF THE SERVICE -# 服务功能 -SERVICE_FUNCTION="ENABLE" -# -# USB_MOUNT_POINT: The mount point of the USB flash drive -# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 -USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" -# -# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER -# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 -SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" -# -# PRIVATE_ROOT: The root directory for this program -# 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/anki_server" -# -# PRIVATE_USR: The directory which contains all the external software resources related to this program -# 设置自定义变量PRIVATE_USR为此程序外部软件资源目录 -PRIVATE_USR="${PRIVATE_ROOT}/usr" -# -# PY_VIRT_ENV: The directory which contains the python virtual environment of this program -# 设置自定义变量PY_VIRT_ENV为此程序Python虚环境目录 -PY_VIRT_ENV="${PRIVATE_USR}/venv_ankiserver" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ---------*" -# -########## END ########## -# -# -########## ENABLE ANKI-SERVER ########## -# -source "${PY_VIRT_ENV}/bin/activate" -export LC_ALL="en_US.UTF-8" -"${PY_VIRT_ENV}/bin/ankiserverctl.py" start -# -if [ ${?} -eq 0 ] -then - /opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 0 - # -else - /opt/bin/echo -e "($(basename $0)): $$ \033[1;41;37mFAILURE\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 1 -fi -# -########## END ########## \ No newline at end of file diff --git a/anki_server/bin/anki_server_install b/anki_server/bin/anki_server_install deleted file mode 100644 index a2b2dd4..0000000 --- a/anki_server/bin/anki_server_install +++ /dev/null @@ -1,187 +0,0 @@ -#!/bin/sh -# -########## CHECK ASUS ROUTER MODEL ########## -# -ROUTER_MODEL="$(nvram get model)" -# -########## END ########## -# -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# NAME OF THE SERVICE -# 服务名称 -SERVICE_NAME="ANKI-SERVER" -# -# FUNCTION OF THE SERVICE -# 服务功能 -SERVICE_FUNCTION="INSTALL" -# -# USB_MOUNT_POINT: The mount point of the USB flash drive -# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 -USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" -# -# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER -# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 -SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" -# -# ENTWARE_ETC: The directory which contains all the configuration files installed by Entware -# 设置自定义变量ENTWARE_ETC为Entware安装的配置文件目录 -ENTWARE_ETC="${USB_MOUNT_POINT}/etc" -# -# ENTWARE_MONITD: The directory which contains all the configuration files used by monit -# 设置自定义变量ENTWARE_MONITD为monit配置文件目录 -ENTWARE_MONITD="${ENTWARE_ETC}/monit.d" -# -# PRIVATE_ROOT: The root directory for this program -# 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/anki_server" -# -# PRIVATE_ALTERNATIVE: The directory which contains all the alternatives -# 设置自定义变量PRIVATE_ALTERNATIVE为此程序备用文件目录 -PRIVATE_ALTERNATIVE="${PRIVATE_ROOT}/alternative" -# -# PRIVATE_BIN: The directory which contains all the executable files related to this program -# 设置自定义变量PRIVATE_BIN为此程序可执行文件目录 -PRIVATE_BIN="${PRIVATE_ROOT}/bin" -# -# PRIVATE_ETC: The directory which contains all the configuration files related to this program -# 设置自定义变量PRIVATE_ETC为此程序配置文件目录 -PRIVATE_ETC="${PRIVATE_ROOT}/etc" -# -# PRIVATE_USR: The directory which contains all the external software resources related to this program -# 设置自定义变量PRIVATE_USR为此程序外部软件资源目录 -PRIVATE_USR="${PRIVATE_ROOT}/usr" -# -# PRIVATE_VAR: The directory which contains all the variable files related to this program -# 设置自定义变量PRIVATE_VAR为此程序可变文件目录 -PRIVATE_VAR="${PRIVATE_ROOT}/var" -# -# PY_VIRT_ENV: The directory which contains the python virtual environment of this program -# 设置自定义变量PY_VIRT_ENV为此程序Python虚拟环境目录 -PY_VIRT_ENV="${PRIVATE_USR}/venv_ankiserver" -# -# ADMINUSER: The administrator of the router -# 设置环境变量ADMINUSER为路由器管理页面的登陆帐号 -ADMINUSER="$(nvram get sbl_username)" -# -# ADMINPASSWORD: The administrator's password of the router -# 设置环境变量ADMINPASSWORD为路由器管理页面的登陆密码 -ADMINPASSWORD="$(nvram get sbl_password)" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ON ${ROUTER_MODEL} ---------*" -# -########## END ########## -# -# -########## INSTALL ANKI-SERVER ########## -# -# Check if ENTWARE_ENABLE SERVICE has been loaded -# 检查ENTWARE_ENABLE SERVICE是否已启用 -if [ "$(which opkg)" == "/opt/bin/opkg" ] -then - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: ENTWARE_ENABLE SERVICE HAS BEEN LOADED" - # - # Check if MONIT MANAGEMENT SYSTEM is enabled - # 检查MONIT MANAGEMENT SYSTEM是否已启用 - if [ "$(which monit)" == "/opt/bin/monit" ] - then - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: MONIT MANAGEMENT SYSTEM HAS BEEN DEPLOYED" - # - # Install virtualenv - # 安装virtualenv - /opt/bin/pip2 install "${PRIVATE_ALTERNATIVE}/virtualenv-16.7.9-py2.py3-none-any.whl" - # - # Create virtual environment - # 创建虚拟环境 - /opt/bin/virtualenv -p /opt/bin/python2 "${PY_VIRT_ENV}" - # - # Create directory ${PRIVATE_VAR} - # 创建目录${PRIVATE_VAR} - /opt/bin/mkdir "${PRIVATE_VAR}" - # - # Enter virtual environment - # 进入虚拟环境 - source "${PY_VIRT_ENV}/bin/activate" - # - # Install AnkiServer - # 安装AnkiServer - export LC_ALL="en_US.UTF-8" - "${PY_VIRT_ENV}/bin/easy_install-2.7" AnkiServer - # - # Modify ankiserverctl.py - # 修改文件ankiserverctl.py - ANKISERVERCTL="${PY_VIRT_ENV}/lib/python2*/site-packages/AnkiServer*/EGG-INFO/scripts/ankiserverctl.py" - /opt/bin/cp -f ${ANKISERVERCTL} "${PRIVATE_BIN}/ankiserverctl.py.bak" - # - /opt/bin/sed -i '/^SERVERCONFIG/s/^/#/' ${ANKISERVERCTL} - /opt/bin/sed -i '/^#SERVERCONFIG/ a\SERVERCONFIG = \"'"${PRIVATE_ETC}/ankiserver.conf"'\"' ${ANKISERVERCTL} - # - /opt/bin/sed -i '/^AUTHDBPATH/s/^/#/' ${ANKISERVERCTL} - /opt/bin/sed -i '/^#AUTHDBPATH/ a\AUTHDBPATH = \"'"${PRIVATE_VAR}/auth.db"'\"' ${ANKISERVERCTL} - # - /opt/bin/sed -i '/^PIDPATH/s/^/#/' ${ANKISERVERCTL} - /opt/bin/sed -i '/^#PIDPATH/ a\PIDPATH = \"/var/run/ankiserver.pid\"' ${ANKISERVERCTL} - # - /opt/bin/sed -i '/^COLLECTIONPATH/s/^/#/' ${ANKISERVERCTL} - /opt/bin/sed -i '/^#COLLECTIONPATH/ a\COLLECTIONPATH = \"'"${PRIVATE_VAR}/collections/"'\"' ${ANKISERVERCTL} - # - # Configure AnkiServer - # 配置AnkiServer - /opt/bin/cp -f "${PRIVATE_USR}/examples/example.ini" "${PRIVATE_ETC}/ankiserver.conf" - /opt/bin/sed -i '/^host/s/^/;/' "${PRIVATE_ETC}/ankiserver.conf" - /opt/bin/sed -i '/^;host/ a\host = 0.0.0.0' "${PRIVATE_ETC}/ankiserver.conf" - /opt/bin/sed -i '/^data_root/s/^/;/' "${PRIVATE_ETC}/ankiserver.conf" - /opt/bin/sed -i '/^;data_root/ a\data_root = '"${PRIVATE_VAR}/collections"'' "${PRIVATE_ETC}/ankiserver.conf" - /opt/bin/sed -i '/^allowed_hosts/s/^/;/' "${PRIVATE_ETC}/ankiserver.conf" - /opt/bin/sed -i '/^;allowed_hosts/ a\allowed_hosts = 0.0.0.0' "${PRIVATE_ETC}/ankiserver.conf" - /opt/bin/sed -i '/^session_db_path/s/^/;/' "${PRIVATE_ETC}/ankiserver.conf" - /opt/bin/sed -i '/^;session_db_path/ a\session_db_path = '"${PRIVATE_VAR}/session.db"'' "${PRIVATE_ETC}/ankiserver.conf" - /opt/bin/sed -i '/^auth_db_path/s/^/;/' "${PRIVATE_ETC}/ankiserver.conf" - /opt/bin/sed -i '/^;auth_db_path/ a\auth_db_path = '"${PRIVATE_VAR}/auth.db"'' "${PRIVATE_ETC}/ankiserver.conf" - # - # Create default user - # 创建默认用户 - /opt/sbin/empty -f -i in.anki -o out.anki "${PY_VIRT_ENV}/bin/ankiserverctl.py" adduser "${ADMINUSER}" - /opt/sbin/empty -w -i out.anki -o in.anki assword: "${ADMINPASSWORD}\n" - # - # Configure monit - # 配置monit - /opt/bin/cp -f "${PRIVATE_ETC}/monit.d/anki_server" "${ENTWARE_MONITD}" - /opt/bin/chmod 600 "${ENTWARE_MONITD}/anki_server" - /opt/bin/mv -f "${ENTWARE_MONITD}/anki_server" "${ENTWARE_MONITD}/anki_server.on" - /opt/bin/monit reload - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 0 - # - else - # Do nothing but prompt the user - # 如果MONIT MANAGEMENT SYSTEM未部署,则执行 - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: MONIT MANAGEMENT SYSTEM HAS NOT BEEN DEPLOYED" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: PLEASE DEPLOY MONIT MANAGEMENT SYSTEM FIRST" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;41;37mFAILURE\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 2 - fi - # -else - # Do nothing but prompt the user - # 如果ENTWARE_ENABLE SERVICE未启用,则执行 - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: ENTWARE_ENABLE SERVICE HAS NOT BEEN LOADED" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: PLEASE ENABLE ENTWARE FIRST" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;41;37mFAILURE\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 1 -fi -# -########## END ########## \ No newline at end of file diff --git a/anki_server/bin/anki_server_uninstall b/anki_server/bin/anki_server_uninstall deleted file mode 100644 index 2a1e7fe..0000000 --- a/anki_server/bin/anki_server_uninstall +++ /dev/null @@ -1,148 +0,0 @@ -#!/bin/sh -# -########## CHECK ASUS ROUTER MODEL ########## -# -ROUTER_MODEL="$(nvram get model)" -# -########## END ########## -# -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# NAME OF THE SERVICE -# 服务名称 -SERVICE_NAME="ANKI-SERVER" -# -# FUNCTION OF THE SERVICE -# 服务功能 -SERVICE_FUNCTION="UNINSTALL" -# -# USB_MOUNT_POINT: The mount point of the USB flash drive -# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 -USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" -# -# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER -# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 -SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" -# -# ENTWARE_ETC: The directory which contains all the configuration files installed by Entware -# 设置自定义变量ENTWARE_ETC为Entware安装的配置文件目录 -ENTWARE_ETC="${USB_MOUNT_POINT}/etc" -# -# ENTWARE_MONITD: The directory which contains all the configuration files used by monit -# 设置自定义变量ENTWARE_MONITD为monit配置文件目录 -ENTWARE_MONITD="${ENTWARE_ETC}/monit.d" -# -# PRIVATE_ROOT: The root directory for this program -# 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/anki_server" -# -# PRIVATE_BIN: The directory which contains all the executable files related to this program -# 设置自定义变量PRIVATE_BIN为此程序可执行文件目录 -PRIVATE_BIN="${PRIVATE_ROOT}/bin" -# -# PRIVATE_ETC: The directory which contains all the configuration files related to this program -# 设置自定义变量PRIVATE_ETC为此程序配置文件目录 -PRIVATE_ETC="${PRIVATE_ROOT}/etc" -# -# PRIVATE_USR: The directory which contains all the external software resources related to this program -# 设置自定义变量PRIVATE_USR为此程序外部软件资源目录 -PRIVATE_USR="${PRIVATE_ROOT}/usr" -# -# PRIVATE_VAR: The directory which contains all the variable files related to this program -# 设置自定义变量PRIVATE_VAR为此程序可变文件目录 -PRIVATE_VAR="${PRIVATE_ROOT}/var" -# -# PY_VIRT_ENV: The directory which contains the python virtual environment of this program -# 设置自定义变量PY_VIRT_ENV为此程序Python虚拟环境目录 -PY_VIRT_ENV="${PRIVATE_USR}/venv_ankiserver" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ON ${ROUTER_MODEL} ---------*" -# -########## END ########## -# -# -########## UNINSTALL ANKI-SERVER ########## -# -# Check if ENTWARE_ENABLE SERVICE has been loaded -# 检查ENTWARE_ENABLE SERVICE是否已启用 -if [ "$(which opkg)" == "/opt/bin/opkg" ] -then - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: ENTWARE_ENABLE SERVICE HAS BEEN LOADED" - # - # Check if MONIT MANAGEMENT SYSTEM is enabled - # 检查MONIT MANAGEMENT SYSTEM是否已启用 - if [ "$(which monit)" == "/opt/bin/monit" ] - then - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: MONIT MANAGEMENT SYSTEM HAS BEEN DEPLOYED" - # - # Check if ${SERVICE_NAME} has been installed - # 检查${SERVICE_NAME}是否已安装 - if [ ! -d "${PY_VIRT_ENV}" ] - then - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: ${SERVICE_NAME} IS NOT INSTALLED" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;41;37mFAILURE\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 3 - fi - # - # Stop ANKI-SERVER service - # 停止ANKI-SERVER服务 - /opt/bin/monit stop "ANKI_SERVER" > /dev/null 2>&1 - # - # Wait until ANKI-SERVER service is terminated - # 等待直至ANKI-SERVER service被终止 - while [ -e "/var/run/ankiserver.pid" ] - do - /opt/bin/sleep 5 - done - # - # Configure anki_server - # 配置anki_server - /opt/bin/rm -f "${PRIVATE_BIN}/ankiserverctl.py.bak" - /opt/bin/rm -f "${PRIVATE_ETC}/ankiserver.conf" - /opt/bin/rm -rf "${PRIVATE_VAR}" - # - # Uninstall anki_server - # 卸载anki_server - /opt/bin/rm -rf "${PY_VIRT_ENV}" - # - # Configure monit - # 配置monit - /opt/bin/rm -f "${ENTWARE_MONITD}/anki_server.on" - /opt/bin/rm -f "${ENTWARE_MONITD}/anki_server" - /opt/bin/monit reload - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 0 - # - else - # Do nothing but prompt the user - # 如果MONIT MANAGEMENT SYSTEM未部署,则执行 - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: MONIT MANAGEMENT SYSTEM HAS NOT BEEN DEPLOYED" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: PLEASE DEPLOY MONIT MANAGEMENT SYSTEM FIRST" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;41;37mFAILURE\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 2 - fi - # -else - # Do nothing but prompt the user - # 如果ENTWARE_ENABLE SERVICE未启用,则执行 - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: ENTWARE_ENABLE SERVICE HAS NOT BEEN LOADED" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: PLEASE ENABLE ENTWARE FIRST" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;41;37mFAILURE\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 1 -fi -# -########## END ########## \ No newline at end of file diff --git a/anki_server/etc/monit.d/anki_server b/anki_server/etc/monit.d/anki_server deleted file mode 100644 index 2ff29d3..0000000 --- a/anki_server/etc/monit.d/anki_server +++ /dev/null @@ -1,4 +0,0 @@ -check process ANKI_SERVER with pidfile "/var/run/ankiserver.pid" - start program = "/opt/script_bootloader/usr/anki_server/bin/anki_server_enable.service" - stop program = "/opt/script_bootloader/usr/anki_server/bin/anki_server_disable.service" - if does not exist then restart \ No newline at end of file diff --git a/anki_server/usr/examples/example.ini b/anki_server/usr/examples/example.ini deleted file mode 100644 index 6663431..0000000 --- a/anki_server/usr/examples/example.ini +++ /dev/null @@ -1,30 +0,0 @@ - -[server:main] -use = egg:AnkiServer#server -host = 127.0.0.1 -port = 27701 - -[filter-app:main] -use = egg:Paste#translogger -next = real - -[app:real] -use = egg:Paste#urlmap -/ = rest_app -/msync = sync_app -/sync = sync_app - -[app:rest_app] -use = egg:AnkiServer#rest_app -data_root = ./collections -allowed_hosts = 127.0.0.1 -;logging.config_file = logging.conf - -[app:sync_app] -use = egg:AnkiServer#sync_app -data_root = ./collections -base_url = /sync/ -base_media_url = /msync/ -session_db_path = ./session.db -auth_db_path = ./auth.db - diff --git a/anki_server/usr/examples/logging.conf b/anki_server/usr/examples/logging.conf deleted file mode 100644 index fb94bf0..0000000 --- a/anki_server/usr/examples/logging.conf +++ /dev/null @@ -1,41 +0,0 @@ - -[loggers] -keys=root - -[handlers] -keys=screen,file,email - -[formatters] -keys=normal,email - -[logger_root] -level=INFO -handlers=screen -#handlers=file -#handlers=file,email - -[handler_file] -class=FileHandler -formatter=normal -args=('server.log','a') - -[handler_screen] -class=StreamHandler -level=NOTSET -formatter=normal -args=(sys.stdout,) - -[handler_email] -class=handlers.SMTPHandler -level=ERROR -formatter=email -args=('smtp.example.com', 'support@example.com', ['support_guy1@example.com', 'support_guy2@example.com'], 'AnkiServer error', ('smtp_user', 'smtp_password')) - -[formatter_normal] -format=%(asctime)s:%(name)s:%(levelname)s:%(message)s -datefmt= - -[formatter_email] -format=%(asctime)s - %(name)s - %(levelname)s - %(message)s -datefmt= - diff --git a/anki_server/usr/examples/supervisor-anki-server.conf b/anki_server/usr/examples/supervisor-anki-server.conf deleted file mode 100644 index affbefb..0000000 --- a/anki_server/usr/examples/supervisor-anki-server.conf +++ /dev/null @@ -1,24 +0,0 @@ -[program:anki-server] - -; The command used to execute the Anki Server. If you setup a virtualenv like described -; in the README.md, then be sure to point to the "paster" command inside of it! All files -; are relative to the "directory" variable given below -command=/usr/local/bin/paster serve production.ini - -; This is the directory to execute the Anki Server from. All files will be relative to this -; directory. This includes arguments to the "command" above and in the configuration files. -directory=/var/lib/anki - -; This is the user the Anki Server will run as. It should have permission to read and write -; the Anki collections referred to in the configuration file, but, for security reasons it -; shouldn't be "root"! -user=anki - -autostart=true -autorestart=true -redirect_stderr=true - -; Sometimes necessary if Anki is complaining about a UTF-8 locale. Make sure -; that the local you pick is actually installed on your system. -;environment=LANG=en_US.UTF-8,LC_ALL=en_US.UTF-8,LC_LANG=en_US.UTF-8 - diff --git a/filebrowser/README_zh-CN.md b/filebrowser/README_zh-CN.md index 78fe567..25eb8e8 100644 --- a/filebrowser/README_zh-CN.md +++ b/filebrowser/README_zh-CN.md @@ -62,4 +62,4 @@ > > Web页面登陆地址:http://<路由器IP地址>:35248 > -> 工作目录:`/root/` \ No newline at end of file +> 默认工作目录:`/home` \ No newline at end of file diff --git a/filebrowser/alternative/linux-arm64-filebrowser.tar.gz b/filebrowser/alternative/linux-arm64-filebrowser.tar.gz deleted file mode 100644 index bf766e7..0000000 Binary files a/filebrowser/alternative/linux-arm64-filebrowser.tar.gz and /dev/null differ diff --git a/filebrowser/alternative/linux-armv5-filebrowser.tar.gz b/filebrowser/alternative/linux-armv5-filebrowser.tar.gz deleted file mode 100644 index ff60de2..0000000 Binary files a/filebrowser/alternative/linux-armv5-filebrowser.tar.gz and /dev/null differ diff --git a/filebrowser/alternative/version b/filebrowser/alternative/version deleted file mode 100644 index 29c6e89..0000000 --- a/filebrowser/alternative/version +++ /dev/null @@ -1 +0,0 @@ -v2.21.1 \ No newline at end of file diff --git a/filebrowser/bin/filebrowser_enable.service b/filebrowser/bin/filebrowser_enable.service index 1496341..bf44fb1 100644 --- a/filebrowser/bin/filebrowser_enable.service +++ b/filebrowser/bin/filebrowser_enable.service @@ -49,15 +49,15 @@ FILEBROWSER_PID_FILE="/var/run/filebrowser.pid" # ########## CHECK AND ENABLE FILE-BROWSER ########## # -# Check if ${PRIVATE_USR}/filebrowser and ${PRIVATE_ETC}/database.db exist -# 检查文件${PRIVATE_USR}/filebrowser和${PRIVATE_ETC}/database.db是否存在 -if [ -e "${PRIVATE_USR}/filebrowser" ] && [ -e "${PRIVATE_ETC}/database.db" ] +# Check if ${PRIVATE_USR}/filebrowser and ${PRIVATE_ETC}/filebrowser.db exist +# 检查文件${PRIVATE_USR}/filebrowser和${PRIVATE_ETC}/filebrowser.db是否存在 +if [ -e "${PRIVATE_USR}/filebrowser" ] && [ -e "${PRIVATE_ETC}/filebrowser.db" ] then /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: ALL THE PREREQUISITES ARE MET" # # Load ${PRIVATE_USR}/filebrowser - # 如果文件${PRIVATE_USR}/filebrowser和${PRIVATE_ETC}/database.db存在,则执行 - /opt/bin/nohup "${PRIVATE_USR}/filebrowser" --database "${PRIVATE_ETC}/database.db" &> /dev/null & + # 如果文件${PRIVATE_USR}/filebrowser和${PRIVATE_ETC}/filebrowser.db存在,则执行 + /opt/bin/nohup "${PRIVATE_USR}/filebrowser" --database "${PRIVATE_ETC}/filebrowser.db" &> /dev/null & /opt/bin/sleep 10 PID="$(pidof filebrowser)" /opt/bin/echo "${PID}" > "${FILEBROWSER_PID_FILE}" diff --git a/filebrowser/bin/filebrowser_install b/filebrowser/bin/filebrowser_install index 21c14fb..528d502 100644 --- a/filebrowser/bin/filebrowser_install +++ b/filebrowser/bin/filebrowser_install @@ -187,9 +187,9 @@ then # # Configure filebrowser # 配置filebrowser - "${PRIVATE_USR}/filebrowser" --database "${PRIVATE_ETC}/database.db" config init --address "0.0.0.0" --branding.disableExternal --locale "${LANGUAGE}" --perm.admin --port "35248" --scope "/root" --sorting.by "name" --viewMode "list" + "${PRIVATE_USR}/filebrowser" --database "${PRIVATE_ETC}/filebrowser.db" config init --address "0.0.0.0" --auth.method "json" --branding.disableExternal --locale "${LANGUAGE}" --port "35248" --root "/home" --sorting.by "name" --viewMode "list" # - "${PRIVATE_USR}/filebrowser" --database "${PRIVATE_ETC}/database.db" users add "${ADMINUSER}" "${ADMINPASSWORD}" + "${PRIVATE_USR}/filebrowser" --database "${PRIVATE_ETC}/filebrowser.db" users add "${ADMINUSER}" "${ADMINPASSWORD}" --perm.admin --scope "/root" # # Configure fwd # 配置fwd diff --git a/he_ddns/bin/he_ddns_enable.service b/he_ddns/bin/he_ddns_enable.service index 53a15f5..76e2557 100644 --- a/he_ddns/bin/he_ddns_enable.service +++ b/he_ddns/bin/he_ddns_enable.service @@ -35,7 +35,13 @@ PRIVATE_VAR="${PRIVATE_ROOT}/var" # # LOGFILE: The log file # 设置自定义变量LOGFILE为日志文件 -LOGFILE="${PRIVATE_VAR}/log.txt" +LOGFILE="${PRIVATE_VAR}/log.tsv" +# +if [ ! -f "${LOGFILE}" ] +then + /opt/bin/rm -rf "${LOGFILE}" + /opt/bin/echo -e "DATE\tTIME\tSTATUS\tDETAILS\tNOTES" > "${LOGFILE}" +fi # # WAN0_GW_IFNAME: The interface name of WAN0 gateway # 设置自定义变量WAN0_GW_IFNAME为WAN0网关设备名 @@ -117,9 +123,9 @@ FAIL_COUNT=0 # 测试WAN连接 while [ ${FAIL_COUNT} -lt 3 ] do - RESULT_1_OF_CONNECTION_TEST="$(ping -q -c 1 -s 32 -W 5 "www.bing.com" 2> /dev/null | grep "100%")" - RESULT_2_OF_CONNECTION_TEST="$(ping -q -c 1 -s 32 -W 5 "www.alibaba.com" 2> /dev/null | grep "100%")" - RESULT_3_OF_CONNECTION_TEST="$(ping -q -c 1 -s 32 -W 5 "www.baidu.com" 2> /dev/null | grep "100%")" + RESULT_1_OF_CONNECTION_TEST="$(ping -q -c 1 -s 32 -W 5 "www.bing.com" 2> /dev/null | /opt/bin/grep "100%")" + RESULT_2_OF_CONNECTION_TEST="$(ping -q -c 1 -s 32 -W 5 "www.alibaba.com" 2> /dev/null | /opt/bin/grep "100%")" + RESULT_3_OF_CONNECTION_TEST="$(ping -q -c 1 -s 32 -W 5 "www.baidu.com" 2> /dev/null | /opt/bin/grep "100%")" # if [ -z "${RESULT_1_OF_CONNECTION_TEST}"] || [ -z "${RESULT_2_OF_CONNECTION_TEST}"] || [ -z "${RESULT_3_OF_CONNECTION_TEST}"] then @@ -142,7 +148,10 @@ do # if [ ${FAIL_COUNT} -ge 3 ] then - /opt/bin/echo -e "FAILURE: [${FAIL_DATE}] CAN NOT GET IP ADDRESS" | /opt/bin/tee -a "${LOGFILE}" + /opt/bin/echo -e "FAILURE: [${FAIL_DATE}] CAN NOT GET IP ADDRESS" + # + FAIL_DATE_FMT="$(/opt/bin/echo -e "${FAIL_DATE}" | /opt/bin/sed -E -n -e 's/[[:space:]]+/\t/p')" + /opt/bin/echo -e "${FAIL_DATE_FMT}\tFAILURE\tCAN NOT GET IP ADDRESS" >> "${LOGFILE}" # exit 2 fi @@ -160,7 +169,10 @@ do # if [ ${FAIL_COUNT} -ge 3 ] then - /opt/bin/echo -e "FAILURE: [${FAIL_DATE}] NO CONNECTION" | /opt/bin/tee -a "${LOGFILE}" + /opt/bin/echo -e "FAILURE: [${FAIL_DATE}] NO CONNECTION" + # + FAIL_DATE_FMT="$(/opt/bin/echo -e "${FAIL_DATE}" | /opt/bin/sed -E -n -e 's/[[:space:]]+/\t/p')" + /opt/bin/echo -e "${FAIL_DATE_FMT}\tFAILURE\tNO CONNECTION" >> "${LOGFILE}" # exit 1 fi @@ -183,34 +195,49 @@ do # # GET IPv4 # GET方法更新IPv4 - RESULT_OF_DDNS_UPDATE="$(/opt/bin/curl -s -k "https://dyn.dns.he.net/nic/update?hostname=${FQDN}&password=${DDNS_PASSWORD}&myip=${EXTERNAL_IPV4_ADDRESS}" | /opt/bin/sed -E -n -e 's/([[:alpha:]]+)[[:space:]]+.*/\1/p')" + RESULT_OF_DDNS_UPDATE="$(/opt/bin/curl -s -k "https://dyn.dns.he.net/nic/update?hostname=${FQDN}&password=${DDNS_PASSWORD}&myip=${EXTERNAL_IPV4_ADDRESS}" | /opt/bin/sed -E -n -e 's/([[:alpha:]]+)[[:space:]]*.*/\1/p')" # # GET IPv6 # GET方法更新IPv6 - #RESULT_OF_DDNS_UPDATE="$(/opt/bin/curl -s -k "https://dyn.dns.he.net/nic/update?hostname=${FQDN}&password=${DDNS_PASSWORD}&myip=${EXTERNAL_IPV6_ADDRESS}" | /opt/bin/sed -E -n -e 's/([[:alpha:]]+)[[:space:]]+.*/\1/p')" + #RESULT_OF_DDNS_UPDATE="$(/opt/bin/curl -s -k "https://dyn.dns.he.net/nic/update?hostname=${FQDN}&password=${DDNS_PASSWORD}&myip=${EXTERNAL_IPV6_ADDRESS}" | /opt/bin/sed -E -n -e 's/([[:alpha:]]+)[[:space:]]*.*/\1/p')" # # POST IPv4 # POST方法更新IPv4 - #RESULT_OF_DDNS_UPDATE="$(/opt/bin/curl -s -k "https://dyn.dns.he.net/nic/update" -d "hostname=${FQDN}" -d "password=${DDNS_PASSWORD}" -d "myip=${EXTERNAL_IPV4_ADDRESS}" | /opt/bin/sed -E -n -e 's/([[:alpha:]]+)[[:space:]]+.*/\1/p')" + #RESULT_OF_DDNS_UPDATE="$(/opt/bin/curl -s -k "https://dyn.dns.he.net/nic/update" -d "hostname=${FQDN}" -d "password=${DDNS_PASSWORD}" -d "myip=${EXTERNAL_IPV4_ADDRESS}" | /opt/bin/sed -E -n -e 's/([[:alpha:]]+)[[:space:]]*.*/\1/p')" # # POST IPv6 # POST方法更新IPv6 - #RESULT_OF_DDNS_UPDATE="$(/opt/bin/curl -s -k "https://dyn.dns.he.net/nic/update" -d "hostname=${FQDN}" -d "password=${DDNS_PASSWORD}" -d "myip=${EXTERNAL_IPV6_ADDRESS}" | /opt/bin/sed -E -n -e 's/([[:alpha:]]+)[[:space:]]+.*/\1/p')" + #RESULT_OF_DDNS_UPDATE="$(/opt/bin/curl -s -k "https://dyn.dns.he.net/nic/update" -d "hostname=${FQDN}" -d "password=${DDNS_PASSWORD}" -d "myip=${EXTERNAL_IPV6_ADDRESS}" | /opt/bin/sed -E -n -e 's/([[:alpha:]]+)[[:space:]]*.*/\1/p')" # case "${RESULT_OF_DDNS_UPDATE}" in "good") - /opt/bin/echo -e "SUCCESS: [$(/opt/bin/date "+%F %T")] ${FQDN} 👉 ${EXTERNAL_IPV4_ADDRESS}" | /opt/bin/tee -a "${LOGFILE}" + /opt/bin/echo -e "SUCCESS: [$(/opt/bin/date "+%F %T")] ${FQDN} 👉 ${EXTERNAL_IPV4_ADDRESS}" + # + /opt/bin/echo -e "$(/opt/bin/date "+%F%t%T")\tSUCCESS\t${FQDN} 👉 ${EXTERNAL_IPV4_ADDRESS}" >> "${LOGFILE}" + # + exit 0 ;; "nochg") /opt/bin/echo -e "NO-CHANGES: ${FQDN} 👉 ${EXTERNAL_IPV4_ADDRESS}" + # + exit 0 + ;; + "badauth") + /opt/bin/echo -e "FAILURE: [$(/opt/bin/date "+%F %T")] BAD AUTHENTICATION" + # + /opt/bin/echo -e "$(/opt/bin/date "+%F%t%T")\tFAILURE\tBAD AUTHENTICATION" >> "${LOGFILE}" + # + exit 4 + ;; + *) + /opt/bin/echo -e "FAILURE: [$(/opt/bin/date "+%F %T")] UNKNOWN ERROR" + # + /opt/bin/echo -e "$(/opt/bin/date "+%F%t%T")\tFAILURE\tUNKNOWN ERROR" >> "${LOGFILE}" + # + exit 5 ;; esac # - FAIL_DATE="" - FAIL_COUNT=0 - # - exit 0 - # else if [ -z "${FAIL_DATE}" ] then @@ -223,7 +250,10 @@ do then # Send an email as notification # 如果${WAN0_GW_IPV4_ADDRESS}与${EXTERNAL_IPV4_ADDRESS}不等,则执行 - /opt/bin/echo -e "FAILURE: [${FAIL_DATE}] EXTERNAL_IP(${EXTERNAL_IPV4_ADDRESS}) WAN0_GW_IP(${WAN0_GW_IPV4_ADDRESS})" | /opt/bin/tee -a "${LOGFILE}" + /opt/bin/echo -e "FAILURE: [${FAIL_DATE}] EXTERNAL_IP(${EXTERNAL_IPV4_ADDRESS}) WAN0_GW_IP(${WAN0_GW_IPV4_ADDRESS})" + # + FAIL_DATE_FMT="$(/opt/bin/echo -e "${FAIL_DATE}" | /opt/bin/sed -E -n -e 's/[[:space:]]+/\t/p')" + /opt/bin/echo -e "${FAIL_DATE_FMT}\tFAILURE\tEXTERNAL_IP(${EXTERNAL_IPV4_ADDRESS}) WAN0_GW_IP(${WAN0_GW_IPV4_ADDRESS})" >> "${LOGFILE}" # # Prepare mail contents # 准备邮件内容 diff --git a/samba/etc/smb.conf.add.template b/samba/etc/smb.conf.add.template index ac76d80..c240235 100644 --- a/samba/etc/smb.conf.add.template +++ b/samba/etc/smb.conf.add.template @@ -39,7 +39,7 @@ [ROUTER_MODEL-SMB-SHARE] comment = Samba Share on ROUTER_MODEL - path = /home/root + path = /home writable = yes browseable = yes # diff --git a/shadowsocks/README_zh-CN.md b/shadowsocks/README_zh-CN.md deleted file mode 100644 index db932ae..0000000 --- a/shadowsocks/README_zh-CN.md +++ /dev/null @@ -1,160 +0,0 @@ -# Readme for shadowsocks - -## 概述 - -1. 本插件用于安装、配置、启动和结束shadowsocks -2. ss_local客户端,用来连接远端shadowsocks服务器 -3. 客户端需安装socks5代理工具连接ss_local - - | 客户端 | 代理工具 | - | ------- | ------------ | - | Chrome | SwitchyOmega | - | iOS | Kitsunebi | - | Android | BifrostV | - -4. 支持全局透明代理,但仅能代理TCP流量。代理UDP流量的功能须等到华硕官方固件支持tproxy - -## 安装前提 - -1. 必须安装并启用entware和monit - -## 文件结构 - -`ASUS_ROUTER/script_bootloader/usr/shadowsocks/` - -| 权限 | 名称 | 属性 | 说明 | -| --------- | --------------- | -------- | ---------------- | -| rwxrwxrwx | README_zh-CN.md | 普通文件 | 说明文件 | -| rwxrwxrwx | bin | 目录 | 可执行文件目录 | -| rwxrwxrwx | etc | 目录 | 配置文件目录 | - -`ASUS_ROUTER/script_bootloader/usr/shadowsocks/bin/` - -| 权限 | 名称 | 属性 | 说明 | -| --------- | ----------------------------------------------------- | -------- | ------------------------------ | -| rwxrwxrwx | shadowsocks_install | 普通文件 | 安装程序 | -| rwxrwxrwx | shadowsocks_configure | 普通文件 | 配置程序 | -| rwxrwxrwx | shadowsocks_uninstall | 普通文件 | 卸载程序 | -| rwxrwxrwx | fw_ss_transparent_proxy_enable.service | 普通文件 | 插件的可执行程序,用于启动程序 | -| rwxrwxrwx | fw_ss_transparent_proxy_disable.service | 普通文件 | 插件的可执行程序,用于结束程序 | -| rwxrwxrwx | ss_local_enable.service | 普通文件 | 插件的可执行程序,用于启动程序 | -| rwxrwxrwx | ss_local_disable.service | 普通文件 | 插件的可执行程序,用于结束程序 | -| rwxrwxrwx | ss_redir_enable.service | 普通文件 | 插件的可执行程序,用于启动程序 | -| rwxrwxrwx | ss_redir_disable.service | 普通文件 | 插件的可执行程序,用于结束程序 | -| rwxrwxrwx | ss_server_enable.service | 普通文件 | 插件的可执行程序,用于启动程序 | -| rwxrwxrwx | ss_server_disable.service | 普通文件 | 插件的可执行程序,用于结束程序 | -| rwxrwxrwx | ss_tunnel_enable.service | 普通文件 | 插件的可执行程序,用于启动程序 | -| rwxrwxrwx | ss_tunnel_disable.service | 普通文件 | 插件的可执行程序,用于结束程序 | -| rwxrwxrwx | ss_transparent_proxy_enable_file.service | 普通文件 | 插件的可执行程序,用于启动程序 | -| rwxrwxrwx | ss_transparent_proxy_disable_file.service | 普通文件 | 插件的可执行程序,用于结束程序 | -| rwxrwxrwx | ss_transparent_proxy_overture_enable_file.service | 普通文件 | 插件的可执行程序,用于启动程序 | -| rwxrwxrwx | ss_transparent_proxy_overture_disable_file.service | 普通文件 | 插件的可执行程序,用于结束程序 | -| rwxrwxrwx | ss_transparent_proxy_overture_enable_prog.service | 普通文件 | 插件的可执行程序,用于启动程序 | -| rwxrwxrwx | ss_transparent_proxy_overture_disable_prog.service | 普通文件 | 插件的可执行程序,用于结束程序 | -| rwxrwxrwx | ss_transparent_proxy_without_dns_enable_file.service | 普通文件 | 插件的可执行程序,用于启动程序 | -| rwxrwxrwx | ss_transparent_proxy_without_dns_disable_file.service | 普通文件 | 插件的可执行程序,用于结束程序 | - -`ASUS_ROUTER/script_bootloader/usr/shadowsocks/etc/` - -| 权限 | 名称 | 属性 | 说明 | -| --------- | --------------------------------------------- | -------- | -------------------------------------- | -| rwxrwxrwx | config_local.json.template | 普通文件 | ss_local_enable.service的配置模版文件 | -| rwxrwxrwx | config_redir.json.template | 普通文件 | ss_redir_enable.service的配置模版文件 | -| rwxrwxrwx | config_server.json.template | 普通文件 | ss_server_enable.service的配置模版文件 | -| rwxrwxrwx | config_tunnel.json.template | 普通文件 | ss_tunnel_enable.service的配置模版文件 | -| rwxrwxrwx | fw.d/ss_server_open | 普通文件 | fw.d配置文件 | -| rwxrwxrwx | monit.d/fw_filter_INPUT_ss_server | 普通文件 | monit.d配置文件 | -| rwxrwxrwx | monit.d/ss_local | 普通文件 | monit.d配置文件 | -| rwxrwxrwx | monit.d/ss_redir | 普通文件 | monit.d配置文件 | -| rwxrwxrwx | monit.d/ss_server | 普通文件 | monit.d配置文件 | -| rwxrwxrwx | monit.d/ss_tunnel | 普通文件 | monit.d配置文件 | -| rwxrwxrwx | monit.d/ss_transparent_proxy_file | 普通文件 | monit.d配置文件 | -| rwxrwxrwx | monit.d/ss_transparent_proxy_overture_file | 普通文件 | monit.d配置文件 | -| rwxrwxrwx | monit.d/ss_transparent_proxy_overture_prog | 普通文件 | monit.d配置文件 | -| rwxrwxrwx | monit.d/ss_transparent_proxy_without_dns_file | 普通文件 | monit.d配置文件 | - -## 安装方法 - -1. 必须首先按照说明修改全部配置文件 -2. 执行`/tmp/mnt/ASUS_ROUTER/script_bootloader/usr/shadowsocks/bin/shadowsocks_install` - - > [受支持的路由器型号](https://github.com/Entware/Entware/wiki/Install-on-Asus-stock-firmware): - > - > | 架构 | 路由器型号 | - > | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | - > | **aarch64** | GT-AC2900, GT-AC5300, GT-AX11000, RT-AC86U, RT-AX88U, RT-AX92U | - > | **armv7** | Lyra Voice, RT-AC56U, RT-AC66U B1, RT-AC68P, RT-AC68U, RT-AC87U, RT-AC88U, RT-AC1200G, RT-AC1900P, RT-AC3100, RT-AC3200, RT-AC5300, RT-ACRH13, RT-AX56U, RT-AX58U | - > | **mipsel** | RT-N16, RT-N56U, RT-N66R, RT-N600, RT-AC51U, RT-AC66U, RT-AC66R, RT-AC1200, RT-AC1750, RT-AC1750 B1 | - -## 需修改部分 - -`shadowsocks/etc/config_local.json` - -| 行号 | 代码 | 说明 | -| ---- | -----------------| ------------------------------- | -| 2 | `"server":` | Shadowsocks服务器的IP地址或域名 | -| 3 | `"server_port":` | Shadowsocks服务器的监听端口 | -| 6 | `"password":` | 密码 | - -`shadowsocks/etc/config_redir.json` - -| 行号 | 代码 | 说明 | -| ---- | -----------------| ------------------------------- | -| 2 | `"server":` | Shadowsocks服务器的IP地址或域名 | -| 3 | `"server_port":` | Shadowsocks服务器的监听端口 | -| 6 | `"password":` | 密码 | - -`shadowsocks/etc/config_server.json` - -| 行号 | 代码 | 说明 | -| ---- | ------------- | ---- | -| 4 | `"password":` | 密码 | - -`shadowsocks/etc/config_tunnel.json` - -| 行号 | 代码 | 说明 | -| ---- | ---------------- | ------------------------------- | -| 2 | `"server":` | Shadowsocks服务器的IP地址或域名 | -| 3 | `"server_port":` | Shadowsocks服务器的监听端口 | -| 6 | `"password":` | 密码 | - -## 注意事项 - -1. 登录monit管理页面,可以看到SS_LOCAL和SS_TRANSPARENT_PROXY -2. SS_LOCAL是浏览器代理。可以配合客户端代理工具使用,路由器和未使用代理工具的客户端均在墙内 -3. SS_TRANSPARENT_PROXY是全局透明代理。必须先在monit管理页面中停止SS_LOCAL,然后再启用SS_TRANSPARENT_PROXY。路由器和全体客户端均在墙外 -4. 若配合Adguard-Home使用,需禁用ss_transparent_proxy_overture_file,启用ss_transparent_proxy_without_dns_file,并将Adguard-Home的上游DNS服务器设置为`https://dns.adguard.com/dns-query` - -## 使用方法 - -- Socks5代理服务器 - - 功能:全局代理,配合客户端socks5代理工具使用 - - 路由器:在monit管理页面中,停止服务`SS_TRANSPARENT_PROXY`,启动服务`SS_LOCAL` - - 客户端:按照文件`shadowsocks/etc/config_local.json`中相关参数配置代理程序 - -- 透明代理服务器(使用overture作为DNS代理,默认) - - 功能:全局代理,客户端免配置使用 - - 路由器:在monit管理页面中,停止服务`SS_LOCAL`,启动服务`SS_TRANSPARENT_PROXY` - - 客户端:免配置 - -- 透明代理服务器(使用adguardhome作为DNS代理) - - 功能:全局代理,客户端免配置使用,可过滤广告 - - 路由器:安装插件adguardhome;在adguardhome管理页面中,将上游DNS服务器设置为`https://dns.adguard.com/dns-query`;参考[Monit说明文件](../monit/README_zh-CN.md),禁用插件`ss_transparent_proxy_overture_file`,启用插件`ss_transparent_proxy_without_dns_file`;在monit管理页面中,启动服务`ADGUARD_HOME`,启动服务`SS_TRANSPARENT_PROXY` - - 客户端:免配置 - -- ShadowsSocks服务器 - - 功能:使外网客户端接入局域网,配合客户端socks5代理工具使用 - - 路由器:执行`/opt/script_bootloader/usr/shadowsocks/bin/shadowsocks_configure server`编辑配置文件;参考[Monit说明文件](../monit/README_zh-CN.md),启用插件`fw_filter_INPUT_ss_server`,启用插件`ss_server`;在monit管理页面中,启动服务`FW_PORT_OPENING_SS_SERVER`,启动服务`SS_SERVER` - - 客户端:按照文件`shadowsocks/etc/config_server.json`中相关参数配置代理程序 \ No newline at end of file diff --git a/shadowsocks/bin/fw_ss_transparent_proxy_disable.service b/shadowsocks/bin/fw_ss_transparent_proxy_disable.service deleted file mode 100644 index d9fa2bd..0000000 --- a/shadowsocks/bin/fw_ss_transparent_proxy_disable.service +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# NAME OF THE SERVICE -# 服务名称 -SERVICE_NAME="FW_SS_TRANSPARENT_PROXY" -# -# FUNCTION OF THE SERVICE -# 服务功能 -SERVICE_FUNCTION="DISABLE" -# -# BUILT_IN_CHAIN_NAME: Name of the built-in chain -# 设置自定义变量BUILT_IN_CHAIN_NAME为防火墙默认链名 -BUILT_IN_CHAIN_NAME="PREROUTING" -# -# USER_DEFINED_CHAIN_NAME: Name of the user-defined chain -# 设置自定义变量USER_DEFINED_CHAIN_NAME为防火墙自定义链名 -USER_DEFINED_CHAIN_NAME="SS_TPROXY" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ---------*" -# -########## END ########## -# -# -########## UNSET TCP PROXY ########## -# -# Check if ${USER_DEFINED_CHAIN_NAME}_TCP exists -# 检查${USER_DEFINED_CHAIN_NAME}_TCP是否存在 -if [ -z "$(iptables -t nat -nvL | /opt/bin/grep 'Chain '"${USER_DEFINED_CHAIN_NAME}"'_TCP')" ] -then - # Stop and Exit - # 如果${USER_DEFINED_CHAIN_NAME}_TCP不存在,则该程序终止" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: ${SERVICE_NAME} HAS BEEN ${SERVICE_FUNCTION}D ALREADY" - # - exit 1 - # -else - # Check if ${USER_DEFINED_CHAIN_NAME}_TCP is referenced by ${BUILT_IN_CHAIN_NAME} - # 检查${USER_DEFINED_CHAIN_NAME}_TCP是否被${BUILT_IN_CHAIN_NAME}所引用 - if [ -n "$(iptables -t nat -nvL "${BUILT_IN_CHAIN_NAME}" | /opt/bin/grep ''"${USER_DEFINED_CHAIN_NAME}"'_TCP')" ] - then - # Disable chain ${USER_DEFINED_CHAIN_NAME}_TCP - # 禁用${USER_DEFINED_CHAIN_NAME}_TCP链 - iptables -t nat -D "${BUILT_IN_CHAIN_NAME}" -p tcp -j "${USER_DEFINED_CHAIN_NAME}_TCP" - fi - # - # Flush chain ${USER_DEFINED_CHAIN_NAME}_TCP - # 清空${USER_DEFINED_CHAIN_NAME}_TCP链 - iptables -t nat -F "${USER_DEFINED_CHAIN_NAME}_TCP" - # - # Remove chain ${USER_DEFINED_CHAIN_NAME}_TCP - # 删除${USER_DEFINED_CHAIN_NAME}_TCP链 - iptables -t nat -X "${USER_DEFINED_CHAIN_NAME}_TCP" -fi -# -########## END ########## -# -# -########## UNSET UDP PROXY ########## -# -# Check if ${USER_DEFINED_CHAIN_NAME}_UDP exists -# 检查${USER_DEFINED_CHAIN_NAME}_UDP是否存在 -if [ -z "$(iptables -t mangle -nvL | /opt/bin/grep 'Chain '"${USER_DEFINED_CHAIN_NAME}"'_UDP')" ] -then - # Do nothing but prompt the user - # 如果${USER_DEFINED_CHAIN_NAME}_UDP不存在,则执行 - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: NO UDP PROXY" - # -else - # Check if ${USER_DEFINED_CHAIN_NAME}_UDP is referenced by ${BUILT_IN_CHAIN_NAME} - # 检查${USER_DEFINED_CHAIN_NAME}_UDP是否被${BUILT_IN_CHAIN_NAME}所引用 - if [ -n "$(iptables -t mangle -nvL "${BUILT_IN_CHAIN_NAME}" | /opt/bin/grep ''"${USER_DEFINED_CHAIN_NAME}"'_UDP')" ] - then - # Disable chain ${USER_DEFINED_CHAIN_NAME}_UDP - # 禁用${USER_DEFINED_CHAIN_NAME}_UDP链 - iptables -t mangle -D "${BUILT_IN_CHAIN_NAME}" -j "${USER_DEFINED_CHAIN_NAME}_UDP" - fi - # - # Flush chain ${USER_DEFINED_CHAIN_NAME}_UDP - # 清空${USER_DEFINED_CHAIN_NAME}_UDP链 - iptables -t mangle -F "${USER_DEFINED_CHAIN_NAME}_UDP" - # - # Remove chain ${USER_DEFINED_CHAIN_NAME}_UDP - # 删除${USER_DEFINED_CHAIN_NAME}_UDP链 - iptables -t mangle -X "${USER_DEFINED_CHAIN_NAME}_UDP" - # - # Remove IP route and rules - # 删除IP路由及规则 - #ip route del local default dev lo table 100 - #ip rule del fwmark 1 lookup 100 - ip rule del fwmark 0x01/0x01 table 100 - ip route del local 0.0.0.0/0 dev lo table 100 -fi -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" -# -exit 0 -# -########## END ########## \ No newline at end of file diff --git a/shadowsocks/bin/fw_ss_transparent_proxy_enable.service b/shadowsocks/bin/fw_ss_transparent_proxy_enable.service deleted file mode 100644 index 0f29138..0000000 --- a/shadowsocks/bin/fw_ss_transparent_proxy_enable.service +++ /dev/null @@ -1,139 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# NAME OF THE SERVICE -# 服务名称 -SERVICE_NAME="FW_SS_TRANSPARENT_PROXY" -# -# FUNCTION OF THE SERVICE -# 服务功能 -SERVICE_FUNCTION="ENABLE" -# -# USB_MOUNT_POINT: The mount point of the USB flash drive -# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 -USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" -# -# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER -# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 -SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" -# -# PRIVATE_ROOT: The root directory for this program -# 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/shadowsocks" -# -# PRIVATE_ETC: The directory which contains all the configuration files related to this program -# 设置自定义变量PRIVATE_ETC为此程序配置文件目录 -PRIVATE_ETC="${PRIVATE_ROOT}/etc" -# -# SERVER_DOMAIN: Domain of the SS-SERVER -# 设置自定义变量SERVER_DOMAIN为SS-SERVER的域名 -SERVER_DOMAIN="$(/opt/bin/sed -E -n -e 's/^[[:space:]]*\"server\":[[:space:]]*\"(.*)\".*/\1/p' "${PRIVATE_ETC}/config_redir.json")" -# -# SERVER_IP: Domain of the SS-SERVER -# 设置自定义变量SERVER_IP为SS-SERVER的IP地址 -SERVER_IP="$(nslookup "${SERVER_DOMAIN}" | /opt/bin/sed -E -n -e '/Name/,+1s/.*:[[:space:]]+(([[:digit:]]+\.?){4})[[:space:]]+.*/\1/p')" -# -# LOCAL_PORT: Local port of the SS-REDIR -# 设置自定义变量LOCAL_PORT为SS-REDIR的接收端口 -LOCAL_PORT="$(/opt/bin/sed -E -n -e 's/^[[:space:]]*\"local_port\":[[:space:]]*\"(.*)\".*/\1/p' "${PRIVATE_ETC}/config_redir.json")" -# -# BUILT_IN_CHAIN_NAME: Name of the built-in chain -# 设置自定义变量BUILT_IN_CHAIN_NAME为防火墙默认链名 -BUILT_IN_CHAIN_NAME="PREROUTING" -# -# USER_DEFINED_CHAIN_NAME: Name of the user-defined chain -# 设置自定义变量USER_DEFINED_CHAIN_NAME为防火墙自定义链名 -USER_DEFINED_CHAIN_NAME="SS_TPROXY" -# -# NF_TPROXY_CORE: The path to nf_tproxy_core.ko -# 设置自定义变量NF_TPROXY_CORE为文件nf_tproxy_core.ko的绝对路径 -NF_TPROXY_CORE="$(/opt/bin/find /lib/modules/ -name "nf_tproxy_core.ko")" -# -# XT_TPROXY: The path to xt_TPROXY.ko -# 设置自定义变量XT_TPROXY为文件xt_TPROXY.ko的绝对路径 -XT_TPROXY="$(/opt/bin/find /lib/modules/ -name "xt_TPROXY.ko")" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ---------*" -# -########## END ########## -# -# -########## SET UP TCP PROXY ########## -# -# Create new chain -iptables -t nat -N "${USER_DEFINED_CHAIN_NAME}_TCP" -# -# Ignore your shadowsocks server's addresses -# It's very IMPORTANT, just be careful. -iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}_TCP" -d "${SERVER_IP}" -j RETURN -# -# Ignore LANs and any other addresses you'd like to bypass the proxy -# See Wikipedia and RFC5735 for full list of reserved networks. -# See ashi009/bestroutetb for a highly optimized CHN route list. -iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}_TCP" -d "0.0.0.0/8" -j RETURN -iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}_TCP" -d "10.0.0.0/8" -j RETURN -iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}_TCP" -d "127.0.0.0/8" -j RETURN -iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}_TCP" -d "169.254.0.0/16" -j RETURN -iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}_TCP" -d "172.16.0.0/12" -j RETURN -iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}_TCP" -d "192.168.0.0/16" -j RETURN -iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}_TCP" -d "224.0.0.0/4" -j RETURN -iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}_TCP" -d "240.0.0.0/4" -j RETURN -# -# Anything else should be redirected to shadowsocks's local port -iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}_TCP" -p tcp -j REDIRECT --to-ports "${LOCAL_PORT}" -# -# Apply the rules -iptables -t nat -A "${BUILT_IN_CHAIN_NAME}" -p tcp -j "${USER_DEFINED_CHAIN_NAME}_TCP" -# -########## END ########## -# -# -########## SET UP UDP PROXY ########## -# -# Check if ${NF_TPROXY_CORE} and ${XT_TPROXY} exist (Disable UDP proxy temporarily) -# 检查${NF_TPROXY_CORE}和${XT_TPROXY}是否存在(临时禁用UDP proxy) -if [ -n "${NF_TPROXY_CORE}" ] && [ -n "${XT_TPROXY}" ] && false -then - # Enable TPROXY - # 启用TPROXY - insmod "${NF_TPROXY_CORE}" - insmod "${XT_TPROXY}" - # - # Create new chain - iptables -t mangle -N "${USER_DEFINED_CHAIN_NAME}_UDP" - # - # Add any UDP rules - #ip route add local default dev lo table 100 - #ip rule add fwmark 1 lookup 100 - ip rule add fwmark 0x01/0x01 table 100 - ip route add local 0.0.0.0/0 dev lo table 100 - iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}_UDP" -p udp --dport 53 -j TPROXY --on-port "${LOCAL_PORT}" --tproxy-mark 0x01/0x01 - # - # Apply the rules - iptables -t mangle -A "${BUILT_IN_CHAIN_NAME}" -j "${USER_DEFINED_CHAIN_NAME}_UDP" - # -else - # Do nothing but prompt the user - # 如果文件${NF_TPROXY_CORE}或${XT_TPROXY}不存在,则执行 - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: NO UDP PROXY" -fi -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" -# -exit 0 -# -########## END ########## \ No newline at end of file diff --git a/shadowsocks/bin/shadowsocks_configure b/shadowsocks/bin/shadowsocks_configure deleted file mode 100644 index 80e3dea..0000000 --- a/shadowsocks/bin/shadowsocks_configure +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# USB_MOUNT_POINT: The mount point of the USB flash drive -# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 -USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" -# -# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER -# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 -SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" -# -# PRIVATE_ROOT: The root directory for this program -# 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/shadowsocks" -# -# PRIVATE_ETC: The directory which contains all the configuration files related to this program -# 设置自定义变量PRIVATE_ETC为此程序配置文件目录 -PRIVATE_ETC="${PRIVATE_ROOT}/etc" -# -########## END ########## -# -# -########## LOAD FUNCTIONS ########## -# -doubleCheckAndConfirm() -{ - while [ 1 ] - do - local VALUE_1 - local VALUE_2 - # - /opt/bin/echo -ne "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: INPUT THE VALUE: " - read VALUE_1 - /opt/bin/echo -ne "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: INPUT THE VALUE AGAIN TO CONFIRM: " - read VALUE_2 - # - if [ "${VALUE_1}" == "${VALUE_2}" ] - then - eval ${1}="${VALUE_1}" - break - else - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: THE TWO VALUES ARE INCONSISTENT" - fi - done -} -# -########## END ########## -# -# -########## SET PARAMETERS ########## -# -case ${#} in - 0) - while [ 1 ] - do - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mROLE\033[0m: client | server" - doubleCheckAndConfirm ROLE - # - case "$(/opt/bin/echo "${ROLE}" | /opt/bin/sed -E 's/[[:upper:]]/\l&/g')" in - "server" | "client") - break - ;; - *) - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: INPUT VALUE IS INVALID" - ;; - esac - # - done - ;; - 1) - ROLE="${1}" - ;; - *) - /opt/bin/echo -e "($(basename $0)): $$ \033[1;41;37mFAILURE\033[0m: WRONG NUMBER OF PARAMETERS" - # - exit 1 - ;; -esac -# -case "$(/opt/bin/echo "${ROLE}" | /opt/bin/sed -E 's/[[:upper:]]/\l&/g')" in - "server") - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mPASSWORD\033[0m: password of local shadowsocks server" - doubleCheckAndConfirm PASSWORD - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mENCRYPTION METHOD\033[0m: aes-128-gcm | aes-192-gcm | aes-256-gcm | rc4-md5 | aes-128-cfb | aes-192-cfb | aes-256-cfb | aes-128-ctr | aes-192-ctr | aes-256-ctr | bf-cfb | camellia-128-cfb | camellia-192-cfb | camellia-256-cfb | chacha20-ietf-poly1305 | salsa20 | chacha20 and chacha20-ietf" - doubleCheckAndConfirm ENCRYPTION_METHOD - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mOBFUSCATION\033[0m: enable | disable" - doubleCheckAndConfirm OBFUSCATION - # - break - ;; - "client") - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mSERVER ADDRESS\033[0m: IP address or domain name of remote shadowsocks server" - doubleCheckAndConfirm SERVER_ADDRESS - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mSERVER PORT\033[0m: port of remote shadowsocks server" - doubleCheckAndConfirm SERVER_PORT - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mPASSWORD\033[0m: password of remote shadowsocks server" - doubleCheckAndConfirm PASSWORD - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mENCRYPTION METHOD\033[0m: aes-128-gcm | aes-192-gcm | aes-256-gcm | rc4-md5 | aes-128-cfb | aes-192-cfb | aes-256-cfb | aes-128-ctr | aes-192-ctr | aes-256-ctr | bf-cfb | camellia-128-cfb | camellia-192-cfb | camellia-256-cfb | chacha20-ietf-poly1305 | salsa20 | chacha20 and chacha20-ietf" - doubleCheckAndConfirm ENCRYPTION_METHOD - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mOBFUSCATION\033[0m: enable | disable" - doubleCheckAndConfirm OBFUSCATION - # - break - ;; - *) - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: INPUT VALUE IS INVALID" - ;; -esac -# -########## END ########## -# -# -########## CONFIGURE SHADOWSOCKS ########## -# -case "$(/opt/bin/echo "${ROLE}" | /opt/bin/sed -E 's/[[:upper:]]/\l&/g')" in - "server") - # Modify ${PRIVATE_ETC}/config_server.json - # 修改${PRIVATE_ETC}/config_server.json - /opt/bin/sed -E -i 's#^([[:space:]]+\"password\":).*#\1\"'"${PASSWORD}"'\",#' "${PRIVATE_ETC}/config_server.json" - /opt/bin/sed -E -i 's#^([[:space:]]+\"method\":).*#\1\"'"${ENCRYPTION_METHOD}"'\",#' "${PRIVATE_ETC}/config_server.json" - /opt/bin/sed -E -i '\#^[[:space:]]+\"plugin\":#d' "${PRIVATE_ETC}/config_server.json" - /opt/bin/sed -E -i '\#^[[:space:]]+\"plugin_opts\":#d' "${PRIVATE_ETC}/config_server.json" - NUM_LAST_LINE=$(/opt/bin/sed -ne '/}/=' "${PRIVATE_ETC}/config_server.json") - NUM_TARGET_LINE=$((${NUM_LAST_LINE}-1)) - /opt/bin/sed -E -i ''"${NUM_TARGET_LINE}"'s#,$##' "${PRIVATE_ETC}/config_server.json" - # - if [ "$(/opt/bin/echo "${OBFUSCATION}" | /opt/bin/sed -E 's/[[:upper:]]/\l&/g')" == "enable" ] - then - /opt/bin/sed -E -i ''"${NUM_TARGET_LINE}"'s#$#,#' "${PRIVATE_ETC}/config_server.json" - /opt/bin/sed -E -i '\#\}#iAAAA\"plugin\":\"obfs-server\",' "${PRIVATE_ETC}/config_server.json" - /opt/bin/sed -E -i '\#\}#iAAAA\"plugin_opts\":\"obfs=http\"' "${PRIVATE_ETC}/config_server.json" - /opt/bin/sed -E -i 's#^AAAA# #' "${PRIVATE_ETC}/config_server.json" - fi - ;; - "client") - for CONFIG_FOR_CLIENT in "${PRIVATE_ETC}/config_local.json" "${PRIVATE_ETC}/config_redir.json" "${PRIVATE_ETC}/config_tunnel.json" - do - /opt/bin/sed -E -i 's#^([[:space:]]+\"server\":).*#\1\"'"${SERVER_ADDRESS}"'\",#' "${CONFIG_FOR_CLIENT}" - /opt/bin/sed -E -i 's#^([[:space:]]+\"server_port\":).*#\1\"'"${SERVER_PORT}"'\",#' "${CONFIG_FOR_CLIENT}" - /opt/bin/sed -E -i 's#^([[:space:]]+\"password\":).*#\1\"'"${PASSWORD}"'\",#' "${CONFIG_FOR_CLIENT}" - /opt/bin/sed -E -i 's#^([[:space:]]+\"method\":).*#\1\"'"${ENCRYPTION_METHOD}"'\",#' "${CONFIG_FOR_CLIENT}" - /opt/bin/sed -E -i '\#^[[:space:]]+\"plugin\":#d' "${CONFIG_FOR_CLIENT}" - /opt/bin/sed -E -i '\#^[[:space:]]+\"plugin_opts\":#d' "${CONFIG_FOR_CLIENT}" - NUM_LAST_LINE=$(/opt/bin/sed -ne '/}/=' "${CONFIG_FOR_CLIENT}") - NUM_TARGET_LINE=$((${NUM_LAST_LINE}-1)) - /opt/bin/sed -E -i ''"${NUM_TARGET_LINE}"'s#,$##' "${CONFIG_FOR_CLIENT}" - # - if [ "$(/opt/bin/echo "${OBFUSCATION}" | /opt/bin/sed -E 's/[[:upper:]]/\l&/g')" == "enable" ] - then - /opt/bin/sed -E -i ''"${NUM_TARGET_LINE}"'s#$#,#' "${CONFIG_FOR_CLIENT}" - /opt/bin/sed -E -i '\#\}#iAAAA\"plugin\":\"obfs\-local\",' "${CONFIG_FOR_CLIENT}" - /opt/bin/sed -E -i '\#\}#iAAAA\"plugin_opts\":\"obfs=http\;obfs\-host=www\.bing\.com\"' "${CONFIG_FOR_CLIENT}" - /opt/bin/sed -E -i 's#^AAAA# #' "${CONFIG_FOR_CLIENT}" - fi - done - ;; -esac -# -exit 0 -# -########## END ########## \ No newline at end of file diff --git a/shadowsocks/bin/shadowsocks_install b/shadowsocks/bin/shadowsocks_install deleted file mode 100644 index 05d74e6..0000000 --- a/shadowsocks/bin/shadowsocks_install +++ /dev/null @@ -1,222 +0,0 @@ -#!/bin/sh -# -########## CHECK ASUS ROUTER MODEL ########## -# -ROUTER_MODEL="$(nvram get model)" -# -########## END ########## -# -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# NAME OF THE SERVICE -# 服务名称 -SERVICE_NAME="SHADOWSOCKS" -# -# FUNCTION OF THE SERVICE -# 服务功能 -SERVICE_FUNCTION="INSTALL" -# -# USB_MOUNT_POINT: The mount point of the USB flash drive -# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 -USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" -# -# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER -# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 -SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" -# -# ENTWARE_ETC: The directory which contains all the configuration files installed by Entware -# 设置自定义变量ENTWARE_ETC为Entware安装的配置文件目录 -ENTWARE_ETC="${USB_MOUNT_POINT}/etc" -# -# ENTWARE_MONITD: The directory which contains all the configuration files used by monit -# 设置自定义变量ENTWARE_MONITD为monit配置文件目录 -ENTWARE_MONITD="${ENTWARE_ETC}/monit.d" -# -# ENTWARE_FWD: The directory which contains all the configuration files used by fwd -# 设置自定义变量ENTWARE_FWD为fwd配置文件目录 -ENTWARE_FWD="${ENTWARE_ETC}/fw.d" -# -# PRIVATE_ROOT: The root directory for this program -# 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/shadowsocks" -# -# PRIVATE_BIN: The directory which contains all the executable files related to this program -# 设置自定义变量PRIVATE_BIN为此程序可执行文件目录 -PRIVATE_BIN="${PRIVATE_ROOT}/bin" -# -# PRIVATE_ETC: The directory which contains all the configuration files related to this program -# 设置自定义变量PRIVATE_ETC为此程序配置文件目录 -PRIVATE_ETC="${PRIVATE_ROOT}/etc" -# -# PACKAGE_ARCHITECTURE: Architecture of alternative packages -# 设置自定义变量PACKAGE_ARCHITECTURE为备用软件包架构 -case "$(/opt/bin/uname -m)" in - "aarch64") - PACKAGE_ARCHITECTURE="aarch64-3.10" - ;; - "armv7l") - PACKAGE_ARCHITECTURE="armv7-2.6" - ;; - "mips") - PACKAGE_ARCHITECTURE="mipselsf" - ;; - *) - # Do nothing but prompt the user - # 如果路由器架构不符合上述三种情况,则执行 - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: ROUTER ARCHITECTURE IS UNKNOWN" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;41;37mFAILURE\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 3 - ;; -esac -# -# PRIVATE_ALTERNATIVE: The directory which contains all the alternatives -# 设置自定义变量PRIVATE_ALTERNATIVE为此程序备用文件目录 -PRIVATE_ALTERNATIVE="${PRIVATE_ROOT}/alternative/${PACKAGE_ARCHITECTURE}" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ON ${ROUTER_MODEL} ---------*" -# -########## END ########## -# -# -########## INSTALL SHADOWSOCKS ########## -# -# Check if ENTWARE_ENABLE SERVICE has been loaded -# 检查ENTWARE_ENABLE SERVICE是否已启用 -if [ "$(which opkg)" == "/opt/bin/opkg" ] -then - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: ENTWARE_ENABLE SERVICE HAS BEEN LOADED" - # - # Check if MONIT MANAGEMENT SYSTEM is enabled - # 检查MONIT MANAGEMENT SYSTEM是否已启用 - if [ "$(which monit)" == "/opt/bin/monit" ] - then - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: MONIT MANAGEMENT SYSTEM HAS BEEN DEPLOYED" - # - # Update the list of available packages - # 更新可用程序包列表 - /opt/bin/opkg update - # - # Check if ${PRIVATE_ALTERNATIVE} exists - # 检查目录${PRIVATE_ALTERNATIVE}是否存在 - if [ -d "${PRIVATE_ALTERNATIVE}" ] - then - # Install shadowsocks-libev offline - # 离线安装shadowsocks-libev - /opt/bin/opkg install "${PRIVATE_ALTERNATIVE}"/shadowsocks-libev-config_*.ipk - /opt/bin/opkg install "${PRIVATE_ALTERNATIVE}"/shadowsocks-libev-ss-local_*.ipk - /opt/bin/opkg install "${PRIVATE_ALTERNATIVE}"/shadowsocks-libev-ss-redir_*.ipk - /opt/bin/opkg install "${PRIVATE_ALTERNATIVE}"/shadowsocks-libev-ss-rules_*.ipk - /opt/bin/opkg install "${PRIVATE_ALTERNATIVE}"/shadowsocks-libev-ss-server_*.ipk - /opt/bin/opkg install "${PRIVATE_ALTERNATIVE}"/shadowsocks-libev-ss-tunnel_*.ipk - # - else - # Install shadowsocks-libev online - # 在线安装shadowsocks-libev - /opt/bin/opkg install shadowsocks-libev-config - /opt/bin/opkg install shadowsocks-libev-ss-local - /opt/bin/opkg install shadowsocks-libev-ss-redir - /opt/bin/opkg install shadowsocks-libev-ss-rules - /opt/bin/opkg install shadowsocks-libev-ss-server - /opt/bin/opkg install shadowsocks-libev-ss-tunnel - fi - # - # Install haveged and simple-obfs - # 安装haveged和simple-obfs - /opt/bin/opkg install haveged - /opt/bin/opkg install simple-obfs - /opt/bin/opkg install simple-obfs-server - # - # Generate configuration files - # 生成配置文件 - /opt/bin/cp -f "${PRIVATE_ETC}/config_local.json.template" "${PRIVATE_ETC}/config_local.json" - /opt/bin/cp -f "${PRIVATE_ETC}/config_redir.json.template" "${PRIVATE_ETC}/config_redir.json" - /opt/bin/cp -f "${PRIVATE_ETC}/config_server.json.template" "${PRIVATE_ETC}/config_server.json" - /opt/bin/cp -f "${PRIVATE_ETC}/config_tunnel.json.template" "${PRIVATE_ETC}/config_tunnel.json" - "${PRIVATE_BIN}/shadowsocks_configure" - # - # Install overture - # 安装overture - "${SBL_SYS_USR}/overture/bin/overture_install" - if [ ${?} -ne 0 ] - then - exit 7 - fi - # - # Disable /opt/etc/init.d/S*shadowsocks - # 禁用/opt/etc/init.d/S*shadowsocks - /opt/bin/sed -i '/^ENABLED=/s/^/#/' /opt/etc/init.d/S*shadowsocks - /opt/bin/sed -i '/^#ENABLED=/a\ENABLED=no' /opt/etc/init.d/S*shadowsocks - # - # Configure fwd - # 配置fwd - /opt/bin/cp -f "${PRIVATE_ETC}/fw.d/ss_server_open" "${ENTWARE_FWD}" - # - # Configure dnsmasq.d - # 配置dnsmasq.d - if [ ! -d "${PRIVATE_ETC}/dnsmasq.d" ] - then - /opt/bin/mkdir "${PRIVATE_ETC}/dnsmasq.d" - fi - # - SS_TUNNEL_LOCAL_PORT="$(/opt/bin/sed -E -n -e 's/^[[:space:]]*\"local_port\":[[:space:]]*\"(.*)\".*/\1/p' "${PRIVATE_ETC}/config_tunnel.json")" - /opt/bin/echo -e "server=127.0.0.1#${SS_TUNNEL_LOCAL_PORT}" > "${PRIVATE_ETC}/dnsmasq.d/ss_tunnel_dns.conf" - # - # Configure monit - # 配置monit - /opt/bin/cp -f "${PRIVATE_ETC}/monit.d/ss_local" "${ENTWARE_MONITD}" - /opt/bin/chmod 600 "${ENTWARE_MONITD}/ss_local" - /opt/bin/mv -f "${ENTWARE_MONITD}/ss_local" "${ENTWARE_MONITD}/ss_local.on" - # - /opt/bin/cp -f "${PRIVATE_ETC}/monit.d/ss_server" "${ENTWARE_MONITD}" - /opt/bin/chmod 600 "${ENTWARE_MONITD}/ss_server" - #/opt/bin/mv -f "${ENTWARE_MONITD}/ss_server" "${ENTWARE_MONITD}/ss_server.on" - # - /opt/bin/cp -f "${PRIVATE_ETC}/monit.d/fw_filter_INPUT_ss_server" "${ENTWARE_MONITD}" - /opt/bin/chmod 600 "${ENTWARE_MONITD}/fw_filter_INPUT_ss_server" - #/opt/bin/mv -f "${ENTWARE_MONITD}/fw_filter_INPUT_ss_server" "${ENTWARE_MONITD}/fw_filter_INPUT_ss_server.on" - # - /opt/bin/cp -f "${PRIVATE_ETC}/monit.d/ss_transparent_proxy_overture_file" "${ENTWARE_MONITD}" - /opt/bin/chmod 600 "${ENTWARE_MONITD}/ss_transparent_proxy_overture_file" - /opt/bin/mv -f "${ENTWARE_MONITD}/ss_transparent_proxy_overture_file" "${ENTWARE_MONITD}/ss_transparent_proxy_overture_file.on" - # - /opt/bin/cp -f "${PRIVATE_ETC}/monit.d/ss_transparent_proxy_without_dns_file" "${ENTWARE_MONITD}" - /opt/bin/chmod 600 "${ENTWARE_MONITD}/ss_transparent_proxy_without_dns_file" - #/opt/bin/mv -f "${ENTWARE_MONITD}/ss_transparent_proxy_without_dns_file" "${ENTWARE_MONITD}/ss_transparent_proxy_without_dns_file.on" - # - /opt/bin/monit reload - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 0 - # - else - # Do nothing but prompt the user - # 如果MONIT MANAGEMENT SYSTEM未部署,则执行 - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: MONIT MANAGEMENT SYSTEM HAS NOT BEEN DEPLOYED" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: PLEASE DEPLOY MONIT MANAGEMENT SYSTEM FIRST" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;41;37mFAILURE\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 2 - fi - # -else - # Do nothing but prompt the user - # 如果ENTWARE_ENABLE SERVICE未启用,则执行 - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: ENTWARE_ENABLE SERVICE HAS NOT BEEN LOADED" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: PLEASE ENABLE ENTWARE FIRST" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;41;37mFAILURE\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 1 -fi -# -########## END ########## \ No newline at end of file diff --git a/shadowsocks/bin/shadowsocks_uninstall b/shadowsocks/bin/shadowsocks_uninstall deleted file mode 100644 index c27e430..0000000 --- a/shadowsocks/bin/shadowsocks_uninstall +++ /dev/null @@ -1,183 +0,0 @@ -#!/bin/sh -# -########## CHECK ASUS ROUTER MODEL ########## -# -ROUTER_MODEL="$(nvram get model)" -# -########## END ########## -# -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# NAME OF THE SERVICE -# 服务名称 -SERVICE_NAME="SHADOWSOCKS" -# -# FUNCTION OF THE SERVICE -# 服务功能 -SERVICE_FUNCTION="UNINSTALL" -# -# USB_MOUNT_POINT: The mount point of the USB flash drive -# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 -USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" -# -# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER -# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 -SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" -# -# ENTWARE_ETC: The directory which contains all the configuration files installed by Entware -# 设置自定义变量ENTWARE_ETC为Entware安装的配置文件目录 -ENTWARE_ETC="${USB_MOUNT_POINT}/etc" -# -# ENTWARE_MONITD: The directory which contains all the configuration files used by monit -# 设置自定义变量ENTWARE_MONITD为monit配置文件目录 -ENTWARE_MONITD="${ENTWARE_ETC}/monit.d" -# -# ENTWARE_FWD: The directory which contains all the configuration files used by fwd -# 设置自定义变量ENTWARE_FWD为fwd配置文件目录 -ENTWARE_FWD="${ENTWARE_ETC}/fw.d" -# -# PRIVATE_ROOT: The root directory for this program -# 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/shadowsocks" -# -# PRIVATE_ETC: The directory which contains all the configuration files related to this program -# 设置自定义变量PRIVATE_ETC为此程序配置文件目录 -PRIVATE_ETC="${PRIVATE_ROOT}/etc" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ON ${ROUTER_MODEL} ---------*" -# -########## END ########## -# -# -########## UNINSTALL SHADOWSOCKS ########## -# -# Check if ENTWARE_ENABLE SERVICE has been loaded -# 检查ENTWARE_ENABLE SERVICE是否已启用 -if [ "$(which opkg)" == "/opt/bin/opkg" ] -then - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: ENTWARE_ENABLE SERVICE HAS BEEN LOADED" - # - # Check if MONIT MANAGEMENT SYSTEM is enabled - # 检查MONIT MANAGEMENT SYSTEM是否已启用 - if [ "$(which monit)" == "/opt/bin/monit" ] - then - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: MONIT MANAGEMENT SYSTEM HAS BEEN DEPLOYED" - # - # Check if ${SERVICE_NAME} has been installed - # 检查${SERVICE_NAME}是否已安装 - if [ ! -e "/opt/bin/ss-local" ] - then - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: ${SERVICE_NAME} IS NOT INSTALLED" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;41;37mFAILURE\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 3 - fi - # - # Stop SHADOWSOCKS service - # 停止SHADOWSOCKS服务 - /opt/bin/monit stop "SS_LOCAL" > /dev/null 2>&1 - /opt/bin/monit stop "SS_REDIR" > /dev/null 2>&1 - /opt/bin/monit stop "SS_SERVER" > /dev/null 2>&1 - /opt/bin/monit stop "FW_PORT_OPENING_SS_SERVER" > /dev/null 2>&1 - /opt/bin/monit stop "SS_TUNNEL" > /dev/null 2>&1 - /opt/bin/monit stop "SS_TRANSPARENT_PROXY" > /dev/null 2>&1 - # - # Wait until SHADOWSOCKS service is terminated - # 等待直至SHADOWSOCKS service被终止 - while [ -n "$(pidof ss-local)" ] || [ -n "$(pidof ss-redir)" ] || [ -n "$(pidof ss-server)" ] || [ -n "$(pidof ss-tunnel)" ] - do - /opt/bin/sleep 5 - done - # - # Uninstall overture - # 卸载overture - "${SBL_SYS_USR}/overture/bin/overture_uninstall" - # - # Enable /opt/etc/init.d/S*shadowsocks - # 启用/opt/etc/init.d/S*shadowsocks - /opt/bin/sed -i '/^ENABLED=no/d' /opt/etc/init.d/S*shadowsocks - /opt/bin/sed -i '/^#ENABLED=.*/s/#//' /opt/etc/init.d/S*shadowsocks - # - # Configure shadowsocks - # 配置shadowsocks - /opt/bin/rm -f "${PRIVATE_ETC}/config_local.json" - /opt/bin/rm -f "${PRIVATE_ETC}/config_redir.json" - /opt/bin/rm -f "${PRIVATE_ETC}/config_server.json" - /opt/bin/rm -f "${PRIVATE_ETC}/config_tunnel.json" - /opt/bin/rm -rf "${PRIVATE_ETC}/dnsmasq.d" - # - # Uninstall haveged and simple-obfs - # 卸载haveged和simple-obfs - /opt/bin/opkg remove simple-obfs-server - /opt/bin/opkg remove simple-obfs - /opt/bin/opkg remove haveged - # - # Uninstall shadowsocks - # 卸载shadowsocks - /opt/bin/opkg remove shadowsocks-libev-ss-tunnel - /opt/bin/opkg remove shadowsocks-libev-ss-server - /opt/bin/opkg remove shadowsocks-libev-ss-rules - /opt/bin/opkg remove shadowsocks-libev-ss-redir - /opt/bin/opkg remove shadowsocks-libev-ss-local - /opt/bin/opkg remove shadowsocks-libev-config - # - # Configure fwd - # 配置fwd - /opt/bin/rm -f "${ENTWARE_FWD}/ss_server_open" - # - # Configure monit - # 配置monit - /opt/bin/rm -f "${ENTWARE_MONITD}/ss_local.on" - /opt/bin/rm -f "${ENTWARE_MONITD}/ss_local" - /opt/bin/rm -f "${ENTWARE_MONITD}/ss_redir.on" - /opt/bin/rm -f "${ENTWARE_MONITD}/ss_redir" - /opt/bin/rm -f "${ENTWARE_MONITD}/ss_server.on" - /opt/bin/rm -f "${ENTWARE_MONITD}/ss_server" - /opt/bin/rm -f "${ENTWARE_MONITD}/fw_filter_INPUT_ss_server.on" - /opt/bin/rm -f "${ENTWARE_MONITD}/fw_filter_INPUT_ss_server" - /opt/bin/rm -f "${ENTWARE_MONITD}/ss_tunnel.on" - /opt/bin/rm -f "${ENTWARE_MONITD}/ss_tunnel" - /opt/bin/rm -f "${ENTWARE_MONITD}/ss_transparent_proxy_file.on" - /opt/bin/rm -f "${ENTWARE_MONITD}/ss_transparent_proxy_file" - /opt/bin/rm -f "${ENTWARE_MONITD}/ss_transparent_proxy_overture_file.on" - /opt/bin/rm -f "${ENTWARE_MONITD}/ss_transparent_proxy_overture_file" - /opt/bin/rm -f "${ENTWARE_MONITD}/ss_transparent_proxy_overture_prog.on" - /opt/bin/rm -f "${ENTWARE_MONITD}/ss_transparent_proxy_overture_prog" - /opt/bin/rm -f "${ENTWARE_MONITD}/ss_transparent_proxy_without_dns_file.on" - /opt/bin/rm -f "${ENTWARE_MONITD}/ss_transparent_proxy_without_dns_file" - /opt/bin/monit reload - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 0 - # - else - # Do nothing but prompt the user - # 如果MONIT MANAGEMENT SYSTEM未部署,则执行 - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: MONIT MANAGEMENT SYSTEM HAS NOT BEEN DEPLOYED" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: PLEASE DEPLOY MONIT MANAGEMENT SYSTEM FIRST" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;41;37mFAILURE\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 2 - fi - # -else - # Do nothing but prompt the user - # 如果ENTWARE_ENABLE SERVICE未启用,则执行 - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: ENTWARE_ENABLE SERVICE HAS NOT BEEN LOADED" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: PLEASE ENABLE ENTWARE FIRST" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;41;37mFAILURE\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 1 -fi -# -########## END ########## \ No newline at end of file diff --git a/shadowsocks/bin/ss_local_enable.service b/shadowsocks/bin/ss_local_enable.service deleted file mode 100644 index 026c318..0000000 --- a/shadowsocks/bin/ss_local_enable.service +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# NAME OF THE SERVICE -# 服务名称 -SERVICE_NAME="SS-LOCAL" -# -# FUNCTION OF THE SERVICE -# 服务功能 -SERVICE_FUNCTION="ENABLE" -# -# USB_MOUNT_POINT: The mount point of the USB flash drive -# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 -USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" -# -# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER -# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 -SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" -# -# PRIVATE_ROOT: The root directory for this program -# 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/shadowsocks" -# -# PRIVATE_ETC: The directory which contains all the configuration files related to this program -# 设置自定义变量PRIVATE_ETC为此程序配置文件目录 -PRIVATE_ETC="${PRIVATE_ROOT}/etc" -# -# SS_LOCAL_PID_FILE: The path to ss_local.pid -# 设置自定义变量SS_LOCAL_PID_FILE为文件ss_local.pid的绝对路径 -SS_LOCAL_PID_FILE="/var/run/ss_local.pid" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ---------*" -# -########## END ########## -# -# -########## CHECK AND ENABLE SS-LOCAL ########## -# -# Check if ${PRIVATE_ETC}/config_local.json exist -# 检查文件${PRIVATE_ETC}/config_local.json是否存在 -if [ -e "${PRIVATE_ETC}/config_local.json" ] -then - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: ALL THE PREREQUISITES ARE MET" - # - # Load ss-local - # 如果文件${PRIVATE_ETC}/config_local.json存在,则执行 - /opt/bin/ss-local -c "${PRIVATE_ETC}/config_local.json" -f "${SS_LOCAL_PID_FILE}" - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 0 - # -else - # Do nothing but prompt the user - # 如果文件${PRIVATE_ETC}/config_local.json不存在,则执行 - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: NOT ALL THE PREREQUISITES ARE MET" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;41;37mFAILURE\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 1 -fi -# -########## END ########## \ No newline at end of file diff --git a/shadowsocks/bin/ss_redir_disable.service b/shadowsocks/bin/ss_redir_disable.service deleted file mode 100644 index 570b466..0000000 --- a/shadowsocks/bin/ss_redir_disable.service +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# NAME OF THE SERVICE -# 服务名称 -SERVICE_NAME="SS-REDIR" -# -# FUNCTION OF THE SERVICE -# 服务功能 -SERVICE_FUNCTION="DISABLE" -# -# SS_REDIR_PID_FILE: The path to ss_redir.pid -# 设置自定义变量SS_REDIR_PID_FILE为文件ss_redir.pid的绝对路径 -SS_REDIR_PID_FILE="/var/run/ss_redir.pid" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ---------*" -# -########## END ########## -# -# -########## DISABLE SS-REDIR ########## -# -for PID in $(/opt/bin/cat "${SS_REDIR_PID_FILE}") -do - /opt/bin/kill ${PID} -done -# -/opt/bin/rm -f "${SS_REDIR_PID_FILE}" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" -# -exit 0 -# -########## END ########## \ No newline at end of file diff --git a/shadowsocks/bin/ss_redir_enable.service b/shadowsocks/bin/ss_redir_enable.service deleted file mode 100644 index bd311bf..0000000 --- a/shadowsocks/bin/ss_redir_enable.service +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# NAME OF THE SERVICE -# 服务名称 -SERVICE_NAME="SS-REDIR" -# -# FUNCTION OF THE SERVICE -# 服务功能 -SERVICE_FUNCTION="ENABLE" -# -# USB_MOUNT_POINT: The mount point of the USB flash drive -# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 -USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" -# -# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER -# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 -SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" -# -# PRIVATE_ROOT: The root directory for this program -# 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/shadowsocks" -# -# PRIVATE_ETC: The directory which contains all the configuration files related to this program -# 设置自定义变量PRIVATE_ETC为此程序配置文件目录 -PRIVATE_ETC="${PRIVATE_ROOT}/etc" -# -# SS_REDIR_PID_FILE: The path to ss_redir.pid -# 设置自定义变量SS_REDIR_PID_FILE为文件ss_redir.pid的绝对路径 -SS_REDIR_PID_FILE="/var/run/ss_redir.pid" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ---------*" -# -########## END ########## -# -# -########## CHECK AND ENABLE SS-REDIR ########## -# -# Check if ${PRIVATE_ETC}/config_redir.json exist -# 检查文件${PRIVATE_ETC}/config_redir.json是否存在 -if [ -e "${PRIVATE_ETC}/config_redir.json" ] -then - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: ALL THE PREREQUISITES ARE MET" - # - # Load ss-redir - # 如果文件${PRIVATE_ETC}/config_redir.json存在,则执行 - /opt/bin/ss-redir -c "${PRIVATE_ETC}/config_redir.json" -f "${SS_REDIR_PID_FILE}" - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 0 - # -else - # Do nothing but prompt the user - # 如果文件${PRIVATE_ETC}/config_redir.json不存在,则执行 - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: NOT ALL THE PREREQUISITES ARE MET" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;41;37mFAILURE\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 1 -fi -# -########## END ########## \ No newline at end of file diff --git a/shadowsocks/bin/ss_server_disable.service b/shadowsocks/bin/ss_server_disable.service deleted file mode 100644 index 15b9a24..0000000 --- a/shadowsocks/bin/ss_server_disable.service +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# NAME OF THE SERVICE -# 服务名称 -SERVICE_NAME="SS-SERVER" -# -# FUNCTION OF THE SERVICE -# 服务功能 -SERVICE_FUNCTION="DISABLE" -# -# SS_SERVER_PID_FILE: The path to ss_server.pid -# 设置自定义变量SS_SERVER_PID_FILE为文件ss_server.pid的绝对路径 -SS_SERVER_PID_FILE="/var/run/ss_server.pid" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ---------*" -# -########## END ########## -# -# -########## DISABLE SS-SERVER ########## -# -for PID in $(/opt/bin/cat "${SS_SERVER_PID_FILE}") -do - /opt/bin/kill ${PID} -done -# -/opt/bin/rm -f "${SS_SERVER_PID_FILE}" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" -# -exit 0 -# -########## END ########## \ No newline at end of file diff --git a/shadowsocks/bin/ss_server_enable.service b/shadowsocks/bin/ss_server_enable.service deleted file mode 100644 index 7c5661e..0000000 --- a/shadowsocks/bin/ss_server_enable.service +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# NAME OF THE SERVICE -# 服务名称 -SERVICE_NAME="SS-SERVER" -# -# FUNCTION OF THE SERVICE -# 服务功能 -SERVICE_FUNCTION="ENABLE" -# -# USB_MOUNT_POINT: The mount point of the USB flash drive -# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 -USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" -# -# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER -# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 -SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" -# -# PRIVATE_ROOT: The root directory for this program -# 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/shadowsocks" -# -# PRIVATE_ETC: The directory which contains all the configuration files related to this program -# 设置自定义变量PRIVATE_ETC为此程序配置文件目录 -PRIVATE_ETC="${PRIVATE_ROOT}/etc" -# -# SS_SERVER_PID_FILE: The path to ss_server.pid -# 设置自定义变量SS_SERVER_PID_FILE为文件ss_server.pid的绝对路径 -SS_SERVER_PID_FILE="/var/run/ss_server.pid" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ---------*" -# -########## END ########## -# -# -########## CHECK AND ENABLE SS-SERVER ########## -# -# Check if ${PRIVATE_ETC}/config_server.json exist -# 检查文件${PRIVATE_ETC}/config_server.json是否存在 -if [ -e "${PRIVATE_ETC}/config_server.json" ] -then - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: ALL THE PREREQUISITES ARE MET" - # - # Load ss-server - # 如果文件${PRIVATE_ETC}/config_server.json存在,则执行 - /opt/bin/ss-server -c "${PRIVATE_ETC}/config_server.json" -f "${SS_SERVER_PID_FILE}" - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 0 - # -else - # Do nothing but prompt the user - # 如果文件${PRIVATE_ETC}/config_server.json不存在,则执行 - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: NOT ALL THE PREREQUISITES ARE MET" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;41;37mFAILURE\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 1 -fi -# -########## END ########## \ No newline at end of file diff --git a/shadowsocks/bin/ss_transparent_proxy_disable_file.service b/shadowsocks/bin/ss_transparent_proxy_disable_file.service deleted file mode 100644 index b90907d..0000000 --- a/shadowsocks/bin/ss_transparent_proxy_disable_file.service +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# NAME OF THE SERVICE -# 服务名称 -SERVICE_NAME="SS_TRANSPARENT_PROXY" -# -# FUNCTION OF THE SERVICE -# 服务功能 -SERVICE_FUNCTION="DISABLE" -# -# USB_MOUNT_POINT: The mount point of the USB flash drive -# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 -USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" -# -# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER -# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 -SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" -# -# ENTWARE_ETC: The directory which contains all the configuration files installed by Entware -# 设置自定义变量ENTWARE_ETC为Entware安装的配置文件目录 -ENTWARE_ETC="${USB_MOUNT_POINT}/etc" -# -# ENTWARE_DNSMASQD: The directory which contains all the configuration files used by dnsmasq -# 设置自定义变量ENTWARE_DNSMASQD为dnsmasq配置文件目录 -ENTWARE_DNSMASQD="${ENTWARE_ETC}/dnsmasq.d" -# -# PRIVATE_ROOT: The root directory for this program -# 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/shadowsocks" -# -# PRIVATE_BIN: The directory which contains all the executable files related to this program -# 设置自定义变量PRIVATE_BIN为此程序可执行文件目录 -PRIVATE_BIN="${PRIVATE_ROOT}/bin" -# -# PRIVATE_ETC: The directory which contains all the configuration files related to this program -# 设置自定义变量PRIVATE_ETC为此程序配置文件目录 -PRIVATE_ETC="${PRIVATE_ROOT}/etc" -# -# SERVER_DOMAIN: Domain of the SS-SERVER -# 设置自定义变量SERVER_DOMAIN为SS-SERVER的域名 -SERVER_DOMAIN="$(/opt/bin/sed -E -n -e 's/^[[:space:]]*\"server\":[[:space:]]*\"(.*)\".*/\1/p' "${PRIVATE_ETC}/config_redir.json")" -# -# ADMINUSER: The administrator of the router -# 设置环境变量ADMINUSER为路由器管理页面的登陆帐号 -ADMINUSER="$(nvram get sbl_username)" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ---------*" -# -########## END ########## -# -# -########## DISABLE CRONTAB ########## -# -# Disable crontab because something is wrong with the poll time of monit -# 因为monit的执行周期BUG,故禁用crontab进行进程周期执行 -/opt/bin/sed -i '/ss_transparent_proxy_enable_file.service/d' "/var/spool/cron/crontabs/${ADMINUSER}" -# -# Remove status file -# 删除状态文件 -/opt/bin/rm -f "/var/run/ss_transparent_proxy_enable_file" -# -########## END ########## -# -# -########## DISABLE SS-REDIR, SS-TUNNEL AND SS-FW ########## -# -# Stop all the relevant processes -# 停止全部相关进程 -"${PRIVATE_BIN}/fw_ss_transparent_proxy_disable.service" > /dev/null 2>&1 -/opt/bin/sleep 2 -"${PRIVATE_BIN}/ss_tunnel_disable.service" > /dev/null 2>&1 -/opt/bin/sleep 2 -"${PRIVATE_BIN}/ss_redir_disable.service" > /dev/null 2>&1 -/opt/bin/sleep 2 -# -# Update /etc/hosts -# 更新文件/etc/hosts -/opt/bin/sed -i '/'"${SERVER_DOMAIN}"'/d' "/etc/hosts" -# -# Update DNS server -# 更新DNS服务器 -/opt/bin/mv -f "/tmp/resolv.dnsmasq.bak" "/tmp/resolv.dnsmasq" -/opt/bin/rm -f "${ENTWARE_DNSMASQD}/ss_tunnel_dns.conf" -/opt/bin/dnsmasq.d_refresh > /dev/null 2>&1 -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" -# -exit 0 -# -########## END ########## \ No newline at end of file diff --git a/shadowsocks/bin/ss_transparent_proxy_enable_file.service b/shadowsocks/bin/ss_transparent_proxy_enable_file.service deleted file mode 100644 index 362fb88..0000000 --- a/shadowsocks/bin/ss_transparent_proxy_enable_file.service +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# USB_MOUNT_POINT: The mount point of the USB flash drive -# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 -USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" -# -# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER -# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 -SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" -# -# ENTWARE_ETC: The directory which contains all the configuration files installed by Entware -# 设置自定义变量ENTWARE_ETC为Entware安装的配置文件目录 -ENTWARE_ETC="${USB_MOUNT_POINT}/etc" -# -# ENTWARE_DNSMASQD: The directory which contains all the configuration files used by dnsmasq -# 设置自定义变量ENTWARE_DNSMASQD为dnsmasq配置文件目录 -ENTWARE_DNSMASQD="${ENTWARE_ETC}/dnsmasq.d" -# -# PRIVATE_ROOT: The root directory for this program -# 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/shadowsocks" -# -# PRIVATE_BIN: The directory which contains all the executable files related to this program -# 设置自定义变量PRIVATE_BIN为此程序可执行文件目录 -PRIVATE_BIN="${PRIVATE_ROOT}/bin" -# -# PRIVATE_ETC: The directory which contains all the configuration files related to this program -# 设置自定义变量PRIVATE_ETC为此程序配置文件目录 -PRIVATE_ETC="${PRIVATE_ROOT}/etc" -# -# SS_REDIR_PID_FILE: The path to ss_redir.pid -# 设置自定义变量SS_REDIR_PID_FILE为文件ss_redir.pid的绝对路径 -SS_REDIR_PID_FILE="/var/run/ss_redir.pid" -# -# SS_TUNNEL_PID_FILE: The path to ss_tunnel.pid -# 设置自定义变量SS_TUNNEL_PID_FILE为文件ss_tunnel.pid的绝对路径 -SS_TUNNEL_PID_FILE="/var/run/ss_tunnel.pid" -# -# SERVER_DOMAIN: Domain of the SS-SERVER -# 设置自定义变量SERVER_DOMAIN为SS-SERVER的域名 -SERVER_DOMAIN="$(/opt/bin/sed -E -n -e 's/^[[:space:]]*\"server\":[[:space:]]*\"(.*)\".*/\1/p' "${PRIVATE_ETC}/config_redir.json")" -# -# SERVER_IP: Domain of the SS-SERVER -# 设置自定义变量SERVER_IP为SS-SERVER的IP地址 -SERVER_IP="$(nslookup "${SERVER_DOMAIN}" | /opt/bin/sed -E -n -e '/Name/,+1s/.*:[[:space:]]+(([[:digit:]]+\.?){4})[[:space:]]+.*/\1/p')" -# -# BUILT_IN_CHAIN_NAME: Name of the built-in chain -# 设置自定义变量BUILT_IN_CHAIN_NAME为防火墙默认链名 -BUILT_IN_CHAIN_NAME="$(/opt/bin/sed -E -n -e 's/^BUILT_IN_CHAIN_NAME=\"(.*)\"/\1/p' "${PRIVATE_BIN}/fw_ss_transparent_proxy_enable.service")" -# -# USER_DEFINED_CHAIN_NAME: Name of the user-defined chain -# 设置自定义变量USER_DEFINED_CHAIN_NAME为防火墙自定义链名 -USER_DEFINED_CHAIN_NAME="$(/opt/bin/sed -E -n -e 's/^USER_DEFINED_CHAIN_NAME=\"(.*)\"/\1/p' "${PRIVATE_BIN}/fw_ss_transparent_proxy_enable.service")" -# -# DNS_PORT: Local port of ss-tunnel -# 设置自定义变量DNS_PORT为ss-tunnel的本地端口 -DNS_PORT="$(/opt/bin/sed -E -n -e 's/^[[:space:]]*\"local_port\":[[:space:]]*\"(.*)\".*/\1/p' "${PRIVATE_ETC}/config_tunnel.json")" -# -# ADMINUSER: The administrator of the router -# 设置环境变量ADMINUSER为路由器管理页面的登陆帐号 -ADMINUSER="$(nvram get sbl_username)" -# -# TEST_FW: Test for firewall rules -# 设置环境变量TEST_FW为防火墙规则测试值 -# 特殊说明:必须避免双引号多重嵌套 -CHECK_RULES="$(iptables -t nat -nvL "${BUILT_IN_CHAIN_NAME}" | /opt/bin/grep ''"${USER_DEFINED_CHAIN_NAME}"'_TCP')" -if [ -n "${CHECK_RULES}" ] -then - TEST_FW="true" -else - TEST_FW="false" -fi -# -########## END ########## -# -# -########## LOAD FUNCTIONS ########## -# -checkIfProcessAlive() -{ - local PROCESS_ID_FILE="${1}" - local PROCESS_ID - # - if [ -e "${PROCESS_ID_FILE}" ] - then - for PROCESS_ID in $(/opt/bin/cat "${PROCESS_ID_FILE}") - do - if [ -z "$(ps | /opt/bin/grep -E '^[[:space:]]*'"${PROCESS_ID}"'[[:space:]]+')" ] - then - eval ${2}="false" - return - fi - done - eval ${2}="true" - else - eval ${2}="false" - fi -} -# -########## END ########## -# -# -########## ENABLE SS-REDIR, SS-TUNNEL AND SS-FW ########## -# -# Check if ${PRIVATE_BIN}/ss_redir_enable.service, ${PRIVATE_BIN}/ss_tunnel_enable.service and ${PRIVATE_BIN}/fw_ss_transparent_proxy_enable.service have been loaded -# 检查${PRIVATE_BIN}/ss_redir_enable.service,${PRIVATE_BIN}/ss_tunnel_enable.service和${PRIVATE_BIN}/fw_ss_transparent_proxy_enable.service是否被加载 -checkIfProcessAlive "${SS_REDIR_PID_FILE}" TEST_SS_REDIR -checkIfProcessAlive "${SS_TUNNEL_PID_FILE}" TEST_SS_TUNNEL -# -if ${TEST_SS_REDIR} && ${TEST_SS_TUNNEL} && ${TEST_FW} && \ -[ -e "${PRIVATE_ETC}/dnsmasq.d/ss_tunnel_dns.conf" ] -then - # Everything is OK - # 满足全部条件 - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: TRANSPARENT PROXY IS ON" - # - exit 0 - # -else - # Stop all the relevant processes - # 如果有任意条件不符,则停止全部相关进程 - "${PRIVATE_BIN}/ss_transparent_proxy_disable_file.service" > /dev/null 2>&1 - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: LOAD TRANSPARENT PROXY" - # - # Update /etc/hosts - # 更新文件/etc/hosts - /opt/bin/echo "${SERVER_IP} ${SERVER_DOMAIN}" >> "/etc/hosts" - # - # Start all the relevant processes - # 启动全部相关进程 - "${PRIVATE_BIN}/ss_redir_enable.service" > /dev/null 2>&1 - /opt/bin/sleep 2 - "${PRIVATE_BIN}/ss_tunnel_enable.service" > /dev/null 2>&1 - /opt/bin/sleep 2 - "${PRIVATE_BIN}/fw_ss_transparent_proxy_enable.service" > /dev/null 2>&1 - /opt/bin/sleep 2 - # - # Update DNS server - # 更新DNS服务器 - /opt/bin/mv -f "/tmp/resolv.dnsmasq" "/tmp/resolv.dnsmasq.bak" - /opt/bin/cp -lf "${PRIVATE_ETC}/dnsmasq.d/ss_tunnel_dns.conf" "${ENTWARE_DNSMASQD}" - /opt/bin/dnsmasq.d_refresh > /dev/null 2>&1 - # - ########## END ########## - # - # - ########## ENABLE CRONTAB ########## - # - # Enable crontab because something is wrong with the poll time of monit - # 因为monit的执行周期BUG,故启用crontab进行进程周期执行 - /opt/bin/echo "*/5 * * * * \"${PRIVATE_BIN}/ss_transparent_proxy_enable_file.service\"" >> "/var/spool/cron/crontabs/${ADMINUSER}" - /opt/bin/chmod 600 "/var/spool/cron/crontabs/${ADMINUSER}" - # - # Create status file - # 创建状态文件 - /opt/bin/touch "/var/run/ss_transparent_proxy_enable_file" - # - ########## END ########## - # - # - exit 1 - # -fi -# -########## END ########## \ No newline at end of file diff --git a/shadowsocks/bin/ss_transparent_proxy_overture_disable_file.service b/shadowsocks/bin/ss_transparent_proxy_overture_disable_file.service deleted file mode 100644 index d5249b8..0000000 --- a/shadowsocks/bin/ss_transparent_proxy_overture_disable_file.service +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# NAME OF THE SERVICE -# 服务名称 -SERVICE_NAME="SS_TRANSPARENT_PROXY" -# -# FUNCTION OF THE SERVICE -# 服务功能 -SERVICE_FUNCTION="DISABLE" -# -# USB_MOUNT_POINT: The mount point of the USB flash drive -# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 -USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" -# -# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER -# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 -SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" -# -# PRIVATE_ROOT: The root directory for this program -# 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/shadowsocks" -# -# PRIVATE_BIN: The directory which contains all the executable files related to this program -# 设置自定义变量PRIVATE_BIN为此程序可执行文件目录 -PRIVATE_BIN="${PRIVATE_ROOT}/bin" -# -# PRIVATE_ETC: The directory which contains all the configuration files related to this program -# 设置自定义变量PRIVATE_ETC为此程序配置文件目录 -PRIVATE_ETC="${PRIVATE_ROOT}/etc" -# -# SERVER_DOMAIN: Domain of the SS-SERVER -# 设置自定义变量SERVER_DOMAIN为SS-SERVER的域名 -SERVER_DOMAIN="$(/opt/bin/sed -E -n -e 's/^[[:space:]]*\"server\":[[:space:]]*\"(.*)\".*/\1/p' "${PRIVATE_ETC}/config_redir.json")" -# -# ADMINUSER: The administrator of the router -# 设置环境变量ADMINUSER为路由器管理页面的登陆帐号 -ADMINUSER="$(nvram get sbl_username)" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ---------*" -# -########## END ########## -# -# -########## DISABLE CRONTAB ########## -# -# Disable crontab because something is wrong with the poll time of monit -# 因为monit的执行周期BUG,故禁用crontab进行进程周期执行 -/opt/bin/sed -i '/ss_transparent_proxy_overture_enable_file.service/d' "/var/spool/cron/crontabs/${ADMINUSER}" -# -# Remove status file -# 删除状态文件 -/opt/bin/rm -f "/var/run/ss_transparent_proxy_overture_enable_file" -# -########## END ########## -# -# -########## DISABLE SS-REDIR, SS-LOCAL, OVERTURE AND SS-FW ########## -# -# Stop all the relevant processes -# 停止全部相关进程 -"${PRIVATE_BIN}/fw_ss_transparent_proxy_disable.service" > /dev/null 2>&1 -/opt/bin/sleep 2 -"${SBL_SYS_USR}/overture/bin/overture_disable.service" > /dev/null 2>&1 -/opt/bin/sleep 2 -"${PRIVATE_BIN}/ss_local_disable.service" > /dev/null 2>&1 -/opt/bin/sleep 2 -"${PRIVATE_BIN}/ss_redir_disable.service" > /dev/null 2>&1 -/opt/bin/sleep 2 -# -# Update /etc/hosts -# 更新文件/etc/hosts -/opt/bin/sed -i '/'"${SERVER_DOMAIN}"'/d' "/etc/hosts" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" -# -exit 0 -# -########## END ########## \ No newline at end of file diff --git a/shadowsocks/bin/ss_transparent_proxy_overture_disable_prog.service b/shadowsocks/bin/ss_transparent_proxy_overture_disable_prog.service deleted file mode 100644 index 19194e5..0000000 --- a/shadowsocks/bin/ss_transparent_proxy_overture_disable_prog.service +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# NAME OF THE SERVICE -# 服务名称 -SERVICE_NAME="SS_TRANSPARENT_PROXY" -# -# FUNCTION OF THE SERVICE -# 服务功能 -SERVICE_FUNCTION="DISABLE" -# -# USB_MOUNT_POINT: The mount point of the USB flash drive -# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 -USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" -# -# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER -# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 -SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" -# -# PRIVATE_ROOT: The root directory for this program -# 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/shadowsocks" -# -# PRIVATE_BIN: The directory which contains all the executable files related to this program -# 设置自定义变量PRIVATE_BIN为此程序可执行文件目录 -PRIVATE_BIN="${PRIVATE_ROOT}/bin" -# -# PRIVATE_ETC: The directory which contains all the configuration files related to this program -# 设置自定义变量PRIVATE_ETC为此程序配置文件目录 -PRIVATE_ETC="${PRIVATE_ROOT}/etc" -# -# SERVER_DOMAIN: Domain of the SS-SERVER -# 设置自定义变量SERVER_DOMAIN为SS-SERVER的域名 -SERVER_DOMAIN="$(/opt/bin/sed -E -n -e 's/^[[:space:]]*\"server\":[[:space:]]*\"(.*)\".*/\1/p' "${PRIVATE_ETC}/config_redir.json")" -# -# ADMINUSER: The administrator of the router -# 设置环境变量ADMINUSER为路由器管理页面的登陆帐号 -ADMINUSER="$(nvram get sbl_username)" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ---------*" -# -########## END ########## -# -# -########## DISABLE CRONTAB ########## -# -# Disable crontab because something is wrong with the poll time of monit -# 因为monit的执行周期BUG,故禁用crontab进行进程周期执行 -#/opt/bin/sed -i '/ss_transparent_proxy_overture_enable_file.service/d' "/var/spool/cron/crontabs/${ADMINUSER}" -# -# Remove status file -# 删除状态文件 -#/opt/bin/rm -f "/var/run/ss_transparent_proxy_overture_enable_file" -# -########## END ########## -# -# -########## DISABLE SS-REDIR, SS-LOCAL, OVERTURE AND SS-FW ########## -# -# Stop all the relevant processes -# 停止全部相关进程 -"${PRIVATE_BIN}/fw_ss_transparent_proxy_disable.service" > /dev/null 2>&1 -/opt/bin/sleep 2 -"${SBL_SYS_USR}/overture/bin/overture_disable.service" > /dev/null 2>&1 -/opt/bin/sleep 2 -"${PRIVATE_BIN}/ss_local_disable.service" > /dev/null 2>&1 -/opt/bin/sleep 2 -"${PRIVATE_BIN}/ss_redir_disable.service" > /dev/null 2>&1 -/opt/bin/sleep 2 -# -# Update /etc/hosts -# 更新文件/etc/hosts -/opt/bin/sed -i '/'"${SERVER_DOMAIN}"'/d' "/etc/hosts" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" -# -exit 0 -# -########## END ########## \ No newline at end of file diff --git a/shadowsocks/bin/ss_transparent_proxy_overture_enable_file.service b/shadowsocks/bin/ss_transparent_proxy_overture_enable_file.service deleted file mode 100644 index 524fbb3..0000000 --- a/shadowsocks/bin/ss_transparent_proxy_overture_enable_file.service +++ /dev/null @@ -1,159 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# USB_MOUNT_POINT: The mount point of the USB flash drive -# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 -USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" -# -# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER -# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 -SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" -# -# PRIVATE_ROOT: The root directory for this program -# 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/shadowsocks" -# -# PRIVATE_BIN: The directory which contains all the executable files related to this program -# 设置自定义变量PRIVATE_BIN为此程序可执行文件目录 -PRIVATE_BIN="${PRIVATE_ROOT}/bin" -# -# PRIVATE_ETC: The directory which contains all the configuration files related to this program -# 设置自定义变量PRIVATE_ETC为此程序配置文件目录 -PRIVATE_ETC="${PRIVATE_ROOT}/etc" -# -# SS_REDIR_PID_FILE: The path to ss_redir.pid -# 设置自定义变量SS_REDIR_PID_FILE为文件ss_redir.pid的绝对路径 -SS_REDIR_PID_FILE="/var/run/ss_redir.pid" -# -# SS_LOCAL_PID_FILE: The path to ss_local.pid -# 设置自定义变量SS_LOCAL_PID_FILE为文件ss_local.pid的绝对路径 -SS_LOCAL_PID_FILE="/var/run/ss_local.pid" -# -# OVERTURE_PID_FILE: The path to overture.pid -# 设置自定义变量OVERTURE_PID_FILE为文件overture.pid的绝对路径 -OVERTURE_PID_FILE="/var/run/overture.pid" -# -# SERVER_DOMAIN: Domain of the SS-SERVER -# 设置自定义变量SERVER_DOMAIN为SS-SERVER的域名 -SERVER_DOMAIN="$(/opt/bin/sed -E -n -e 's/^[[:space:]]*\"server\":[[:space:]]*\"(.*)\".*/\1/p' "${PRIVATE_ETC}/config_redir.json")" -# -# SERVER_IP: Domain of the SS-SERVER -# 设置自定义变量SERVER_IP为SS-SERVER的IP地址 -SERVER_IP="$(nslookup "${SERVER_DOMAIN}" | /opt/bin/sed -E -n -e '/Name/,+1s/.*:[[:space:]]+(([[:digit:]]+\.?){4})[[:space:]]+.*/\1/p')" -# -# BUILT_IN_CHAIN_NAME: Name of the built-in chain -# 设置自定义变量BUILT_IN_CHAIN_NAME为防火墙默认链名 -BUILT_IN_CHAIN_NAME="$(/opt/bin/sed -E -n -e 's/^BUILT_IN_CHAIN_NAME=\"(.*)\"/\1/p' "${PRIVATE_BIN}/fw_ss_transparent_proxy_enable.service")" -# -# USER_DEFINED_CHAIN_NAME: Name of the user-defined chain -# 设置自定义变量USER_DEFINED_CHAIN_NAME为防火墙自定义链名 -USER_DEFINED_CHAIN_NAME="$(/opt/bin/sed -E -n -e 's/^USER_DEFINED_CHAIN_NAME=\"(.*)\"/\1/p' "${PRIVATE_BIN}/fw_ss_transparent_proxy_enable.service")" -# -# ADMINUSER: The administrator of the router -# 设置环境变量ADMINUSER为路由器管理页面的登陆帐号 -ADMINUSER="$(nvram get sbl_username)" -# -# TEST_FW: Test for firewall rules -# 设置环境变量TEST_FW为防火墙规则测试值 -# 特殊说明:必须避免双引号多重嵌套 -CHECK_RULES="$(iptables -t nat -nvL "${BUILT_IN_CHAIN_NAME}" | /opt/bin/grep ''"${USER_DEFINED_CHAIN_NAME}"'_TCP')" -if [ -n "${CHECK_RULES}" ] -then - TEST_FW="true" -else - TEST_FW="false" -fi -# -########## END ########## -# -# -########## LOAD FUNCTIONS ########## -# -checkIfProcessAlive() -{ - local PROCESS_ID_FILE="${1}" - local PROCESS_ID - # - if [ -e "${PROCESS_ID_FILE}" ] - then - for PROCESS_ID in $(/opt/bin/cat "${PROCESS_ID_FILE}") - do - if [ -z "$(ps | /opt/bin/grep -E '^[[:space:]]*'"${PROCESS_ID}"'[[:space:]]+')" ] - then - eval ${2}="false" - return - fi - done - eval ${2}="true" - else - eval ${2}="false" - fi -} -# -########## END ########## -# -# -########## ENABLE SS-REDIR, SS-LOCAL, OVERTURE AND SS-FW ########## -# -# Check if ${PRIVATE_BIN}/ss_redir_enable.service, ${PRIVATE_BIN}/ss_local_enable.service, overture and ${PRIVATE_BIN}/fw_ss_transparent_proxy_enable.service have been loaded -# 检查${PRIVATE_BIN}/ss_redir_enable.service,${PRIVATE_BIN}/ss_local_enable.service,overture和${PRIVATE_BIN}/fw_ss_transparent_proxy_enable.service是否被加载 -checkIfProcessAlive "${SS_REDIR_PID_FILE}" TEST_SS_REDIR -checkIfProcessAlive "${SS_LOCAL_PID_FILE}" TEST_SS_LOCAL -checkIfProcessAlive "${OVERTURE_PID_FILE}" TEST_OVERTURE -# -if ${TEST_SS_REDIR} && ${TEST_SS_LOCAL} && ${TEST_OVERTURE} && ${TEST_FW} -then - # Everything is OK - # 满足全部条件 - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: TRANSPARENT PROXY IS ON" - # - exit 0 - # -else - # Stop all the relevant processes - # 如果有任意条件不符,则停止全部相关进程 - "${PRIVATE_BIN}/ss_transparent_proxy_overture_disable_file.service" > /dev/null 2>&1 - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: LOAD TRANSPARENT PROXY" - # - # Update /etc/hosts - # 更新文件/etc/hosts - /opt/bin/echo "${SERVER_IP} ${SERVER_DOMAIN}" >> "/etc/hosts" - # - # Start all the relevant processes - # 启动全部相关进程 - "${PRIVATE_BIN}/ss_redir_enable.service" > /dev/null 2>&1 - /opt/bin/sleep 2 - "${PRIVATE_BIN}/ss_local_enable.service" > /dev/null 2>&1 - /opt/bin/sleep 2 - "${SBL_SYS_USR}/overture/bin/overture_enable.service" > /dev/null 2>&1 - /opt/bin/sleep 2 - "${PRIVATE_BIN}/fw_ss_transparent_proxy_enable.service" > /dev/null 2>&1 - /opt/bin/sleep 2 - # - ########## END ########## - # - # - ########## ENABLE CRONTAB ########## - # - # Enable crontab because something is wrong with the poll time of monit - # 因为monit的执行周期BUG,故启用crontab进行进程周期执行 - /opt/bin/echo "*/5 * * * * \"${PRIVATE_BIN}/ss_transparent_proxy_overture_enable_file.service\"" >> "/var/spool/cron/crontabs/${ADMINUSER}" - /opt/bin/chmod 600 "/var/spool/cron/crontabs/${ADMINUSER}" - # - # Create status file - # 创建状态文件 - /opt/bin/touch "/var/run/ss_transparent_proxy_overture_enable_file" - # - ########## END ########## - # - # - exit 1 - # -fi -# -########## END ########## \ No newline at end of file diff --git a/shadowsocks/bin/ss_transparent_proxy_overture_enable_prog.service b/shadowsocks/bin/ss_transparent_proxy_overture_enable_prog.service deleted file mode 100644 index 69fa8ac..0000000 --- a/shadowsocks/bin/ss_transparent_proxy_overture_enable_prog.service +++ /dev/null @@ -1,159 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# USB_MOUNT_POINT: The mount point of the USB flash drive -# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 -USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" -# -# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER -# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 -SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" -# -# PRIVATE_ROOT: The root directory for this program -# 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/shadowsocks" -# -# PRIVATE_BIN: The directory which contains all the executable files related to this program -# 设置自定义变量PRIVATE_BIN为此程序可执行文件目录 -PRIVATE_BIN="${PRIVATE_ROOT}/bin" -# -# PRIVATE_ETC: The directory which contains all the configuration files related to this program -# 设置自定义变量PRIVATE_ETC为此程序配置文件目录 -PRIVATE_ETC="${PRIVATE_ROOT}/etc" -# -# SS_REDIR_PID_FILE: The path to ss_redir.pid -# 设置自定义变量SS_REDIR_PID_FILE为文件ss_redir.pid的绝对路径 -SS_REDIR_PID_FILE="/var/run/ss_redir.pid" -# -# SS_LOCAL_PID_FILE: The path to ss_local.pid -# 设置自定义变量SS_LOCAL_PID_FILE为文件ss_local.pid的绝对路径 -SS_LOCAL_PID_FILE="/var/run/ss_local.pid" -# -# OVERTURE_PID_FILE: The path to overture.pid -# 设置自定义变量OVERTURE_PID_FILE为文件overture.pid的绝对路径 -OVERTURE_PID_FILE="/var/run/overture.pid" -# -# SERVER_DOMAIN: Domain of the SS-SERVER -# 设置自定义变量SERVER_DOMAIN为SS-SERVER的域名 -SERVER_DOMAIN="$(/opt/bin/sed -E -n -e 's/^[[:space:]]*\"server\":[[:space:]]*\"(.*)\".*/\1/p' "${PRIVATE_ETC}/config_redir.json")" -# -# SERVER_IP: Domain of the SS-SERVER -# 设置自定义变量SERVER_IP为SS-SERVER的IP地址 -SERVER_IP="$(nslookup "${SERVER_DOMAIN}" | /opt/bin/sed -E -n -e '/Name/,+1s/.*:[[:space:]]+(([[:digit:]]+\.?){4})[[:space:]]+.*/\1/p')" -# -# BUILT_IN_CHAIN_NAME: Name of the built-in chain -# 设置自定义变量BUILT_IN_CHAIN_NAME为防火墙默认链名 -BUILT_IN_CHAIN_NAME="$(/opt/bin/sed -E -n -e 's/^BUILT_IN_CHAIN_NAME=\"(.*)\"/\1/p' "${PRIVATE_BIN}/fw_ss_transparent_proxy_enable.service")" -# -# USER_DEFINED_CHAIN_NAME: Name of the user-defined chain -# 设置自定义变量USER_DEFINED_CHAIN_NAME为防火墙自定义链名 -USER_DEFINED_CHAIN_NAME="$(/opt/bin/sed -E -n -e 's/^USER_DEFINED_CHAIN_NAME=\"(.*)\"/\1/p' "${PRIVATE_BIN}/fw_ss_transparent_proxy_enable.service")" -# -# ADMINUSER: The administrator of the router -# 设置环境变量ADMINUSER为路由器管理页面的登陆帐号 -ADMINUSER="$(nvram get sbl_username)" -# -# TEST_FW: Test for firewall rules -# 设置环境变量TEST_FW为防火墙规则测试值 -# 特殊说明:必须避免双引号多重嵌套 -CHECK_RULES="$(iptables -t nat -nvL "${BUILT_IN_CHAIN_NAME}" | /opt/bin/grep ''"${USER_DEFINED_CHAIN_NAME}"'_TCP')" -if [ -n "${CHECK_RULES}" ] -then - TEST_FW="true" -else - TEST_FW="false" -fi -# -########## END ########## -# -# -########## LOAD FUNCTIONS ########## -# -checkIfProcessAlive() -{ - local PROCESS_ID_FILE="${1}" - local PROCESS_ID - # - if [ -e "${PROCESS_ID_FILE}" ] - then - for PROCESS_ID in $(/opt/bin/cat "${PROCESS_ID_FILE}") - do - if [ -z "$(ps | /opt/bin/grep -E '^[[:space:]]*'"${PROCESS_ID}"'[[:space:]]+')" ] - then - eval ${2}="false" - return - fi - done - eval ${2}="true" - else - eval ${2}="false" - fi -} -# -########## END ########## -# -# -########## ENABLE SS-REDIR, SS-LOCAL, OVERTURE AND SS-FW ########## -# -# Check if ${PRIVATE_BIN}/ss_redir_enable.service, ${PRIVATE_BIN}/ss_local_enable.service, overture and ${PRIVATE_BIN}/fw_ss_transparent_proxy_enable.service have been loaded -# 检查${PRIVATE_BIN}/ss_redir_enable.service,${PRIVATE_BIN}/ss_local_enable.service,overture和${PRIVATE_BIN}/fw_ss_transparent_proxy_enable.service是否被加载 -checkIfProcessAlive "${SS_REDIR_PID_FILE}" TEST_SS_REDIR -checkIfProcessAlive "${SS_LOCAL_PID_FILE}" TEST_SS_LOCAL -checkIfProcessAlive "${OVERTURE_PID_FILE}" TEST_OVERTURE -# -if ${TEST_SS_REDIR} && ${TEST_SS_LOCAL} && ${TEST_OVERTURE} && ${TEST_FW} -then - # Everything is OK - # 满足全部条件 - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: TRANSPARENT PROXY IS ON" - # - exit 0 - # -else - # Stop all the relevant processes - # 如果有任意条件不符,则停止全部相关进程 - "${PRIVATE_BIN}/ss_transparent_proxy_overture_disable_prog.service" > /dev/null 2>&1 - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: LOAD TRANSPARENT PROXY" - # - # Update /etc/hosts - # 更新文件/etc/hosts - /opt/bin/echo "${SERVER_IP} ${SERVER_DOMAIN}" >> "/etc/hosts" - # - # Start all the relevant processes - # 启动全部相关进程 - "${PRIVATE_BIN}/ss_redir_enable.service" > /dev/null 2>&1 - /opt/bin/sleep 2 - "${PRIVATE_BIN}/ss_local_enable.service" > /dev/null 2>&1 - /opt/bin/sleep 2 - "${SBL_SYS_USR}/overture/bin/overture_enable.service" > /dev/null 2>&1 - /opt/bin/sleep 2 - "${PRIVATE_BIN}/fw_ss_transparent_proxy_enable.service" > /dev/null 2>&1 - /opt/bin/sleep 2 - # - ########## END ########## - # - # - ########## ENABLE CRONTAB ########## - # - # Enable crontab because something is wrong with the poll time of monit - # 因为monit的执行周期BUG,故启用crontab进行进程周期执行 - #/opt/bin/echo "*/5 * * * * \"${PRIVATE_BIN}/ss_transparent_proxy_overture_enable_file.service\"" >> "/var/spool/cron/crontabs/${ADMINUSER}" - #/opt/bin/chmod 600 "/var/spool/cron/crontabs/${ADMINUSER}" - # - # Create status file - # 创建状态文件 - #/opt/bin/touch "/var/run/ss_transparent_proxy_overture_enable_file" - # - ########## END ########## - # - # - exit 1 - # -fi -# -########## END ########## \ No newline at end of file diff --git a/shadowsocks/bin/ss_transparent_proxy_without_dns_disable_file.service b/shadowsocks/bin/ss_transparent_proxy_without_dns_disable_file.service deleted file mode 100644 index a5e7b51..0000000 --- a/shadowsocks/bin/ss_transparent_proxy_without_dns_disable_file.service +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# NAME OF THE SERVICE -# 服务名称 -SERVICE_NAME="SS_TRANSPARENT_PROXY" -# -# FUNCTION OF THE SERVICE -# 服务功能 -SERVICE_FUNCTION="DISABLE" -# -# USB_MOUNT_POINT: The mount point of the USB flash drive -# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 -USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" -# -# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER -# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 -SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" -# -# PRIVATE_ROOT: The root directory for this program -# 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/shadowsocks" -# -# PRIVATE_BIN: The directory which contains all the executable files related to this program -# 设置自定义变量PRIVATE_BIN为此程序可执行文件目录 -PRIVATE_BIN="${PRIVATE_ROOT}/bin" -# -# PRIVATE_ETC: The directory which contains all the configuration files related to this program -# 设置自定义变量PRIVATE_ETC为此程序配置文件目录 -PRIVATE_ETC="${PRIVATE_ROOT}/etc" -# -# SERVER_DOMAIN: Domain of the SS-SERVER -# 设置自定义变量SERVER_DOMAIN为SS-SERVER的域名 -SERVER_DOMAIN="$(/opt/bin/sed -E -n -e 's/^[[:space:]]*\"server\":[[:space:]]*\"(.*)\".*/\1/p' "${PRIVATE_ETC}/config_redir.json")" -# -# ADMINUSER: The administrator of the router -# 设置环境变量ADMINUSER为路由器管理页面的登陆帐号 -ADMINUSER="$(nvram get sbl_username)" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ---------*" -# -########## END ########## -# -# -########## DISABLE CRONTAB ########## -# -# Disable crontab because something is wrong with the poll time of monit -# 因为monit的执行周期BUG,故禁用crontab进行进程周期执行 -/opt/bin/sed -i '/ss_transparent_proxy_without_dns_enable_file.service/d' "/var/spool/cron/crontabs/${ADMINUSER}" -# -# Remove status file -# 删除状态文件 -/opt/bin/rm -f "/var/run/ss_transparent_proxy_without_dns_enable_file" -# -########## END ########## -# -# -########## DISABLE SS-REDIR AND SS-FW ########## -# -# Stop all the relevant processes -# 停止全部相关进程 -"${PRIVATE_BIN}/fw_ss_transparent_proxy_disable.service" > /dev/null 2>&1 -/opt/bin/sleep 2 -"${PRIVATE_BIN}/ss_redir_disable.service" > /dev/null 2>&1 -/opt/bin/sleep 2 -# -# Update /etc/hosts -# 更新文件/etc/hosts -/opt/bin/sed -i '/'"${SERVER_DOMAIN}"'/d' "/etc/hosts" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" -# -exit 0 -# -########## END ########## \ No newline at end of file diff --git a/shadowsocks/bin/ss_tunnel_disable.service b/shadowsocks/bin/ss_tunnel_disable.service deleted file mode 100644 index b655300..0000000 --- a/shadowsocks/bin/ss_tunnel_disable.service +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# NAME OF THE SERVICE -# 服务名称 -SERVICE_NAME="SS-TUNNEL" -# -# FUNCTION OF THE SERVICE -# 服务功能 -SERVICE_FUNCTION="DISABLE" -# -# SS_TUNNEL_PID_FILE: The path to ss_tunnel.pid -# 设置自定义变量SS_TUNNEL_PID_FILE为文件ss_tunnel.pid的绝对路径 -SS_TUNNEL_PID_FILE="/var/run/ss_tunnel.pid" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ---------*" -# -########## END ########## -# -# -########## DISABLE SS-TUNNEL ########## -# -for PID in $(/opt/bin/cat "${SS_TUNNEL_PID_FILE}") -do - /opt/bin/kill ${PID} -done -# -/opt/bin/rm -f "${SS_TUNNEL_PID_FILE}" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" -# -exit 0 -# -########## END ########## \ No newline at end of file diff --git a/shadowsocks/bin/ss_tunnel_enable.service b/shadowsocks/bin/ss_tunnel_enable.service deleted file mode 100644 index 9ce395e..0000000 --- a/shadowsocks/bin/ss_tunnel_enable.service +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# NAME OF THE SERVICE -# 服务名称 -SERVICE_NAME="SS-TUNNEL" -# -# FUNCTION OF THE SERVICE -# 服务功能 -SERVICE_FUNCTION="ENABLE" -# -# USB_MOUNT_POINT: The mount point of the USB flash drive -# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 -USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" -# -# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER -# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 -SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" -# -# PRIVATE_ROOT: The root directory for this program -# 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/shadowsocks" -# -# PRIVATE_ETC: The directory which contains all the configuration files related to this program -# 设置自定义变量PRIVATE_ETC为此程序配置文件目录 -PRIVATE_ETC="${PRIVATE_ROOT}/etc" -# -# SS_TUNNEL_PID_FILE: The path to ss_tunnel.pid -# 设置自定义变量SS_TUNNEL_PID_FILE为文件ss_tunnel.pid的绝对路径 -SS_TUNNEL_PID_FILE="/var/run/ss_tunnel.pid" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ---------*" -# -########## END ########## -# -# -########## CHECK AND ENABLE SS-TUNNEL ########## -# -# Check if ${PRIVATE_ETC}/config_tunnel.json exist -# 检查文件${PRIVATE_ETC}/config_tunnel.json是否存在 -if [ -e "${PRIVATE_ETC}/config_tunnel.json" ] -then - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: ALL THE PREREQUISITES ARE MET" - # - # Load ss-tunnel - # 如果文件${PRIVATE_ETC}/config_tunnel.json存在,则执行 - /opt/bin/ss-tunnel -c "${PRIVATE_ETC}/config_tunnel.json" -f "${SS_TUNNEL_PID_FILE}" - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 0 - # -else - # Do nothing but prompt the user - # 如果文件${PRIVATE_ETC}/config_tunnel.json不存在,则执行 - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: NOT ALL THE PREREQUISITES ARE MET" - /opt/bin/echo -e "($(basename $0)): $$ \033[1;41;37mFAILURE\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" - # - exit 1 -fi -# -########## END ########## \ No newline at end of file diff --git a/shadowsocks/etc/config_local.json.template b/shadowsocks/etc/config_local.json.template deleted file mode 100644 index e58d24f..0000000 --- a/shadowsocks/etc/config_local.json.template +++ /dev/null @@ -1,12 +0,0 @@ -{ - "server":"", - "server_port":"", - "local_address":"0.0.0.0", - "local_port":"1081", - "password":"<密码>", - "method":"aes-256-gcm", - "timeout":60, - "mode":"tcp_and_udp", - "plugin":"obfs-local", - "plugin_opts":"obfs=http;obfs-host=www.bing.com" -} \ No newline at end of file diff --git a/shadowsocks/etc/config_redir.json.template b/shadowsocks/etc/config_redir.json.template deleted file mode 100644 index a814b28..0000000 --- a/shadowsocks/etc/config_redir.json.template +++ /dev/null @@ -1,12 +0,0 @@ -{ - "server":"", - "server_port":"", - "local_address":"0.0.0.0", - "local_port":"19854", - "password":"<密码>", - "method":"aes-256-gcm", - "timeout":60, - "mode":"tcp_and_udp", - "plugin":"obfs-local", - "plugin_opts":"obfs=http;obfs-host=www.bing.com" -} \ No newline at end of file diff --git a/shadowsocks/etc/config_server.json.template b/shadowsocks/etc/config_server.json.template deleted file mode 100644 index fa1df1d..0000000 --- a/shadowsocks/etc/config_server.json.template +++ /dev/null @@ -1,10 +0,0 @@ -{ - "server":"0.0.0.0", - "server_port":"18145", - "password":"<密码>", - "method":"aes-256-gcm", - "timeout":60, - "mode":"tcp_and_udp", - "plugin":"obfs-server", - "plugin_opts":"obfs=http" -} \ No newline at end of file diff --git a/shadowsocks/etc/config_tunnel.json.template b/shadowsocks/etc/config_tunnel.json.template deleted file mode 100644 index e17900b..0000000 --- a/shadowsocks/etc/config_tunnel.json.template +++ /dev/null @@ -1,13 +0,0 @@ -{ - "server":"", - "server_port":"", - "local_address":"0.0.0.0", - "local_port":"1953", - "password":"<密码>", - "method":"aes-256-gcm", - "timeout":60, - "tunnel_address":"8.8.8.8:53", - "mode":"tcp_and_udp", - "plugin":"obfs-local", - "plugin_opts":"obfs=http;obfs-host=www.bing.com" -} \ No newline at end of file diff --git a/shadowsocks/etc/fw.d/ss_server_open b/shadowsocks/etc/fw.d/ss_server_open deleted file mode 100644 index a930330..0000000 --- a/shadowsocks/etc/fw.d/ss_server_open +++ /dev/null @@ -1,3 +0,0 @@ -NAME="SS_SERVER" -RULE="OPEN#TCP#18145" -RULE="OPEN#UDP#18145" \ No newline at end of file diff --git a/shadowsocks/etc/monit.d/fw_filter_INPUT_ss_server b/shadowsocks/etc/monit.d/fw_filter_INPUT_ss_server deleted file mode 100644 index 321ef71..0000000 --- a/shadowsocks/etc/monit.d/fw_filter_INPUT_ss_server +++ /dev/null @@ -1,4 +0,0 @@ -check program FW_PORT_OPENING_SS_SERVER with path "/opt/bin/fwd enable /opt/etc/fw.d/ss_server_open" every 6 cycles - start program = "/opt/bin/fwd enable /opt/etc/fw.d/ss_server_open" - stop program = "/opt/bin/fwd disable /opt/etc/fw.d/ss_server_open" - if status == 1 then alert \ No newline at end of file diff --git a/shadowsocks/etc/monit.d/ss_local b/shadowsocks/etc/monit.d/ss_local deleted file mode 100644 index 611a2c6..0000000 --- a/shadowsocks/etc/monit.d/ss_local +++ /dev/null @@ -1,4 +0,0 @@ -check process SS_LOCAL with pidfile '/var/run/ss_local.pid' - start program = "/opt/script_bootloader/usr/shadowsocks/bin/ss_local_enable.service" - stop program = "/opt/script_bootloader/usr/shadowsocks/bin/ss_local_disable.service" - if does not exist then restart \ No newline at end of file diff --git a/shadowsocks/etc/monit.d/ss_redir b/shadowsocks/etc/monit.d/ss_redir deleted file mode 100644 index 15e8bd5..0000000 --- a/shadowsocks/etc/monit.d/ss_redir +++ /dev/null @@ -1,4 +0,0 @@ -check process SS_REDIR with pidfile '/var/run/ss_redir.pid' - start program = "/opt/script_bootloader/usr/shadowsocks/bin/ss_redir_enable.service" - stop program = "/opt/script_bootloader/usr/shadowsocks/bin/ss_redir_disable.service" - if does not exist then restart \ No newline at end of file diff --git a/shadowsocks/etc/monit.d/ss_server b/shadowsocks/etc/monit.d/ss_server deleted file mode 100644 index becdf72..0000000 --- a/shadowsocks/etc/monit.d/ss_server +++ /dev/null @@ -1,4 +0,0 @@ -check process SS_SERVER with pidfile '/var/run/ss_server.pid' - start program = "/opt/script_bootloader/usr/shadowsocks/bin/ss_server_enable.service" - stop program = "/opt/script_bootloader/usr/shadowsocks/bin/ss_server_disable.service" - if does not exist then restart \ No newline at end of file diff --git a/shadowsocks/etc/monit.d/ss_transparent_proxy_file b/shadowsocks/etc/monit.d/ss_transparent_proxy_file deleted file mode 100644 index 3ce6097..0000000 --- a/shadowsocks/etc/monit.d/ss_transparent_proxy_file +++ /dev/null @@ -1,4 +0,0 @@ -check file SS_TRANSPARENT_PROXY path "/var/run/ss_transparent_proxy_enable_file" every 6 cycles - start program = "/opt/script_bootloader/usr/shadowsocks/bin/ss_transparent_proxy_enable_file.service" with timeout 120 seconds - stop program = "/opt/script_bootloader/usr/shadowsocks/bin/ss_transparent_proxy_disable_file.service" with timeout 120 seconds - if does not exist then alert \ No newline at end of file diff --git a/shadowsocks/etc/monit.d/ss_transparent_proxy_overture_file b/shadowsocks/etc/monit.d/ss_transparent_proxy_overture_file deleted file mode 100644 index 75da7f2..0000000 --- a/shadowsocks/etc/monit.d/ss_transparent_proxy_overture_file +++ /dev/null @@ -1,4 +0,0 @@ -check file SS_TRANSPARENT_PROXY path "/var/run/ss_transparent_proxy_overture_enable_file" every 6 cycles - start program = "/opt/script_bootloader/usr/shadowsocks/bin/ss_transparent_proxy_overture_enable_file.service" with timeout 120 seconds - stop program = "/opt/script_bootloader/usr/shadowsocks/bin/ss_transparent_proxy_overture_disable_file.service" with timeout 120 seconds - if does not exist then alert \ No newline at end of file diff --git a/shadowsocks/etc/monit.d/ss_transparent_proxy_overture_prog b/shadowsocks/etc/monit.d/ss_transparent_proxy_overture_prog deleted file mode 100644 index 49737a6..0000000 --- a/shadowsocks/etc/monit.d/ss_transparent_proxy_overture_prog +++ /dev/null @@ -1,4 +0,0 @@ -check program SS_TRANSPARENT_PROXY with path "/opt/script_bootloader/usr/shadowsocks/bin/ss_transparent_proxy_overture_enable_prog.service" every 6 cycles - start program = "/opt/script_bootloader/usr/shadowsocks/bin/ss_transparent_proxy_overture_enable_prog.service" with timeout 120 seconds - stop program = "/opt/script_bootloader/usr/shadowsocks/bin/ss_transparent_proxy_overture_disable_prog.service" with timeout 120 seconds - if status == 1 then alert \ No newline at end of file diff --git a/shadowsocks/etc/monit.d/ss_transparent_proxy_without_dns_file b/shadowsocks/etc/monit.d/ss_transparent_proxy_without_dns_file deleted file mode 100644 index 7f8b785..0000000 --- a/shadowsocks/etc/monit.d/ss_transparent_proxy_without_dns_file +++ /dev/null @@ -1,4 +0,0 @@ -check file SS_TRANSPARENT_PROXY path "/var/run/ss_transparent_proxy_without_dns_enable_file" every 6 cycles - start program = "/opt/script_bootloader/usr/shadowsocks/bin/ss_transparent_proxy_without_dns_enable_file.service" with timeout 120 seconds - stop program = "/opt/script_bootloader/usr/shadowsocks/bin/ss_transparent_proxy_without_dns_disable_file.service" with timeout 120 seconds - if does not exist then alert \ No newline at end of file diff --git a/shadowsocks/etc/monit.d/ss_tunnel b/shadowsocks/etc/monit.d/ss_tunnel deleted file mode 100644 index fff7452..0000000 --- a/shadowsocks/etc/monit.d/ss_tunnel +++ /dev/null @@ -1,4 +0,0 @@ -check process SS_TUNNEL with pidfile '/var/run/ss_tunnel.pid' - start program = "/opt/script_bootloader/usr/shadowsocks/bin/ss_tunnel_enable.service" - stop program = "/opt/script_bootloader/usr/shadowsocks/bin/ss_tunnel_disable.service" - if does not exist then restart \ No newline at end of file diff --git a/v2ray/README_zh-CN.md b/v2ray/README_zh-CN.md deleted file mode 100644 index c688c96..0000000 --- a/v2ray/README_zh-CN.md +++ /dev/null @@ -1,103 +0,0 @@ -# Readme for v2ray - -## 概述 - -1. 本插件用于安装、配置、启动和结束v2ray -2. 客户端需安装支持socks5协议/Vmess协议/Shadowsocks协议的代理工具连接本插件 - - | 客户端 | 代理工具 | - | ------- | ------------ | - | Chrome | SwitchyOmega | - | iOS | Quantumult | - | Android | BifrostV | - -3. 支持全局透明代理。华硕原厂固件仅能代理TCP流量,梅林固件可以代理TCP和UDP流量 -4. 监听端口:1080, 2053, 45154, 22815, 22816, 22817, 22818 - - | 协议 | 端口号 | 代理 | 使用场景 | - | ----------- | ------ | ------ | ------------------------------ | - | socks5 | 1080 | VPS | 内网设备科学上网 | - | http | 2080 | VPS | 内网设备科学上网 | - | dokodemo | 2053 | VPS | 内网设备透明代理DNS转发 | - | dokodemo | 45154 | VPS | 内网设备透明代理REDIRECT转发 | - | vmess | 22815 | VPS | 外网设备接入路由器实现科学上网 | - | shadowsocks | 22816 | VPS | 外网设备接入路由器实现科学上网 | - | vmess | 22817 | 路由器 | 外网设备接入路由器实现回国上网 | - | shadowsock | 22818 | 路由器 | 外网设备接入路由器实现回国上网 | - -## 安装前提 - -1. 必须安装并启用entware和monit -2. 必须安装fwd并启用fw_filter_INPUT_v2ray_proxy - -## 文件结构 - -`ASUS_ROUTER/script_bootloader/usr/v2ray/` - -| 权限 | 名称 | 属性 | 说明 | -| --------- | --------------- | -------- | -------------- | -| rwxrwxrwx | README_zh-CN.md | 普通文件 | 说明文件 | -| rwxrwxrwx | bin | 目录 | 可执行文件目录 | -| rwxrwxrwx | etc | 目录 | 配置文件目录 | - -`ASUS_ROUTER/script_bootloader/usr/v2ray/bin/` - -| 权限 | 名称 | 属性 | 说明 | -| --------- | -------------------------------------------- | -------- | ------------------------------ | -| rwxrwxrwx | v2ray_install | 普通文件 | 安装程序 | -| rwxrwxrwx | v2ray_update | 普通文件 | 升级程序 | -| rwxrwxrwx | v2ray_configure | 普通文件 | 配置程序 | -| rwxrwxrwx | v2ray_enable.service | 普通文件 | 插件的可执行程序,用于启动程序 | -| rwxrwxrwx | v2ray_disable.service | 普通文件 | 插件的可执行程序,用于结束程序 | -| rwxrwxrwx | fw_v2ray_transparent_proxy_enable.service | 普通文件 | 插件的可执行程序,用于启动程序 | -| rwxrwxrwx | fw_v2ray_transparent_proxy_disable.service | 普通文件 | 插件的可执行程序,用于结束程序 | -| rwxrwxrwx | v2ray_transparent_proxy_enable_file.service | 普通文件 | 插件的可执行程序,用于启动程序 | -| rwxrwxrwx | v2ray_transparent_proxy_disable_file.service | 普通文件 | 插件的可执行程序,用于结束程序 | -| rwxrwxrwx | v2ray_transparent_proxy_enable_prog.service | 普通文件 | 插件的可执行程序,用于启动程序 | -| rwxrwxrwx | v2ray_transparent_proxy_disable_prog.service | 普通文件 | 插件的可执行程序,用于结束程序 | - -`ASUS_ROUTER/script_bootloader/usr/v2ray/etc/` - -| 权限 | 名称 | 属性 | 说明 | -| --------- | ------------------------------------ | -------- | ---------------------------------- | -| rwxrwxrwx | config_proxy_tcp.json.template | 普通文件 | v2ray_enable.service的配置文件模板 | -| rwxrwxrwx | config_proxy_https.json.template | 普通文件 | v2ray_enable.service的配置文件模板 | -| rwxrwxrwx | fw.d/v2ray_proxy_open | 普通文件 | fw.d配置文件 | -| rwxrwxrwx | monit.d/fw_filter_INPUT_v2ray_proxy | 普通文件 | monit.d配置文件 | -| rwxrwxrwx | monit.d/v2ray | 普通文件 | monit.d配置文件 | -| rwxrwxrwx | monit.d/v2ray_transparent_proxy_file | 普通文件 | monit.d配置文件 | -| rwxrwxrwx | monit.d/v2ray_transparent_proxy_prog | 普通文件 | monit.d配置文件 | - -## 安装方法 - -执行`/tmp/mnt/ASUS_ROUTER/script_bootloader/usr/v2ray/bin/v2ray_install`。程序会根据路由器架构,自动安装适当版本的v2ray - - > [受支持的路由器型号](https://github.com/Entware/Entware/wiki/Install-on-Asus-stock-firmware): - > - > | 架构 | 路由器型号 | - > | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | - > | **aarch64** | GT-AC2900, GT-AC5300, GT-AX11000, RT-AC86U, RT-AX88U, RT-AX92U | - > | **armv7** | Lyra Voice, RT-AC56U, RT-AC66U B1, RT-AC68P, RT-AC68U, RT-AC87U, RT-AC88U, RT-AC1200G, RT-AC1900P, RT-AC3100, RT-AC3200, RT-AC5300, RT-ACRH13, RT-AX56U, RT-AX58U | - > | **mipsel** | RT-N16, RT-N56U, RT-N66R, RT-N600, RT-AC51U, RT-AC66U, RT-AC66R, RT-AC1200, RT-AC1750, RT-AC1750 B1 | - -## 调用方法 - -| 插件文件 | 插件调用者 | -| -------------------------------------------- | ------------------------------------ | -| v2ray_enable.service | monit.d/v2ray | -| v2ray_disable.service | monit.d/v2ray | -| v2ray_transparent_proxy_enable_file.service | monit.d/v2ray_transparent_proxy_file | -| v2ray_transparent_proxy_disable_file.service | monit.d/v2ray_transparent_proxy_file | -| v2ray_transparent_proxy_enable_prog.service | monit.d/v2ray_transparent_proxy_prog | -| v2ray_transparent_proxy_disable_prog.service | monit.d/v2ray_transparent_proxy_prog | - -## 注意事项 - -1. 登录monit管理页面,可以看到V2RAY和V2RAY_TRANSPARENT_PROXY -2. V2RAY是浏览器代理。可以配合客户端代理工具使用,路由器和未使用代理工具的客户端均在墙内 -3. V2RAY_TRANSPARENT_PROXY是全局透明代理。必须先在monit管理页面中停止V2RAY,然后再启用V2RAY_TRANSPARENT_PROXY。路由器和全体客户端均在墙外 -4. 在部分地区8.8.8.8被运营商重定向了,导致V2RAY_TRANSPARENT_PROXY全局透明代理无法正常工作。如发生此情况,修改`/opt/script_bootloader/usr/v2ray/bin/fw_v2ray_transparent_proxy_enable.service`第90行为 - ```sh - TPROXY_MODULES_STATUS="false" - ``` - 保存后重启路由器即可 diff --git a/v2ray/alternative/v2ray-linux-arm32-v5.zip b/v2ray/alternative/v2ray-linux-arm32-v5.zip deleted file mode 100644 index 5200ed0..0000000 Binary files a/v2ray/alternative/v2ray-linux-arm32-v5.zip and /dev/null differ diff --git a/v2ray/alternative/v2ray-linux-arm64-v8a.zip b/v2ray/alternative/v2ray-linux-arm64-v8a.zip deleted file mode 100644 index f730aaa..0000000 Binary files a/v2ray/alternative/v2ray-linux-arm64-v8a.zip and /dev/null differ diff --git a/v2ray/alternative/v2ray-linux-mips32le.zip b/v2ray/alternative/v2ray-linux-mips32le.zip deleted file mode 100644 index a902e52..0000000 Binary files a/v2ray/alternative/v2ray-linux-mips32le.zip and /dev/null differ diff --git a/v2ray/alternative/version b/v2ray/alternative/version deleted file mode 100644 index dffe3b9..0000000 --- a/v2ray/alternative/version +++ /dev/null @@ -1 +0,0 @@ -v4.45.2 \ No newline at end of file diff --git a/v2ray/bin/fw_v2ray_transparent_proxy_disable.service b/v2ray/bin/fw_v2ray_transparent_proxy_disable.service deleted file mode 100644 index 4cf0ce9..0000000 --- a/v2ray/bin/fw_v2ray_transparent_proxy_disable.service +++ /dev/null @@ -1,189 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# NAME OF THE SERVICE -# 服务名称 -SERVICE_NAME="FW_V2RAY_TRANSPARENT_PROXY" -# -# FUNCTION OF THE SERVICE -# 服务功能 -SERVICE_FUNCTION="DISABLE" -# -# USB_MOUNT_POINT: The mount point of the USB flash drive -# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 -USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" -# -# ENTWARE_ETC: The directory which contains all the configuration files installed by Entware -# 设置自定义变量ENTWARE_ETC为Entware安装的配置文件目录 -ENTWARE_ETC="${USB_MOUNT_POINT}/etc" -# -# ENTWARE_DNSMASQD: The directory which contains all the configuration files used by dnsmasq -# 设置自定义变量ENTWARE_DNSMASQD为dnsmasq配置文件目录 -ENTWARE_DNSMASQD="${ENTWARE_ETC}/dnsmasq.d" -# -# USER_DEFINED_CHAIN_NAME: Name of the user-defined chain -# 设置自定义变量USER_DEFINED_CHAIN_NAME为防火墙自定义链名 -USER_DEFINED_CHAIN_NAME="V2RAY_TPROXY" -# -# LOCAL_PORT: Port of the V2RAY-DOKODEMO-DOOR -# 设置自定义变量LOCAL_PORT为V2RAY-DOKODEMO-DOOR的接收端口 -LOCAL_PORT="45154" -# -# INTRANET_SET: Set of intranet -# 设置自定义变量INTRANET_SET为内网地址集 -INTRANET_SET="192.168.0.0/16" -# -# ROUTING_MARK: Mark of PBR -# 设置自定义变量ROUTING_MARK为策略路由标记 -ROUTING_MARK="0x2333" -# -# ROUTING_TABLE: Routing table of PBR -# 设置自定义变量ROUTING_TABLE为策略路由表 -ROUTING_TABLE="100" -# -# UDP_STATUS: Status of the UDP proxy -# 设置自定义变量UDP_STATUS为UDP代理状态 -UDP_STATUS="$(iptables -t mangle -nvL | /opt/bin/grep ''"Chain ${USER_DEFINED_CHAIN_NAME}"'_UDP')" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ---------*" -# -########## END ########## -# -# -########## UPDATE DNS SETTINGS ########## -# -/opt/bin/mv -f "/tmp/resolv.dnsmasq.bak" "/tmp/resolv.dnsmasq" -# -# Check if chain ${USER_DEFINED_CHAIN_NAME}_UDP exists -# 检查${USER_DEFINED_CHAIN_NAME}_UDP链是否存在 -if [ -z "${UDP_STATUS}" ] -then - /opt/bin/rm -f "${ENTWARE_DNSMASQD}/v2ray_dns.conf" -else - /opt/bin/rm -f "${ENTWARE_DNSMASQD}/v2ray_dns_tproxy.conf" -fi -# -/opt/bin/dnsmasq.d_refresh > /dev/null 2>&1 -# -########## END ########## -# -# -########## UNSET TCP PROXY ########## -# -# Check if chain ${USER_DEFINED_CHAIN_NAME}_TCP exists -# 检查${USER_DEFINED_CHAIN_NAME}_TCP链是否存在 -if [ -z "$(iptables -t nat -nvL | /opt/bin/grep ''"Chain ${USER_DEFINED_CHAIN_NAME}"'_TCP')" ] -then - # Stop and Exit - # 如果${USER_DEFINED_CHAIN_NAME}_TCP链不存在,则该程序终止 - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: ${SERVICE_NAME} HAS BEEN ${SERVICE_FUNCTION}D ALREADY" - # - exit 1 - # -else - # Check if chain ${USER_DEFINED_CHAIN_NAME}_UDP exists - # 检查${USER_DEFINED_CHAIN_NAME}_UDP链是否存在 - if [ -z "${UDP_STATUS}" ] - then - # Check if chain ${USER_DEFINED_CHAIN_NAME}_TCP is referenced by chain PREROUTING - # 检查${USER_DEFINED_CHAIN_NAME}_TCP链是否被PREROUTING链所引用 - if [ -n "$(iptables -t nat -nvL PREROUTING | /opt/bin/grep ''"${USER_DEFINED_CHAIN_NAME}"'_TCP')" ] - then - # Disable chain ${USER_DEFINED_CHAIN_NAME}_TCP - # 禁用${USER_DEFINED_CHAIN_NAME}_TCP链 - iptables -t nat -D PREROUTING -p tcp -j "${USER_DEFINED_CHAIN_NAME}_TCP" - fi - # - else - # Check if chain ${USER_DEFINED_CHAIN_NAME}_TCP is referenced by chain OUTPUT and chain PREROUTING - # 检查${USER_DEFINED_CHAIN_NAME}_TCP链是否被OUTPUT链和PREROUTING链所引用 - if [ -n "$(iptables -t nat -nvL OUTPUT | /opt/bin/grep ''"${USER_DEFINED_CHAIN_NAME}"'_TCP')" ] || \ - [ -n "$(iptables -t nat -nvL PREROUTING | /opt/bin/grep ''"${USER_DEFINED_CHAIN_NAME}"'_TCP')" ] - then - # Disable chain ${USER_DEFINED_CHAIN_NAME}_TCP - # 禁用${USER_DEFINED_CHAIN_NAME}_TCP链 - iptables -t nat -D OUTPUT -p tcp -j "${USER_DEFINED_CHAIN_NAME}_TCP" - iptables -t nat -D PREROUTING -p tcp -s "${INTRANET_SET}" -j "${USER_DEFINED_CHAIN_NAME}_TCP" - fi - # - # 对内网数据包取消SNAT操作 - iptables -t nat -D POSTROUTING -s "${INTRANET_SET}" ! -d "${INTRANET_SET}" -j MASQUERADE - fi - # - # Flush chain ${USER_DEFINED_CHAIN_NAME}_TCP - # 清空${USER_DEFINED_CHAIN_NAME}_TCP链 - iptables -t nat -F "${USER_DEFINED_CHAIN_NAME}_TCP" - # - # Remove chain ${USER_DEFINED_CHAIN_NAME}_TCP - # 删除${USER_DEFINED_CHAIN_NAME}_TCP链 - iptables -t nat -X "${USER_DEFINED_CHAIN_NAME}_TCP" -fi -# -########## END ########## -# -# -########## UNSET UDP PROXY ########## -# -# Check if chain ${USER_DEFINED_CHAIN_NAME}_UDP exists -# 检查${USER_DEFINED_CHAIN_NAME}_UDP链是否存在 -if [ -z "${UDP_STATUS}" ] -then - # Do nothing but prompt the user - # 如果${USER_DEFINED_CHAIN_NAME}_UDP链不存在,则执行 - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: NO UDP PROXY" - # -else - # Check if chain ${USER_DEFINED_CHAIN_NAME}_UDP is referenced by chain OUTPUT - # 检查${USER_DEFINED_CHAIN_NAME}_UDP链是否被OUTPUT链所引用 - if [ -n "$(iptables -t mangle -nvL OUTPUT | /opt/bin/grep ''"${USER_DEFINED_CHAIN_NAME}"'_UDP')" ] - then - # Disable chain ${USER_DEFINED_CHAIN_NAME}_UDP - # 禁用${USER_DEFINED_CHAIN_NAME}_UDP链 - iptables -t mangle -D OUTPUT -p udp -j "${USER_DEFINED_CHAIN_NAME}_UDP" - fi - # - # Check if chain ${USER_DEFINED_CHAIN_NAME}_UDP is referenced by chain PREROUTING - # 检查${USER_DEFINED_CHAIN_NAME}_UDP链是否被PREROUTING链所引用 - if [ -n "$(iptables -t mangle -nvL PREROUTING | /opt/bin/grep ''"${USER_DEFINED_CHAIN_NAME}"'_UDP')" ] - then - # Disable chain ${USER_DEFINED_CHAIN_NAME}_UDP - # 禁用${USER_DEFINED_CHAIN_NAME}_UDP链 - iptables -t mangle -D PREROUTING -p udp -s "${INTRANET_SET}" -m mark ! --mark "${ROUTING_MARK}" -j "${USER_DEFINED_CHAIN_NAME}_UDP" - fi - # - # 取消处理打了MARK的UDP包 - iptables -t mangle -D PREROUTING -m mark --mark "${ROUTING_MARK}" -p udp -j TPROXY --on-ip "127.0.0.1" --on-port "${LOCAL_PORT}" - # - # Flush chain ${USER_DEFINED_CHAIN_NAME}_UDP - # 清空${USER_DEFINED_CHAIN_NAME}_UDP链 - iptables -t mangle -F "${USER_DEFINED_CHAIN_NAME}_UDP" - # - # Remove chain ${USER_DEFINED_CHAIN_NAME}_UDP - # 删除${USER_DEFINED_CHAIN_NAME}_UDP链 - iptables -t mangle -X "${USER_DEFINED_CHAIN_NAME}_UDP" - # - # Remove IP route and rules - # 删除IP路由及规则 - ip route del local 0/0 dev lo table "${ROUTING_TABLE}" - ip rule del fwmark "${ROUTING_MARK}" table "${ROUTING_TABLE}" -fi -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" -# -exit 0 -# -########## END ########## \ No newline at end of file diff --git a/v2ray/bin/fw_v2ray_transparent_proxy_enable.service b/v2ray/bin/fw_v2ray_transparent_proxy_enable.service deleted file mode 100644 index b9be0bb..0000000 --- a/v2ray/bin/fw_v2ray_transparent_proxy_enable.service +++ /dev/null @@ -1,222 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# NAME OF THE SERVICE -# 服务名称 -SERVICE_NAME="FW_V2RAY_TRANSPARENT_PROXY" -# -# FUNCTION OF THE SERVICE -# 服务功能 -SERVICE_FUNCTION="ENABLE" -# -# USB_MOUNT_POINT: The mount point of the USB flash drive -# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 -USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" -# -# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER -# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 -SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" -# -# ENTWARE_ETC: The directory which contains all the configuration files installed by Entware -# 设置自定义变量ENTWARE_ETC为Entware安装的配置文件目录 -ENTWARE_ETC="${USB_MOUNT_POINT}/etc" -# -# ENTWARE_DNSMASQD: The directory which contains all the configuration files used by dnsmasq -# 设置自定义变量ENTWARE_DNSMASQD为dnsmasq配置文件目录 -ENTWARE_DNSMASQD="${ENTWARE_ETC}/dnsmasq.d" -# -# PRIVATE_ROOT: The root directory for this program -# 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/v2ray" -# -# PRIVATE_ETC: The directory which contains all the configuration files related to this program -# 设置自定义变量PRIVATE_ETC为此程序配置文件目录 -PRIVATE_ETC="${PRIVATE_ROOT}/etc" -# -# SERVER_DOMAIN: Domain of the V2RAY-SERVER -# 设置自定义变量SERVER_DOMAIN为V2RAY-SERVER的域名 -SERVER_DOMAIN="$(/opt/bin/sed -E -n -e '/outbounds/,/port/s/^[[:space:]]*\"address\":[[:space:]]*\"(.*)\".*/\1/p' "${PRIVATE_ETC}/config_proxy.json")" -# -# SERVER_IP: Domain of the V2RAY-SERVER -# 设置自定义变量SERVER_IP为V2RAY-SERVER的IP地址 -SERVER_IP="$(nslookup "${SERVER_DOMAIN}" | /opt/bin/sed -E -n -e '/Name/,+1s/.*:[[:space:]]+(([[:digit:]]+\.?){4})[[:space:]]+.*/\1/p')" -# -# LOCAL_PORT: Port of the V2RAY-DOKODEMO-DOOR -# 设置自定义变量LOCAL_PORT为V2RAY-DOKODEMO-DOOR的接收端口 -LOCAL_PORT="45154" -# -# USER_DEFINED_CHAIN_NAME: Name of the user-defined chain -# 设置自定义变量USER_DEFINED_CHAIN_NAME为防火墙自定义链名 -USER_DEFINED_CHAIN_NAME="V2RAY_TPROXY" -# -# INTRANET_SET: Set of intranet -# 设置自定义变量INTRANET_SET为内网地址集 -INTRANET_SET="192.168.0.0/16" -# -# ROUTING_MARK: Mark of PBR -# 设置自定义变量ROUTING_MARK为策略路由标记 -ROUTING_MARK="0x2333" -# -# ROUTING_TABLE: Routing table of PBR -# 设置自定义变量ROUTING_TABLE为策略路由表 -ROUTING_TABLE="100" -# -# NF_TPROXY_CORE: The path to nf_tproxy_core.ko -# 设置自定义变量NF_TPROXY_CORE为文件nf_tproxy_core.ko的绝对路径 -NF_TPROXY_CORE="$(/opt/bin/find /lib/modules/ -name "nf_tproxy_core.ko")" -# -# XT_TPROXY: The path to xt_TPROXY.ko -# 设置自定义变量XT_TPROXY为文件xt_TPROXY.ko的绝对路径 -XT_TPROXY="$(/opt/bin/find /lib/modules/ -name "xt_TPROXY.ko")" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ---------*" -# -########## END ########## -# -# -########## CHECK TPROXY MODULES ########## -# -if [ -n "${NF_TPROXY_CORE}" ] && [ -n "${XT_TPROXY}" ] -then - TPROXY_MODULES_STATUS="true" -else - TPROXY_MODULES_STATUS="false" -fi -# -########## END ########## -# -# -########## SET UP TCP PROXY ########## -# -# Create new chain -iptables -t nat -N "${USER_DEFINED_CHAIN_NAME}_TCP" -# -# Ignore your v2ray server's addresses -# It's very IMPORTANT, just be careful. -iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}_TCP" -d "${SERVER_IP}" -j RETURN -# -# Ignore LANs and any other addresses you'd like to bypass the proxy -# See Wikipedia and RFC5735 for full list of reserved networks. -# See ashi009/bestroutetb for a highly optimized CHN route list. -iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}_TCP" -d "0.0.0.0/8" -j RETURN -iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}_TCP" -d "10.0.0.0/8" -j RETURN -iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}_TCP" -d "127.0.0.0/8" -j RETURN -iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}_TCP" -d "169.254.0.0/16" -j RETURN -iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}_TCP" -d "172.16.0.0/12" -j RETURN -iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}_TCP" -d "192.168.0.0/16" -j RETURN -iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}_TCP" -d "224.0.0.0/4" -j RETURN -iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}_TCP" -d "240.0.0.0/4" -j RETURN -# -# Anything else should be redirected to v2ray's local port -iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}_TCP" -p tcp -j REDIRECT --to-ports "${LOCAL_PORT}" -# -# Check if ${NF_TPROXY_CORE} and ${XT_TPROXY} exist -# 检查${NF_TPROXY_CORE}和${XT_TPROXY}是否存在 -if ${TPROXY_MODULES_STATUS} -then - # Apply the rules for router - iptables -t nat -A OUTPUT -p tcp -j "${USER_DEFINED_CHAIN_NAME}_TCP" - # - # Apply the rules for LAN - iptables -t nat -A PREROUTING -p tcp -s "${INTRANET_SET}" -j "${USER_DEFINED_CHAIN_NAME}_TCP" - # - # 对内网数据包进行SNAT操作 - iptables -t nat -A POSTROUTING -s "${INTRANET_SET}" ! -d "${INTRANET_SET}" -j MASQUERADE - # -else - # Apply the rules for LAN - iptables -t nat -A PREROUTING -p tcp -j "${USER_DEFINED_CHAIN_NAME}_TCP" -fi -# -########## END ########## -# -# -########## SET UP UDP PROXY ########## -# -# Check if ${NF_TPROXY_CORE} and ${XT_TPROXY} exist -# 检查${NF_TPROXY_CORE}和${XT_TPROXY}是否存在 -if ${TPROXY_MODULES_STATUS} -then - # Enable TPROXY - # 启用TPROXY - insmod "${NF_TPROXY_CORE}" - insmod "${XT_TPROXY}" - # - # Create new chain - iptables -t mangle -N "${USER_DEFINED_CHAIN_NAME}_UDP" - # - # Ignore your v2ray server's addresses - # It's very IMPORTANT, just be careful. - iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}_UDP" -d "${SERVER_IP}" -j RETURN - # - # Ignore LANs and any other addresses you'd like to bypass the proxy - # See Wikipedia and RFC5735 for full list of reserved networks. - # See ashi009/bestroutetb for a highly optimized CHN route list. - iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}_UDP" -d "0.0.0.0/8" -j RETURN - iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}_UDP" -d "10.0.0.0/8" -j RETURN - iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}_UDP" -d "127.0.0.0/8" -j RETURN - iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}_UDP" -d "169.254.0.0/16" -j RETURN - iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}_UDP" -d "172.16.0.0/12" -j RETURN - iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}_UDP" -d "192.168.0.0/16" -j RETURN - iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}_UDP" -d "224.0.0.0/4" -j RETURN - iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}_UDP" -d "240.0.0.0/4" -j RETURN - # - # Set mark - iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}_UDP" -j MARK --set-mark "${ROUTING_MARK}" - # - # Apply the rules for router - iptables -t mangle -A OUTPUT -p udp -j "${USER_DEFINED_CHAIN_NAME}_UDP" - # - # Apply the rules for LAN - iptables -t mangle -A PREROUTING -p udp -s "${INTRANET_SET}" -m mark ! --mark "${ROUTING_MARK}" -j "${USER_DEFINED_CHAIN_NAME}_UDP" - # - # 处理打了MARK的UDP包 - iptables -t mangle -A PREROUTING -m mark --mark "${ROUTING_MARK}" -p udp -j TPROXY --on-ip "127.0.0.1" --on-port "${LOCAL_PORT}" - # - # 配置iproute2的策略路由规则 - ip route add local 0/0 dev lo table "${ROUTING_TABLE}" - ip rule add fwmark "${ROUTING_MARK}" table "${ROUTING_TABLE}" - # -else - # Do nothing but prompt the user - # 如果文件${NF_TPROXY_CORE}或${XT_TPROXY}不存在,则执行 - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: NO UDP PROXY" -fi -# -########## END ########## -# -# -########## UPDATE DNS SETTINGS ########## -# -/opt/bin/mv -f "/tmp/resolv.dnsmasq" "/tmp/resolv.dnsmasq.bak" -# -# Check if ${NF_TPROXY_CORE} and ${XT_TPROXY} exist -# 检查${NF_TPROXY_CORE}和${XT_TPROXY}是否存在 -if ${TPROXY_MODULES_STATUS} -then - /opt/bin/cp -lf "${PRIVATE_ETC}/dnsmasq.d/v2ray_dns_tproxy.conf" "${ENTWARE_DNSMASQD}" -else - /opt/bin/cp -lf "${PRIVATE_ETC}/dnsmasq.d/v2ray_dns.conf" "${ENTWARE_DNSMASQD}" -fi -# -/opt/bin/dnsmasq.d_refresh > /dev/null 2>&1 -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" -# -exit 0 -# -########## END ########## \ No newline at end of file diff --git a/v2ray/bin/v2ray_configure b/v2ray/bin/v2ray_configure deleted file mode 100644 index e7b08d8..0000000 --- a/v2ray/bin/v2ray_configure +++ /dev/null @@ -1,153 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# USB_MOUNT_POINT: The mount point of the USB flash drive -# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 -USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" -# -# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER -# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 -SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" -# -# PRIVATE_ROOT: The root directory for this program -# 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/v2ray" -# -# PRIVATE_ETC: The directory which contains all the configuration files related to this program -# 设置自定义变量PRIVATE_ETC为此程序配置文件目录 -PRIVATE_ETC="${PRIVATE_ROOT}/etc" -# -########## END ########## -# -# -########## LOAD FUNCTIONS ########## -# -doubleCheckAndConfirm() -{ - while [ 1 ] - do - local VALUE_1 - local VALUE_2 - # - /opt/bin/echo -ne "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: INPUT THE VALUE: " - read VALUE_1 - /opt/bin/echo -ne "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: INPUT THE VALUE AGAIN TO CONFIRM: " - read VALUE_2 - # - if [ "${VALUE_1}" == "${VALUE_2}" ] - then - eval ${1}="${VALUE_1}" - break - else - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: THE TWO VALUES ARE INCONSISTENT" - fi - done -} -# -########## END ########## -# -# -########## SET PARAMETERS ########## -# -case ${#} in - 0) - while [ 1 ] - do - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mTRANSPORT SETTINGS\033[0m: tcp | https" - doubleCheckAndConfirm TRANSPORT - # - case "$(/opt/bin/echo "${TRANSPORT}" | /opt/bin/sed -E 's/[[:upper:]]/\l&/g')" in - "tcp") - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mUPSTREAM DNS IP\033[0m: IP address of upstream DNS server" - doubleCheckAndConfirm UPSTREAM_DNS_IP - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mWAN INBOUND VMESS ID\033[0m: vmess ID used to connect router from Internet" - doubleCheckAndConfirm WAN_INBOUND_VMESS_ID - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mWAN INBOUND SS PASSWORD\033[0m: shadowsocks password used to connect router from Internet" - doubleCheckAndConfirm WAN_INBOUND_SS_PASSWORD - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mSERVER ADDRESS\033[0m: IP address or domain name of remote v2ray server" - doubleCheckAndConfirm IP_OR_DOMAIN_OF_V2RAY_SERVER - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mSERVER PORT\033[0m: port of remote v2ray server" - doubleCheckAndConfirm PORT_OF_V2RAY_SERVER - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mOUTBOUND VMESS ID\033[0m: vmess ID used to connect remote v2ray server" - doubleCheckAndConfirm OUTBOUND_VMESS_ID - # - break - ;; - "https") - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mUPSTREAM DNS IP\033[0m: IP address of upstream DNS server" - doubleCheckAndConfirm UPSTREAM_DNS_IP - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mWAN INBOUND VMESS ID\033[0m: vmess ID used to connect router from Internet" - doubleCheckAndConfirm WAN_INBOUND_VMESS_ID - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mWAN INBOUND SS PASSWORD\033[0m: shadowsocks password used to connect router from Internet" - doubleCheckAndConfirm WAN_INBOUND_SS_PASSWORD - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mSERVER ADDRESS\033[0m: domain name of remote v2ray server" - doubleCheckAndConfirm DOMAIN_OF_V2RAY_SERVER - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mOUTBOUND VMESS ID\033[0m: vmess ID used to connect remote v2ray server" - doubleCheckAndConfirm OUTBOUND_VMESS_ID - # - break - ;; - *) - /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: INPUT VALUE IS INVALID" - ;; - esac - done - ;; - *) - /opt/bin/echo -e "($(basename $0)): $$ \033[1;41;37mFAILURE\033[0m: WRONG NUMBER OF PARAMETERS" - # - exit 1 - ;; -esac -# -########## END ########## -# -# -########## CONFIGURE V2RAY ########## -# -case "$(/opt/bin/echo "${TRANSPORT}" | /opt/bin/sed -E 's/[[:upper:]]/\l&/g')" in - "tcp") - # Create ${PRIVATE_ETC}/config_proxy.json - # 创建${PRIVATE_ETC}/config_proxy.json - /opt/bin/cp -f "${PRIVATE_ETC}/config_proxy_tcp.json.template" "${PRIVATE_ETC}/config_proxy.json" - # - # Modify ${PRIVATE_ETC}/config_proxy.json - # 修改${PRIVATE_ETC}/config_proxy.json - /opt/bin/sed -E -i 's##'"${UPSTREAM_DNS_IP}"'#' "${PRIVATE_ETC}/config_proxy.json" - /opt/bin/sed -E -i 's##'"${WAN_INBOUND_VMESS_ID}"'#' "${PRIVATE_ETC}/config_proxy.json" - /opt/bin/sed -E -i 's##'"${WAN_INBOUND_SS_PASSWORD}"'#' "${PRIVATE_ETC}/config_proxy.json" - /opt/bin/sed -E -i 's##'"${IP_OR_DOMAIN_OF_V2RAY_SERVER}"'#' "${PRIVATE_ETC}/config_proxy.json" - /opt/bin/sed -E -i 's##'"${PORT_OF_V2RAY_SERVER}"'#' "${PRIVATE_ETC}/config_proxy.json" - /opt/bin/sed -E -i 's##'"${OUTBOUND_VMESS_ID}"'#' "${PRIVATE_ETC}/config_proxy.json" - ;; - "https") - # Create ${PRIVATE_ETC}/config_proxy.json - # 创建${PRIVATE_ETC}/config_proxy.json - /opt/bin/cp -f "${PRIVATE_ETC}/config_proxy_https.json.template" "${PRIVATE_ETC}/config_proxy.json" - # - # Modify ${PRIVATE_ETC}/config_proxy.json - # 修改${PRIVATE_ETC}/config_proxy.json - /opt/bin/sed -E -i 's##'"${UPSTREAM_DNS_IP}"'#' "${PRIVATE_ETC}/config_proxy.json" - /opt/bin/sed -E -i 's##'"${WAN_INBOUND_VMESS_ID}"'#' "${PRIVATE_ETC}/config_proxy.json" - /opt/bin/sed -E -i 's##'"${WAN_INBOUND_SS_PASSWORD}"'#' "${PRIVATE_ETC}/config_proxy.json" - /opt/bin/sed -E -i 's##'"${DOMAIN_OF_V2RAY_SERVER}"'#' "${PRIVATE_ETC}/config_proxy.json" - /opt/bin/sed -E -i 's##'"${OUTBOUND_VMESS_ID}"'#' "${PRIVATE_ETC}/config_proxy.json" - ;; -esac -# -exit 0 -# -########## END ########## \ No newline at end of file diff --git a/v2ray/bin/v2ray_disable.service b/v2ray/bin/v2ray_disable.service deleted file mode 100644 index 406f0f9..0000000 --- a/v2ray/bin/v2ray_disable.service +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# NAME OF THE SERVICE -# 服务名称 -SERVICE_NAME="V2RAY" -# -# FUNCTION OF THE SERVICE -# 服务功能 -SERVICE_FUNCTION="DISABLE" -# -# V2RAY_PID_FILE: The path to v2ray.pid -# 设置自定义变量V2RAY_PID_FILE为文件v2ray.pid的绝对路径 -V2RAY_PID_FILE="/var/run/v2ray.pid" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ---------*" -# -########## END ########## -# -# -########## DISABLE V2RAY ########## -# -for PID in $(/opt/bin/cat "${V2RAY_PID_FILE}") -do - /opt/bin/kill ${PID} -done -# -/opt/bin/rm -f "${V2RAY_PID_FILE}" -# -########## END ########## -# -# -########## NOTIFICATION ########## -# -/opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" -# -exit 0 -# -########## END ########## \ No newline at end of file diff --git a/v2ray/bin/v2ray_transparent_proxy_enable_prog.service b/v2ray/bin/v2ray_transparent_proxy_enable_prog.service deleted file mode 100644 index 332daad..0000000 --- a/v2ray/bin/v2ray_transparent_proxy_enable_prog.service +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/sh -# -########## SET THE CUSTOM VARIABLES ########## -# -# 设置自定义变量 -# 当该程序运行结束,此处设置的变量自动取消 -# -# USB_MOUNT_POINT: The mount point of the USB flash drive -# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 -USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" -# -# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER -# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 -SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" -# -# PRIVATE_ROOT: The root directory for this program -# 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/v2ray" -# -# PRIVATE_BIN: The directory which contains all the executable files related to this program -# 设置自定义变量PRIVATE_BIN为此程序可执行文件目录 -PRIVATE_BIN="${PRIVATE_ROOT}/bin" -# -# PRIVATE_ETC: The directory which contains all the configuration files related to this program -# 设置自定义变量PRIVATE_ETC为此程序配置文件目录 -PRIVATE_ETC="${PRIVATE_ROOT}/etc" -# -# V2RAY_PID_FILE: The path to v2ray.pid -# 设置自定义变量V2RAY_PID_FILE为文件v2ray.pid的绝对路径 -V2RAY_PID_FILE="/var/run/v2ray.pid" -# -# SERVER_DOMAIN: Domain of the V2RAY-SERVER -# 设置自定义变量SERVER_DOMAIN为V2RAY-SERVER的域名 -SERVER_DOMAIN="$(/opt/bin/sed -E -n -e '/outbounds/,/port/s/^[[:space:]]*\"address\":[[:space:]]*\"(.*)\".*/\1/p' "${PRIVATE_ETC}/config_proxy.json")" -# -# SERVER_IP: Domain of the V2RAY-SERVER -# 设置自定义变量SERVER_IP为V2RAY-SERVER的IP地址 -SERVER_IP="$(nslookup "${SERVER_DOMAIN}" | /opt/bin/sed -E -n -e '/Name/,+1s/.*:[[:space:]]+(([[:digit:]]+\.?){4})[[:space:]]+.*/\1/p')" -# -# USER_DEFINED_CHAIN_NAME: Name of the user-defined chain -# 设置自定义变量USER_DEFINED_CHAIN_NAME为防火墙自定义链名 -USER_DEFINED_CHAIN_NAME="$(/opt/bin/sed -E -n -e 's/^USER_DEFINED_CHAIN_NAME=\"(.*)\"/\1/p' "${PRIVATE_BIN}/fw_v2ray_transparent_proxy_enable.service")" -# -# ADMINUSER: The administrator of the router -# 设置环境变量ADMINUSER为路由器管理页面的登陆帐号 -ADMINUSER="$(nvram get sbl_username)" -# -# TEST_FW: Test for firewall rules -# 设置环境变量TEST_FW为防火墙规则测试值 -# 特殊说明:必须避免双引号多重嵌套 -CHECK_RULES="$(iptables -t nat -nvL PREROUTING | /opt/bin/grep ''"${USER_DEFINED_CHAIN_NAME}"'_TCP')" -if [ -n "${CHECK_RULES}" ] -then - TEST_FW="true" -else - TEST_FW="false" -fi -# -########## END ########## -# -# -########## LOAD FUNCTIONS ########## -# -checkIfProcessAlive() -{ - local PROCESS_ID_FILE="${1}" - local PROCESS_ID - # - if [ -e "${PROCESS_ID_FILE}" ] - then - for PROCESS_ID in $(/opt/bin/cat "${PROCESS_ID_FILE}") - do - if [ -z "$(ps | /opt/bin/grep -E '^[[:space:]]*'"${PROCESS_ID}"'[[:space:]]+')" ] - then - eval ${2}="false" - return - fi - done - eval ${2}="true" - else - eval ${2}="false" - fi -} -# -########## END ########## -# -# -########## ENABLE V2RAY AND V2RAY-FW ########## -# -# Check if ${PRIVATE_BIN}/v2ray_enable.service and ${PRIVATE_BIN}/fw_v2ray_transparent_proxy_enable.service has been loaded -# 检查${PRIVATE_BIN}/v2ray_enable.service和${PRIVATE_BIN}/fw_v2ray_transparent_proxy_enable.service是否被加载 -checkIfProcessAlive "${V2RAY_PID_FILE}" TEST_V2RAY -# -if ${TEST_V2RAY} && ${TEST_FW} -then - # Everything is OK - # 满足全部条件 - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: TRANSPARENT PROXY IS ON" - # - exit 0 - # -else - # Stop all the relevant processes - # 如果有任意条件不符,则停止全部相关进程 - "${PRIVATE_BIN}/v2ray_transparent_proxy_disable_prog.service" > /dev/null 2>&1 - # - /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: LOAD TRANSPARENT PROXY" - # - # Update /etc/hosts - # 更新文件/etc/hosts - /opt/bin/echo "${SERVER_IP} ${SERVER_DOMAIN}" >> "/etc/hosts" - # - # Start all the relevant processes - # 启动全部相关进程 - "${PRIVATE_BIN}/v2ray_enable.service" > /dev/null 2>&1 - /opt/bin/sleep 2 - "${PRIVATE_BIN}/fw_v2ray_transparent_proxy_enable.service" > /dev/null 2>&1 - /opt/bin/sleep 2 - # - ########## END ########## - # - # - ########## ENABLE CRONTAB ########## - # - # Enable crontab because something is wrong with the poll time of monit - # 因为monit的执行周期BUG,故启用crontab进行进程周期执行 - #/opt/bin/echo "*/5 * * * * \"${PRIVATE_BIN}/v2ray_transparent_proxy_enable_file.service\"" >> "/var/spool/cron/crontabs/${ADMINUSER}" - #/opt/bin/chmod 600 "/var/spool/cron/crontabs/${ADMINUSER}" - # - # Create status file - # 创建状态文件 - #/opt/bin/touch "/var/run/v2ray_transparent_proxy_enable_file" - # - ########## END ########## - # - # - exit 1 - # -fi -# -########## END ########## \ No newline at end of file diff --git a/v2ray/etc/config_proxy_https.json.template b/v2ray/etc/config_proxy_https.json.template deleted file mode 100644 index 8424d2e..0000000 --- a/v2ray/etc/config_proxy_https.json.template +++ /dev/null @@ -1,425 +0,0 @@ -{ - "inbounds": - [ - { - "port":1080, - "listen":"0.0.0.0", - "protocol":"socks", - "settings": - { - "auth":"noauth", - "udp":true, - "ip":"127.0.0.1", - "userLevel":1 - }, - "tag":"LAN_inbound_socks_VPS" - }, - { - "port":2080, - "listen":"0.0.0.0", - "protocol":"http", - "settings": - { - "timeout": 0, - "allowTransparent": false, - "userLevel": 1 - }, - "tag":"LAN_inbound_http_VPS" - }, - { - "port":2053, - "listen":"0.0.0.0", - "protocol":"dokodemo-door", - "settings": - { - "address":"", - "port":53, - "network":"tcp,udp", - "timeout":0, - "followRedirect":false, - "userLevel":1 - }, - "tag":"DNS_local_dokodemo_VPS" - }, - { - "port":45154, - "listen":"0.0.0.0", - "protocol":"dokodemo-door", - "settings": - { - "network":"tcp,udp", - "timeout":30, - "followRedirect":true, - "userLevel":1 - }, - "streamSettings": - { - "sockopt": - { - "tproxy":"redirect" - } - }, - "tag":"LAN_local_dokodemo_VPS" - }, - { - "port":22815, - "listen":"0.0.0.0", - "protocol":"vmess", - "settings": - { - "clients": - [ - { - "id":"", - "level":1, - "alterId":64 - } - ], - "disableInsecureEncryption":true - }, - "streamSettings": - { - "network":"tcp", - "security":"none", - "tcpSettings": - { - "header": - { - "type":"http", - "request": - { - "version":"1.1", - "method":"GET", - "path": - [ - "/" - ], - "headers": - { - "Host": - [ - "www.163.com", - "www.baidu.com", - "www.cctv.com", - "www.jd.com", - "www.qq.com", - "www.sina.com.cn", - "www.taobao.com", - "www.bing.com", - "www.alibaba.com" - ], - "User-Agent": - [ - "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36", - "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/53.0.2785.109 Mobile/14A456 Safari/601.1.46" - ], - "Accept-Encoding": - [ - "gzip, deflate" - ], - "Connection": - [ - "keep-alive" - ], - "Pragma":"no-cache" - } - }, - "response": - { - "version":"1.1", - "status":"200", - "reason":"OK", - "headers": - { - "Content-Type": - [ - "application/octet-stream", - "video/mpeg" - ], - "Transfer-Encoding": - [ - "chunked" - ], - "Connection": - [ - "keep-alive" - ], - "Pragma":"no-cache" - } - } - } - } - }, - "tag":"WAN_inbound_vmess_VPS" - }, - { - "port":22816, - "listen":"0.0.0.0", - "protocol":"shadowsocks", - "settings": - { - "method":"aes-256-gcm", - "password":"", - "level":1, - "ota":false, - "network":"tcp,udp" - }, - "tag":"WAN_inbound_shadowsocks_VPS" - }, - { - "port":22817, - "listen":"0.0.0.0", - "protocol":"vmess", - "settings": - { - "clients": - [ - { - "id":"", - "level":1, - "alterId":64 - } - ], - "disableInsecureEncryption":true - }, - "streamSettings": - { - "network":"tcp", - "security":"none", - "tcpSettings": - { - "header": - { - "type":"http", - "request": - { - "version":"1.1", - "method":"GET", - "path": - [ - "/" - ], - "headers": - { - "Host": - [ - "www.163.com", - "www.baidu.com", - "www.cctv.com", - "www.jd.com", - "www.qq.com", - "www.sina.com.cn", - "www.taobao.com", - "www.bing.com", - "www.alibaba.com" - ], - "User-Agent": - [ - "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36", - "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/53.0.2785.109 Mobile/14A456 Safari/601.1.46" - ], - "Accept-Encoding": - [ - "gzip, deflate" - ], - "Connection": - [ - "keep-alive" - ], - "Pragma":"no-cache" - } - }, - "response": - { - "version":"1.1", - "status":"200", - "reason":"OK", - "headers": - { - "Content-Type": - [ - "application/octet-stream", - "video/mpeg" - ], - "Transfer-Encoding": - [ - "chunked" - ], - "Connection": - [ - "keep-alive" - ], - "Pragma":"no-cache" - } - } - } - } - }, - "tag":"WAN_inbound_vmess_Router" - }, - { - "port":22818, - "listen":"0.0.0.0", - "protocol":"shadowsocks", - "settings": - { - "method":"aes-256-gcm", - "password":"", - "level":1, - "ota":false, - "network":"tcp,udp" - }, - "tag":"WAN_inbound_shadowsocks_Router" - } - ], - "outbounds": - [ - { - "sendThrough":"0.0.0.0", - "protocol":"vmess", - "settings": - { - "vnext": - [ - { - "address":"", - "port":443, - "users": - [ - { - "id":"", - "alterid":64, - "security":"auto", - "level":1 - } - ] - } - ] - }, - "streamSettings": - { - "network":"http", - "security":"tls", - "tlsSettings": - { - "serverName":"", - "allowInsecure":false, - "allowInsecureCiphers":false - }, - "httpSettings": - { - "host": - [ - "www.163.com", - "www.baidu.com", - "www.cctv.com", - "www.jd.com", - "www.qq.com", - "www.sina.com.cn", - "www.taobao.com", - "www.bing.com", - "www.alibaba.com" - ], - "path":"/" - } - }, - "tag":"VPS_outbound" - }, - { - "sendThrough":"0.0.0.0", - "protocol":"freedom", - "settings": - { - "domainStrategy":"AsIs", - "userLevel":1 - }, - "tag":"Router_outbound" - } - ], - "routing": - { - "domainStrategy":"AsIs", - "rules": - [ - { - "type":"field", - "inboundTag": - [ - "LAN_inbound_socks_VPS" - ], - "outboundTag":"VPS_outbound" - }, - { - "type":"field", - "inboundTag": - [ - "LAN_inbound_http_VPS" - ], - "outboundTag":"VPS_outbound" - }, - { - "type":"field", - "inboundTag": - [ - "DNS_local_dokodemo_VPS" - ], - "outboundTag":"VPS_outbound" - }, - { - "type":"field", - "inboundTag": - [ - "LAN_local_dokodemo_VPS" - ], - "outboundTag":"VPS_outbound" - }, - { - "type":"field", - "inboundTag": - [ - "WAN_inbound_vmess_VPS" - ], - "outboundTag":"VPS_outbound" - }, - { - "type":"field", - "inboundTag": - [ - "WAN_inbound_shadowsocks_VPS" - ], - "outboundTag":"VPS_outbound" - }, - { - "type":"field", - "inboundTag": - [ - "WAN_inbound_vmess_Router" - ], - "outboundTag":"Router_outbound" - }, - { - "type":"field", - "inboundTag": - [ - "WAN_inbound_shadowsocks_Router" - ], - "outboundTag":"Router_outbound" - } - ] - }, - "policy": - { - "levels": - { - "1": - { - "handshake":4, - "connIdle":300, - "uplinkOnly":2, - "downlinkOnly":5, - "statsUserUplink":false, - "statsUserDownlink":false - } - } - } -} \ No newline at end of file diff --git a/v2ray/etc/config_proxy_tcp.json.template b/v2ray/etc/config_proxy_tcp.json.template deleted file mode 100644 index e88289b..0000000 --- a/v2ray/etc/config_proxy_tcp.json.template +++ /dev/null @@ -1,471 +0,0 @@ -{ - "inbounds": - [ - { - "port":1080, - "listen":"0.0.0.0", - "protocol":"socks", - "settings": - { - "auth":"noauth", - "udp":true, - "ip":"127.0.0.1", - "userLevel":1 - }, - "tag":"LAN_inbound_socks_VPS" - }, - { - "port":2080, - "listen":"0.0.0.0", - "protocol":"http", - "settings": - { - "timeout": 0, - "allowTransparent": false, - "userLevel": 1 - }, - "tag":"LAN_inbound_http_VPS" - }, - { - "port":2053, - "listen":"0.0.0.0", - "protocol":"dokodemo-door", - "settings": - { - "address":"", - "port":53, - "network":"tcp,udp", - "timeout":0, - "followRedirect":false, - "userLevel":1 - }, - "tag":"DNS_local_dokodemo_VPS" - }, - { - "port":45154, - "listen":"0.0.0.0", - "protocol":"dokodemo-door", - "settings": - { - "network":"tcp,udp", - "timeout":30, - "followRedirect":true, - "userLevel":1 - }, - "streamSettings": - { - "sockopt": - { - "tproxy":"redirect" - } - }, - "tag":"LAN_local_dokodemo_VPS" - }, - { - "port":22815, - "listen":"0.0.0.0", - "protocol":"vmess", - "settings": - { - "clients": - [ - { - "id":"", - "level":1, - "alterId":64 - } - ], - "disableInsecureEncryption":true - }, - "streamSettings": - { - "network":"tcp", - "security":"none", - "tcpSettings": - { - "header": - { - "type":"http", - "request": - { - "version":"1.1", - "method":"GET", - "path": - [ - "/" - ], - "headers": - { - "Host": - [ - "www.163.com", - "www.baidu.com", - "www.cctv.com", - "www.jd.com", - "www.qq.com", - "www.sina.com.cn", - "www.taobao.com", - "www.bing.com", - "www.alibaba.com" - ], - "User-Agent": - [ - "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36", - "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/53.0.2785.109 Mobile/14A456 Safari/601.1.46" - ], - "Accept-Encoding": - [ - "gzip, deflate" - ], - "Connection": - [ - "keep-alive" - ], - "Pragma":"no-cache" - } - }, - "response": - { - "version":"1.1", - "status":"200", - "reason":"OK", - "headers": - { - "Content-Type": - [ - "application/octet-stream", - "video/mpeg" - ], - "Transfer-Encoding": - [ - "chunked" - ], - "Connection": - [ - "keep-alive" - ], - "Pragma":"no-cache" - } - } - } - } - }, - "tag":"WAN_inbound_vmess_VPS" - }, - { - "port":22816, - "listen":"0.0.0.0", - "protocol":"shadowsocks", - "settings": - { - "method":"aes-256-gcm", - "password":"", - "level":1, - "ota":false, - "network":"tcp,udp" - }, - "tag":"WAN_inbound_shadowsocks_VPS" - }, - { - "port":22817, - "listen":"0.0.0.0", - "protocol":"vmess", - "settings": - { - "clients": - [ - { - "id":"", - "level":1, - "alterId":64 - } - ], - "disableInsecureEncryption":true - }, - "streamSettings": - { - "network":"tcp", - "security":"none", - "tcpSettings": - { - "header": - { - "type":"http", - "request": - { - "version":"1.1", - "method":"GET", - "path": - [ - "/" - ], - "headers": - { - "Host": - [ - "www.163.com", - "www.baidu.com", - "www.cctv.com", - "www.jd.com", - "www.qq.com", - "www.sina.com.cn", - "www.taobao.com", - "www.bing.com", - "www.alibaba.com" - ], - "User-Agent": - [ - "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36", - "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/53.0.2785.109 Mobile/14A456 Safari/601.1.46" - ], - "Accept-Encoding": - [ - "gzip, deflate" - ], - "Connection": - [ - "keep-alive" - ], - "Pragma":"no-cache" - } - }, - "response": - { - "version":"1.1", - "status":"200", - "reason":"OK", - "headers": - { - "Content-Type": - [ - "application/octet-stream", - "video/mpeg" - ], - "Transfer-Encoding": - [ - "chunked" - ], - "Connection": - [ - "keep-alive" - ], - "Pragma":"no-cache" - } - } - } - } - }, - "tag":"WAN_inbound_vmess_Router" - }, - { - "port":22818, - "listen":"0.0.0.0", - "protocol":"shadowsocks", - "settings": - { - "method":"aes-256-gcm", - "password":"", - "level":1, - "ota":false, - "network":"tcp,udp" - }, - "tag":"WAN_inbound_shadowsocks_Router" - } - ], - "outbounds": - [ - { - "sendThrough":"0.0.0.0", - "protocol":"vmess", - "settings": - { - "vnext": - [ - { - "address":"", - "port":, - "users": - [ - { - "id":"", - "alterid":64, - "security":"auto", - "level":1 - } - ] - } - ] - }, - "streamSettings": - { - "network":"tcp", - "security":"none", - "tcpSettings": - { - "header": - { - "type":"http", - "request": - { - "version":"1.1", - "method":"GET", - "path": - [ - "/" - ], - "headers": - { - "Host": - [ - "www.163.com", - "www.baidu.com", - "www.cctv.com", - "www.jd.com", - "www.qq.com", - "www.sina.com.cn", - "www.taobao.com", - "www.bing.com", - "www.alibaba.com" - ], - "User-Agent": - [ - "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36", - "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/53.0.2785.109 Mobile/14A456 Safari/601.1.46" - ], - "Accept-Encoding": - [ - "gzip, deflate" - ], - "Connection": - [ - "keep-alive" - ], - "Pragma":"no-cache" - } - }, - "response": - { - "version":"1.1", - "status":"200", - "reason":"OK", - "headers": - { - "Content-Type": - [ - "application/octet-stream", - "video/mpeg" - ], - "Transfer-Encoding": - [ - "chunked" - ], - "Connection": - [ - "keep-alive" - ], - "Pragma":"no-cache" - } - } - } - } - }, - "tag":"VPS_outbound" - }, - { - "sendThrough":"0.0.0.0", - "protocol":"freedom", - "settings": - { - "domainStrategy":"AsIs", - "userLevel":1 - }, - "tag":"Router_outbound" - } - ], - "routing": - { - "domainStrategy":"AsIs", - "rules": - [ - { - "type":"field", - "inboundTag": - [ - "LAN_inbound_socks_VPS" - ], - "outboundTag":"VPS_outbound" - }, - { - "type":"field", - "inboundTag": - [ - "LAN_inbound_http_VPS" - ], - "outboundTag":"VPS_outbound" - }, - { - "type":"field", - "inboundTag": - [ - "DNS_local_dokodemo_VPS" - ], - "outboundTag":"VPS_outbound" - }, - { - "type":"field", - "inboundTag": - [ - "LAN_local_dokodemo_VPS" - ], - "outboundTag":"VPS_outbound" - }, - { - "type":"field", - "inboundTag": - [ - "WAN_inbound_vmess_VPS" - ], - "outboundTag":"VPS_outbound" - }, - { - "type":"field", - "inboundTag": - [ - "WAN_inbound_shadowsocks_VPS" - ], - "outboundTag":"VPS_outbound" - }, - { - "type":"field", - "inboundTag": - [ - "WAN_inbound_vmess_Router" - ], - "outboundTag":"Router_outbound" - }, - { - "type":"field", - "inboundTag": - [ - "WAN_inbound_shadowsocks_Router" - ], - "outboundTag":"Router_outbound" - } - ] - }, - "policy": - { - "levels": - { - "1": - { - "handshake":4, - "connIdle":300, - "uplinkOnly":2, - "downlinkOnly":5, - "statsUserUplink":false, - "statsUserDownlink":false - } - } - } -} \ No newline at end of file diff --git a/v2ray/etc/fw.d/v2ray_proxy_open b/v2ray/etc/fw.d/v2ray_proxy_open deleted file mode 100644 index 3773237..0000000 --- a/v2ray/etc/fw.d/v2ray_proxy_open +++ /dev/null @@ -1,7 +0,0 @@ -NAME="V2RAY_PROXY" -RULE="OPEN#TCP#22815" -RULE="OPEN#TCP#22816" -RULE="OPEN#UDP#22816" -RULE="OPEN#TCP#22817" -RULE="OPEN#TCP#22818" -RULE="OPEN#UDP#22818" \ No newline at end of file diff --git a/v2ray/etc/monit.d/fw_filter_INPUT_v2ray_proxy b/v2ray/etc/monit.d/fw_filter_INPUT_v2ray_proxy deleted file mode 100644 index 1ef9905..0000000 --- a/v2ray/etc/monit.d/fw_filter_INPUT_v2ray_proxy +++ /dev/null @@ -1,4 +0,0 @@ -check program FW_PORT_OPENING_V2RAY_PROXY with path "/opt/bin/fwd enable /opt/etc/fw.d/v2ray_proxy_open" every 6 cycles - start program = "/opt/bin/fwd enable /opt/etc/fw.d/v2ray_proxy_open" - stop program = "/opt/bin/fwd disable /opt/etc/fw.d/v2ray_proxy_open" - if status == 1 then alert \ No newline at end of file diff --git a/v2ray/etc/monit.d/v2ray b/v2ray/etc/monit.d/v2ray deleted file mode 100644 index c02c1cf..0000000 --- a/v2ray/etc/monit.d/v2ray +++ /dev/null @@ -1,4 +0,0 @@ -check process V2RAY with pidfile '/var/run/v2ray.pid' - start program = "/opt/script_bootloader/usr/v2ray/bin/v2ray_enable.service" - stop program = "/opt/script_bootloader/usr/v2ray/bin/v2ray_disable.service" - if does not exist then restart \ No newline at end of file diff --git a/v2ray/etc/monit.d/v2ray_transparent_proxy_file b/v2ray/etc/monit.d/v2ray_transparent_proxy_file deleted file mode 100644 index 67cc240..0000000 --- a/v2ray/etc/monit.d/v2ray_transparent_proxy_file +++ /dev/null @@ -1,4 +0,0 @@ -check file V2RAY_TRANSPARENT_PROXY path "/var/run/v2ray_transparent_proxy_enable_file" every 6 cycles - start program = "/opt/script_bootloader/usr/v2ray/bin/v2ray_transparent_proxy_enable_file.service" with timeout 120 seconds - stop program = "/opt/script_bootloader/usr/v2ray/bin/v2ray_transparent_proxy_disable_file.service" with timeout 120 seconds - if does not exist then alert \ No newline at end of file diff --git a/v2ray/etc/monit.d/v2ray_transparent_proxy_prog b/v2ray/etc/monit.d/v2ray_transparent_proxy_prog deleted file mode 100644 index 07883a2..0000000 --- a/v2ray/etc/monit.d/v2ray_transparent_proxy_prog +++ /dev/null @@ -1,4 +0,0 @@ -check program V2RAY_TRANSPARENT_PROXY with path "/opt/script_bootloader/usr/v2ray/bin/v2ray_transparent_proxy_enable_prog.service" every 6 cycles - start program = "/opt/script_bootloader/usr/v2ray/bin/v2ray_transparent_proxy_enable_prog.service" with timeout 120 seconds - stop program = "/opt/script_bootloader/usr/v2ray/bin/v2ray_transparent_proxy_disable_prog.service" with timeout 120 seconds - if status == 1 then alert \ No newline at end of file diff --git a/webdav/alternative/linux-arm64-webdav.tar.gz b/webdav/alternative/linux-arm64-webdav.tar.gz deleted file mode 100644 index a45f515..0000000 Binary files a/webdav/alternative/linux-arm64-webdav.tar.gz and /dev/null differ diff --git a/webdav/alternative/linux-armv5-webdav.tar.gz b/webdav/alternative/linux-armv5-webdav.tar.gz deleted file mode 100644 index f543756..0000000 Binary files a/webdav/alternative/linux-armv5-webdav.tar.gz and /dev/null differ diff --git a/webdav/alternative/linux-mipsle-webdav.tar.gz b/webdav/alternative/linux-mipsle-webdav.tar.gz deleted file mode 100644 index 51e8720..0000000 Binary files a/webdav/alternative/linux-mipsle-webdav.tar.gz and /dev/null differ diff --git a/webdav/alternative/version b/webdav/alternative/version deleted file mode 100644 index 15a2b33..0000000 --- a/webdav/alternative/version +++ /dev/null @@ -1 +0,0 @@ -v4.2.0 \ No newline at end of file diff --git a/webdav/etc/config.yaml.template b/webdav/etc/config.yaml.template index f258087..6dde9ad 100644 --- a/webdav/etc/config.yaml.template +++ b/webdav/etc/config.yaml.template @@ -8,7 +8,7 @@ key: key.pem prefix: / # Default user settings (will be merged) -scope: /root +scope: /home/root modify: true rules: [] @@ -29,4 +29,4 @@ cors: users: - username: ADMINUSER password: ADMINPASSWORD - scope: /root \ No newline at end of file + scope: /home/root \ No newline at end of file diff --git a/wol/bin/wol_enable.service b/wol/bin/wol_enable.service index e4ead6e..73f6c3f 100644 --- a/wol/bin/wol_enable.service +++ b/wol/bin/wol_enable.service @@ -54,7 +54,7 @@ PC1="XX:XX:XX:XX:XX:XX" # ########## ENABLE CRONTAB ########## # -/opt/bin/chmod 600 "/var/spool/cron/crontabs/${ADMINUSER}" +/opt/bin/chmod 600 "/var/spool/cron/crontabs/${ADMINUSER}" 2> /dev/null # ########## END ########## # diff --git a/xray/README_zh-CN.md b/xray/README_zh-CN.md new file mode 100644 index 0000000..5917b2f --- /dev/null +++ b/xray/README_zh-CN.md @@ -0,0 +1,96 @@ +# Readme for Xray + +## 概述 + +1. 本插件用于安装、配置、启动和结束xray +2. 客户端需安装支持socks5协议/Vmess协议的代理工具连接本插件 + + | 客户端 | 代理工具 | + | ------- | ------------ | + | Chrome | SwitchyOmega | + | iOS | Shadowrocket | + | Android | v2rayNG | + +3. 支持全局透明代理。华硕原厂固件仅能代理TCP流量,梅林固件可以代理TCP和UDP流量 +4. 监听端口:1080, 9080, 2053, 45154, 55155, 22815, 22816 + + | 协议 | 端口号 | 代理 | 使用场景 | + | ----------- | ------ | ------ | ------------------------------ | + | socks5 | 1080 | VPS | 内网设备科学上网 | + | http | 9080 | VPS | 内网设备科学上网 | + | dokodemo | 2053 | VPS | 内网设备透明代理DNS转发 | + | dokodemo | 45154 | VPS | 内网设备透明代理REDIRECT转发 | + | dokodemo | 55155 | VPS | 内网设备透明代理TPROXY转发 | + | vmess | 22815 | LAN | 外网设备接入路由器实现回国上网 | + | vmess | 22816 | VPS | 外网设备接入路由器实现科学上网 | + +## 安装前提 + +1. 必须安装并启用entware和monit +2. 必须安装fwd并启用fw_filter_INPUT_xray_proxy + +## 文件结构 + +`ASUS_ROUTER/script_bootloader/usr/xray/` + +| 权限 | 名称 | 属性 | 说明 | +| --------- | --------------- | -------- | -------------- | +| rwxrwxrwx | README_zh-CN.md | 普通文件 | 说明文件 | +| rwxrwxrwx | bin | 目录 | 可执行文件目录 | +| rwxrwxrwx | etc | 目录 | 配置文件目录 | + +`ASUS_ROUTER/script_bootloader/usr/xray/bin/` + +| 权限 | 名称 | 属性 | 说明 | +| --------- | ------------------------------------------- | -------- | ------------------------------ | +| rwxrwxrwx | xray_install | 普通文件 | 安装程序 | +| rwxrwxrwx | xray_update | 普通文件 | 升级程序 | +| rwxrwxrwx | xray_configure | 普通文件 | 配置程序 | +| rwxrwxrwx | xray_proxy_enable.service | 普通文件 | 插件的可执行程序,用于启动程序 | +| rwxrwxrwx | xray_proxy_disable.service | 普通文件 | 插件的可执行程序,用于结束程序 | +| rwxrwxrwx | fw_xray_transparent_proxy_enable.service | 普通文件 | 插件的可执行程序,用于启动程序 | +| rwxrwxrwx | fw_xray_transparent_proxy_disable.service | 普通文件 | 插件的可执行程序,用于结束程序 | +| rwxrwxrwx | xray_transparent_proxy_enable_file.service | 普通文件 | 插件的可执行程序,用于启动程序 | +| rwxrwxrwx | xray_transparent_proxy_disable_file.service | 普通文件 | 插件的可执行程序,用于结束程序 | +| rwxrwxrwx | xray_transparent_proxy_enable_prog.service | 普通文件 | 插件的可执行程序,用于启动程序 | +| rwxrwxrwx | xray_transparent_proxy_disable_prog.service | 普通文件 | 插件的可执行程序,用于结束程序 | + +`ASUS_ROUTER/script_bootloader/usr/xray/etc/` + +| 权限 | 名称 | 属性 | 说明 | +| --------- | ----------------------------------- | -------- | ------------------------- | +| rwxrwxrwx | config_proxy.json.template | 普通文件 | config_proxy.json文件模板 | +| rwxrwxrwx | fw.d/xray_proxy_open | 普通文件 | fw.d配置文件 | +| rwxrwxrwx | monit.d/fw_filter_INPUT_xray_proxy | 普通文件 | monit.d配置文件 | +| rwxrwxrwx | monit.d/xray_proxy | 普通文件 | monit.d配置文件 | +| rwxrwxrwx | monit.d/xray_transparent_proxy_file | 普通文件 | monit.d配置文件 | +| rwxrwxrwx | monit.d/xray_transparent_proxy_prog | 普通文件 | monit.d配置文件 | + +## 安装方法 + +执行`/tmp/mnt/ASUS_ROUTER/script_bootloader/usr/xray/bin/xray_install`。程序会根据路由器架构,自动安装适当版本的xray + + > [受支持的路由器型号](https://github.com/Entware/Entware/wiki/Install-on-Asus-stock-firmware): + > + > | 架构 | 路由器型号 | + > | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | + > | **aarch64** | GT-AC2900, GT-AC5300, GT-AX11000, RT-AC86U, RT-AX88U, RT-AX92U | + > | **armv7** | Lyra Voice, RT-AC56U, RT-AC66U B1, RT-AC68P, RT-AC68U, RT-AC87U, RT-AC88U, RT-AC1200G, RT-AC1900P, RT-AC3100, RT-AC3200, RT-AC5300, RT-ACRH13, RT-AX56U, RT-AX58U | + > | **mipsel** | RT-N16, RT-N56U, RT-N66R, RT-N600, RT-AC51U, RT-AC66U, RT-AC66R, RT-AC1200, RT-AC1750, RT-AC1750 B1 | + +## 调用方法 + +| 插件文件 | 插件调用者 | +| ------------------------------------------- | ----------------------------------- | +| xray_proxy_enable.service | monit.d/xray_proxy | +| xray_proxy_disable.service | monit.d/xray_proxy | +| xray_transparent_proxy_enable_file.service | monit.d/xray_transparent_proxy_file | +| xray_transparent_proxy_disable_file.service | monit.d/xray_transparent_proxy_file | +| xray_transparent_proxy_enable_prog.service | monit.d/xray_transparent_proxy_prog | +| xray_transparent_proxy_disable_prog.service | monit.d/xray_transparent_proxy_prog | + +## 注意事项 + +1. 登录monit管理页面,可以看到XRAY_PROXY和XRAY_TRANSPARENT_PROXY +2. XRAY_PROXY是浏览器代理。可以配合客户端代理工具使用,路由器和未使用代理工具的客户端均在墙内 +3. XRAY_TRANSPARENT_PROXY是全局透明代理。必须先在monit管理页面中停止XRAY_PROXY,然后再启用XRAY_TRANSPARENT_PROXY。路由器和全体客户端均在墙外 \ No newline at end of file diff --git a/xray/bin/fw_xray_transparent_proxy_disable.service b/xray/bin/fw_xray_transparent_proxy_disable.service new file mode 100644 index 0000000..1c4d3e2 --- /dev/null +++ b/xray/bin/fw_xray_transparent_proxy_disable.service @@ -0,0 +1,159 @@ +#!/bin/sh +# +########## SET THE CUSTOM VARIABLES ########## +# +# 设置自定义变量 +# 当该程序运行结束,此处设置的变量自动取消 +# +# NAME OF THE SERVICE +# 服务名称 +SERVICE_NAME="FW_XRAY_TRANSPARENT_PROXY" +# +# FUNCTION OF THE SERVICE +# 服务功能 +SERVICE_FUNCTION="DISABLE" +# +# USB_MOUNT_POINT: The mount point of the USB flash drive +# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 +USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" +# +# ENTWARE_ETC: The directory which contains all the configuration files installed by Entware +# 设置自定义变量ENTWARE_ETC为Entware安装的配置文件目录 +ENTWARE_ETC="${USB_MOUNT_POINT}/etc" +# +# ENTWARE_DNSMASQD: The directory which contains all the configuration files used by dnsmasq +# 设置自定义变量ENTWARE_DNSMASQD为dnsmasq配置文件目录 +ENTWARE_DNSMASQD="${ENTWARE_ETC}/dnsmasq.d" +# +# ROUTING_MARK: Mark of PBR +# 设置自定义变量ROUTING_MARK为策略路由标记 +ROUTING_MARK="0x2333" +# +# ROUTING_TABLE: Routing table of PBR +# 设置自定义变量ROUTING_TABLE为策略路由表 +ROUTING_TABLE="100" +# +# NF_TPROXY_CORE: The path to nf_tproxy_core.ko +# 设置自定义变量NF_TPROXY_CORE为文件nf_tproxy_core.ko的绝对路径 +NF_TPROXY_CORE="$(/opt/bin/find /lib/modules/ -iname "nf_tproxy_core.ko")" +# +# XT_TPROXY: The path to xt_TPROXY.ko +# 设置自定义变量XT_TPROXY为文件xt_TPROXY.ko的绝对路径 +XT_TPROXY="$(/opt/bin/find /lib/modules/ -iname "xt_TPROXY.ko")" +# +########## END ########## +# +# +########## NOTIFICATION ########## +# +/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ---------*" +# +########## END ########## +# +# +########## UNSET TRANSPARENT PROXY ########## +# +# Check if TProxy modules exist +# 检查TProxy模块是否存在 +if [ -n "${NF_TPROXY_CORE}" ] && [ -n "${XT_TPROXY}" ] +then + # USER_DEFINED_CHAIN_NAME: Name of the user-defined chain + # 设置自定义变量USER_DEFINED_CHAIN_NAME为防火墙自定义链名 + USER_DEFINED_CHAIN_NAME="XRAY_TPROXY" + # + # Configure DNS + # 配置DNS + /opt/bin/mv -f "/tmp/resolv.dnsmasq.bak" "/tmp/resolv.dnsmasq" + /opt/bin/rm -f "${ENTWARE_DNSMASQD}/xray_dns_tproxy.conf" + /opt/bin/dnsmasq.d_refresh > /dev/null 2>&1 + # + # Check if chain ${USER_DEFINED_CHAIN_NAME} exists + # 检查${USER_DEFINED_CHAIN_NAME}链是否存在 + if [ -n "$(iptables -t mangle -nvL | /opt/bin/grep ''"Chain ${USER_DEFINED_CHAIN_NAME}"'')" ] + then + # Check if chain ${USER_DEFINED_CHAIN_NAME} is referenced by chain PREROUTING + # 检查${USER_DEFINED_CHAIN_NAME}链是否被PREROUTING链所引用 + if [ -n "$(iptables -t mangle -nvL PREROUTING | /opt/bin/grep ''"${USER_DEFINED_CHAIN_NAME}"'')" ] + then + # Disable chain ${USER_DEFINED_CHAIN_NAME} + # 禁用${USER_DEFINED_CHAIN_NAME}链 + iptables -t mangle -D PREROUTING -j "${USER_DEFINED_CHAIN_NAME}" 2> /dev/null + fi + # + # Flush chain ${USER_DEFINED_CHAIN_NAME} + # 清空${USER_DEFINED_CHAIN_NAME}链 + iptables -t mangle -F "${USER_DEFINED_CHAIN_NAME}" 2> /dev/null + # + # Remove chain ${USER_DEFINED_CHAIN_NAME} + # 删除${USER_DEFINED_CHAIN_NAME}链 + iptables -t mangle -X "${USER_DEFINED_CHAIN_NAME}" 2> /dev/null + # + # Check if chain ${USER_DEFINED_CHAIN_NAME}_MASK is referenced by chain OUTPUT + # 检查${USER_DEFINED_CHAIN_NAME}_MASK链是否被OUTPUT链所引用 + if [ -n "$(iptables -t mangle -nvL OUTPUT | /opt/bin/grep ''"${USER_DEFINED_CHAIN_NAME}_MASK"'')" ] + then + # Disable chain ${USER_DEFINED_CHAIN_NAME}_MASK + # 禁用${USER_DEFINED_CHAIN_NAME}_MASK链 + iptables -t mangle -D OUTPUT -p tcp -j "${USER_DEFINED_CHAIN_NAME}_MASK" 2> /dev/null + iptables -t mangle -D OUTPUT -p udp -j "${USER_DEFINED_CHAIN_NAME}_MASK" 2> /dev/null + fi + # + # Flush chain ${USER_DEFINED_CHAIN_NAME}_MASK + # 清空${USER_DEFINED_CHAIN_NAME}_MASK链 + iptables -t mangle -F "${USER_DEFINED_CHAIN_NAME}_MASK" 2> /dev/null + # + # Remove chain ${USER_DEFINED_CHAIN_NAME}_MASK + # 删除${USER_DEFINED_CHAIN_NAME}_MASK链 + iptables -t mangle -X "${USER_DEFINED_CHAIN_NAME}_MASK" 2> /dev/null + fi + # + # Remove IP route and rules + # 删除IP路由及规则 + ip route del local 0.0.0.0/0 dev lo table "${ROUTING_TABLE}" 2> /dev/null + ip rule del fwmark "${ROUTING_MARK}" table "${ROUTING_TABLE}" 2> /dev/null + # +else + # USER_DEFINED_CHAIN_NAME: Name of the user-defined chain + # 设置自定义变量USER_DEFINED_CHAIN_NAME为防火墙自定义链名 + USER_DEFINED_CHAIN_NAME="XRAY_REDIRECT" + # + # Configure DNS + # 配置DNS + /opt/bin/mv -f "/tmp/resolv.dnsmasq.bak" "/tmp/resolv.dnsmasq" + /opt/bin/rm -f "${ENTWARE_DNSMASQD}/xray_dns_redirect.conf" + /opt/bin/dnsmasq.d_refresh > /dev/null 2>&1 + # + # Check if chain ${USER_DEFINED_CHAIN_NAME} exists + # 检查${USER_DEFINED_CHAIN_NAME}链是否存在 + if [ -n "$(iptables -t nat -nvL | /opt/bin/grep ''"Chain ${USER_DEFINED_CHAIN_NAME}"'')" ] + then + # Check if chain ${USER_DEFINED_CHAIN_NAME} is referenced by chain PREROUTING + # 检查${USER_DEFINED_CHAIN_NAME}链是否被PREROUTING链所引用 + if [ -n "$(iptables -t nat -nvL PREROUTING | /opt/bin/grep ''"${USER_DEFINED_CHAIN_NAME}"'')" ] + then + # Disable chain ${USER_DEFINED_CHAIN_NAME} + # 禁用${USER_DEFINED_CHAIN_NAME}链 + iptables -t nat -D PREROUTING -p tcp -j "${USER_DEFINED_CHAIN_NAME}" 2> /dev/null + fi + # + # Flush chain ${USER_DEFINED_CHAIN_NAME} + # 清空${USER_DEFINED_CHAIN_NAME}链 + iptables -t nat -F "${USER_DEFINED_CHAIN_NAME}" 2> /dev/null + # + # Remove chain ${USER_DEFINED_CHAIN_NAME} + # 删除${USER_DEFINED_CHAIN_NAME}链 + iptables -t nat -X "${USER_DEFINED_CHAIN_NAME}" 2> /dev/null + # + fi +fi +# +########## END ########## +# +# +########## NOTIFICATION ########## +# +/opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" +# +exit 0 +# +########## END ########## \ No newline at end of file diff --git a/xray/bin/fw_xray_transparent_proxy_enable.service b/xray/bin/fw_xray_transparent_proxy_enable.service new file mode 100644 index 0000000..e3b7cdd --- /dev/null +++ b/xray/bin/fw_xray_transparent_proxy_enable.service @@ -0,0 +1,174 @@ +#!/bin/sh +# +########## SET THE CUSTOM VARIABLES ########## +# +# 设置自定义变量 +# 当该程序运行结束,此处设置的变量自动取消 +# +# NAME OF THE SERVICE +# 服务名称 +SERVICE_NAME="FW_XRAY_TRANSPARENT_PROXY" +# +# FUNCTION OF THE SERVICE +# 服务功能 +SERVICE_FUNCTION="ENABLE" +# +# USB_MOUNT_POINT: The mount point of the USB flash drive +# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 +USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" +# +# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER +# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 +SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" +# +# ENTWARE_ETC: The directory which contains all the configuration files installed by Entware +# 设置自定义变量ENTWARE_ETC为Entware安装的配置文件目录 +ENTWARE_ETC="${USB_MOUNT_POINT}/etc" +# +# ENTWARE_DNSMASQD: The directory which contains all the configuration files used by dnsmasq +# 设置自定义变量ENTWARE_DNSMASQD为dnsmasq配置文件目录 +ENTWARE_DNSMASQD="${ENTWARE_ETC}/dnsmasq.d" +# +# PRIVATE_ROOT: The root directory for this program +# 设置自定义变量PRIVATE_ROOT为此程序根目录 +PRIVATE_ROOT="${SBL_SYS_USR}/xray" +# +# PRIVATE_ETC: The directory which contains all the configuration files related to this program +# 设置自定义变量PRIVATE_ETC为此程序配置文件目录 +PRIVATE_ETC="${PRIVATE_ROOT}/etc" +# +# BOOTSTRAP_DNS_SERVER: DNS Server to resolve the domain of the XRAY-SERVER +# 设置自定义变量BOOTSTRAP_DNS_SERVER为解析XRAY-SERVER域名的DNS服务器 +BOOTSTRAP_DNS_SERVER="119.29.29.29" +# +# SERVER_DOMAIN: Domain of the XRAY-SERVER +# 设置自定义变量SERVER_DOMAIN为XRAY-SERVER的域名 +SERVER_DOMAIN="$(/opt/bin/sed -E -n -e '/outbounds/,/port/s/^[[:space:]]*\"address\":[[:space:]]*\"(.*)\".*/\1/p' "${PRIVATE_ETC}/config_proxy.json")" +# +# SERVER_IP: Domain of the XRAY-SERVER +# 设置自定义变量SERVER_IP为XRAY-SERVER的IP地址 +SERVER_IP="$(nslookup "${SERVER_DOMAIN}" "${BOOTSTRAP_DNS_SERVER}" | /opt/bin/sed -E -n -e '/Name/,$s/.*:[[:space:]]+([[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3})($|[[:space:]]+.*)/\1/p' | /opt/bin/head -n 1)" +# +# ROUTING_MARK: Mark of PBR +# 设置自定义变量ROUTING_MARK为策略路由标记 +ROUTING_MARK="0x2333" +# +# ROUTING_TABLE: Routing table of PBR +# 设置自定义变量ROUTING_TABLE为策略路由表 +ROUTING_TABLE="100" +# +# NF_TPROXY_CORE: The path to nf_tproxy_core.ko +# 设置自定义变量NF_TPROXY_CORE为文件nf_tproxy_core.ko的绝对路径 +NF_TPROXY_CORE="$(/opt/bin/find /lib/modules/ -iname "nf_tproxy_core.ko")" +# +# XT_TPROXY: The path to xt_TPROXY.ko +# 设置自定义变量XT_TPROXY为文件xt_TPROXY.ko的绝对路径 +XT_TPROXY="$(/opt/bin/find /lib/modules/ -iname "xt_TPROXY.ko")" +# +########## END ########## +# +# +########## NOTIFICATION ########## +# +/opt/bin/echo -e "($(basename $0)): $$ *--------- ${SERVICE_FUNCTION} ${SERVICE_NAME} ---------*" +# +########## END ########## +# +# +########## SET TRANSPARENT PROXY ########## +# +# Check if TProxy modules exist +# 检查TProxy模块是否存在 +if [ -n "${NF_TPROXY_CORE}" ] && [ -n "${XT_TPROXY}" ] +then + # LOCAL_TPROXY_PORT: Port of the XRAY-DOKODEMO-DOOR + # 设置自定义变量LOCAL_TPROXY_PORT为XRAY-DOKODEMO-DOOR的接收端口 + LOCAL_TPROXY_PORT="55155" + # + # USER_DEFINED_CHAIN_NAME: Name of the user-defined chain + # 设置自定义变量USER_DEFINED_CHAIN_NAME为防火墙自定义链名 + USER_DEFINED_CHAIN_NAME="XRAY_TPROXY" + # + # Enable TPROXY + # 启用TPROXY + insmod "${NF_TPROXY_CORE}" + insmod "${XT_TPROXY}" + # + # Set rules + # 设置规则 + ip rule add fwmark "${ROUTING_MARK}" table "${ROUTING_TABLE}" + ip route add local 0.0.0.0/0 dev lo table "${ROUTING_TABLE}" + # + iptables -t mangle -N "${USER_DEFINED_CHAIN_NAME}" + iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}" -d "0.0.0.0/8" -j RETURN + iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}" -d "10.0.0.0/8" -j RETURN + iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}" -d "127.0.0.0/8" -j RETURN + iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}" -d "169.254.0.0/16" -j RETURN + iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}" -d "172.16.0.0/12" -j RETURN + iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}" -d "192.168.0.0/16" -j RETURN + iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}" -d "224.0.0.0/4" -j RETURN + iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}" -d "240.0.0.0/4" -j RETURN + iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}" -p tcp -j TPROXY --on-port "${LOCAL_TPROXY_PORT}" --tproxy-mark "${ROUTING_MARK}" + iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}" -p udp -j TPROXY --on-port "${LOCAL_TPROXY_PORT}" --tproxy-mark "${ROUTING_MARK}" + iptables -t mangle -A PREROUTING -j "${USER_DEFINED_CHAIN_NAME}" + # + iptables -t mangle -N "${USER_DEFINED_CHAIN_NAME}"_MASK + iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}"_MASK -d "0.0.0.0/8" -j RETURN + iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}"_MASK -d "10.0.0.0/8" -j RETURN + iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}"_MASK -d "127.0.0.0/8" -j RETURN + iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}"_MASK -d "169.254.0.0/16" -j RETURN + iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}"_MASK -d "172.16.0.0/12" -j RETURN + iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}"_MASK -d "192.168.0.0/16" -j RETURN + iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}"_MASK -d "224.0.0.0/4" -j RETURN + iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}"_MASK -d "240.0.0.0/4" -j RETURN + iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}"_MASK -d "${SERVER_IP}/32" -j RETURN + iptables -t mangle -A "${USER_DEFINED_CHAIN_NAME}"_MASK -j MARK --set-mark "${ROUTING_MARK}" + iptables -t mangle -A OUTPUT -p tcp -j "${USER_DEFINED_CHAIN_NAME}"_MASK + iptables -t mangle -A OUTPUT -p udp -j "${USER_DEFINED_CHAIN_NAME}"_MASK + # + # Configure DNS + # 配置DNS + /opt/bin/mv -f "/tmp/resolv.dnsmasq" "/tmp/resolv.dnsmasq.bak" + /opt/bin/cp -lf "${PRIVATE_ETC}/dnsmasq.d/xray_dns_tproxy.conf" "${ENTWARE_DNSMASQD}" + /opt/bin/dnsmasq.d_refresh > /dev/null 2>&1 +else + # LOCAL_REDIRECT_PORT: Port of the XRAY-DOKODEMO-DOOR + # 设置自定义变量LOCAL_REDIRECT_PORT为XRAY-DOKODEMO-DOOR的接收端口 + LOCAL_REDIRECT_PORT="45154" + # + # USER_DEFINED_CHAIN_NAME: Name of the user-defined chain + # 设置自定义变量USER_DEFINED_CHAIN_NAME为防火墙自定义链名 + USER_DEFINED_CHAIN_NAME="XRAY_REDIRECT" + # + # Set rules + # 设置规则 + iptables -t nat -N "${USER_DEFINED_CHAIN_NAME}" + iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}" -d "${SERVER_IP}" -j RETURN + iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}" -d "0.0.0.0/8" -j RETURN + iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}" -d "10.0.0.0/8" -j RETURN + iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}" -d "127.0.0.0/8" -j RETURN + iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}" -d "169.254.0.0/16" -j RETURN + iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}" -d "172.16.0.0/12" -j RETURN + iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}" -d "192.168.0.0/16" -j RETURN + iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}" -d "224.0.0.0/4" -j RETURN + iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}" -d "240.0.0.0/4" -j RETURN + iptables -t nat -A "${USER_DEFINED_CHAIN_NAME}" -p tcp -j REDIRECT --to-ports "${LOCAL_REDIRECT_PORT}" + iptables -t nat -A PREROUTING -p tcp -j "${USER_DEFINED_CHAIN_NAME}" + # + # Configure DNS + # 配置DNS + /opt/bin/mv -f "/tmp/resolv.dnsmasq" "/tmp/resolv.dnsmasq.bak" + /opt/bin/cp -lf "${PRIVATE_ETC}/dnsmasq.d/xray_dns_redirect.conf" "${ENTWARE_DNSMASQD}" + /opt/bin/dnsmasq.d_refresh > /dev/null 2>&1 +fi +# +########## END ########## +# +# +########## NOTIFICATION ########## +# +/opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" +# +exit 0 +# +########## END ########## \ No newline at end of file diff --git a/xray/bin/xray_configure b/xray/bin/xray_configure new file mode 100644 index 0000000..36fc613 --- /dev/null +++ b/xray/bin/xray_configure @@ -0,0 +1,99 @@ +#!/bin/sh +# +########## SET THE CUSTOM VARIABLES ########## +# +# 设置自定义变量 +# 当该程序运行结束,此处设置的变量自动取消 +# +# USB_MOUNT_POINT: The mount point of the USB flash drive +# 设置自定义变量USB_MOUNT_POINT为U盘挂载点 +USB_MOUNT_POINT="$(nvram get script_usbmount | /opt/bin/sed 's/\/script_bootloader.*//')" +# +# SBL_SYS_USR: The directory which contains all the external software resources (add-ons) related to SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER +# 设置自定义变量SBL_SYS_USR为SCRIPTS-BOOTLOADER-FOR-ASUS-ROUTER系统外部软件资源目录,即插件目录 +SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" +# +# PRIVATE_ROOT: The root directory for this program +# 设置自定义变量PRIVATE_ROOT为此程序根目录 +PRIVATE_ROOT="${SBL_SYS_USR}/xray" +# +# PRIVATE_ETC: The directory which contains all the configuration files related to this program +# 设置自定义变量PRIVATE_ETC为此程序配置文件目录 +PRIVATE_ETC="${PRIVATE_ROOT}/etc" +# +########## END ########## +# +# +########## LOAD FUNCTIONS ########## +# +doubleCheckAndConfirm() +{ + while [ 1 ] + do + local VALUE_1 + local VALUE_2 + # + /opt/bin/echo -ne "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: INPUT THE VALUE: " + read VALUE_1 + /opt/bin/echo -ne "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: INPUT THE VALUE AGAIN TO CONFIRM: " + read VALUE_2 + # + if [ "${VALUE_1}" == "${VALUE_2}" ] + then + eval ${1}="${VALUE_1}" + break + else + /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: THE TWO VALUES ARE INCONSISTENT" + fi + done +} +# +########## END ########## +# +# +########## SET PARAMETERS ########## +# +case ${#} in + 0) + /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mUPSTREAM DNS IP\033[0m: IP address of upstream DNS server" + doubleCheckAndConfirm UPSTREAM_DNS_IP + # + /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mINBOUND VMESS ID\033[0m: vmess ID used to connect router from Internet" + doubleCheckAndConfirm INBOUND_VMESS_ID + # + /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mSERVER ADDRESS\033[0m: IP address or domain name of remote xray server" + doubleCheckAndConfirm IP_OR_DOMAIN_OF_XRAY_SERVER + # + /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mOUTBOUND VLESS ID\033[0m: vless ID used to connect remote xray server" + doubleCheckAndConfirm OUTBOUND_VLESS_ID + # + /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: \033[4mREALITY PUBLIC KEY\033[0m: outbound vless reality public key" + doubleCheckAndConfirm OUTBOUND_VLESS_REALITY_PUBLIC_KEY + ;; + *) + /opt/bin/echo -e "($(basename $0)): $$ \033[1;41;37mFAILURE\033[0m: WRONG NUMBER OF PARAMETERS" + # + exit 1 + ;; +esac +# +########## END ########## +# +# +########## CONFIGURE XRAY ########## +# +# Create ${PRIVATE_ETC}/config_proxy.json +# 创建${PRIVATE_ETC}/config_proxy.json +/opt/bin/cp -f "${PRIVATE_ETC}/config_proxy.json.template" "${PRIVATE_ETC}/config_proxy.json" +# +# Modify ${PRIVATE_ETC}/config_proxy.json +# 修改${PRIVATE_ETC}/config_proxy.json +/opt/bin/sed -E -i 's##'"${UPSTREAM_DNS_IP}"'#' "${PRIVATE_ETC}/config_proxy.json" +/opt/bin/sed -E -i 's##'"${INBOUND_VMESS_ID}"'#' "${PRIVATE_ETC}/config_proxy.json" +/opt/bin/sed -E -i 's##'"${IP_OR_DOMAIN_OF_XRAY_SERVER}"'#' "${PRIVATE_ETC}/config_proxy.json" +/opt/bin/sed -E -i 's##'"${OUTBOUND_VLESS_ID}"'#' "${PRIVATE_ETC}/config_proxy.json" +/opt/bin/sed -E -i 's##'"${OUTBOUND_VLESS_REALITY_PUBLIC_KEY}"'#' "${PRIVATE_ETC}/config_proxy.json" +# +exit 0 +# +########## END ########## \ No newline at end of file diff --git a/v2ray/bin/v2ray_install b/xray/bin/xray_install similarity index 67% rename from v2ray/bin/v2ray_install rename to xray/bin/xray_install index 1b208d5..c01d5e3 100644 --- a/v2ray/bin/v2ray_install +++ b/xray/bin/xray_install @@ -14,7 +14,7 @@ ROUTER_MODEL="$(nvram get model)" # # NAME OF THE SERVICE # 服务名称 -SERVICE_NAME="V2RAY" +SERVICE_NAME="XRAY" # # FUNCTION OF THE SERVICE # 服务功能 @@ -42,7 +42,7 @@ ENTWARE_FWD="${ENTWARE_ETC}/fw.d" # # PRIVATE_ROOT: The root directory for this program # 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/v2ray" +PRIVATE_ROOT="${SBL_SYS_USR}/xray" # # PRIVATE_ALTERNATIVE: The directory which contains all the alternatives # 设置自定义变量PRIVATE_ALTERNATIVE为此程序备用文件目录 @@ -60,9 +60,9 @@ PRIVATE_ETC="${PRIVATE_ROOT}/etc" # 设置自定义变量PRIVATE_USR为此程序外部软件资源目录 PRIVATE_USR="${PRIVATE_ROOT}/usr" # -# LATEST_VERSION: Version of the latest v2ray-core -# 设置自定义变量LATEST_VERSION为最新版v2ray-core的版本号 -LATEST_VERSION="$(/opt/bin/curl -s "https://api.github.com/repos/v2fly/v2ray-core/releases/latest" | /opt/bin/sed -E -n -e 's/^[[:space:]]*\"tag_name\":[[:space:]]*\"(.*)\".*/\1/p')" +# LATEST_VERSION: Version of the latest xray-core +# 设置自定义变量LATEST_VERSION为最新版xray-core的版本号 +LATEST_VERSION="$(/opt/bin/curl -s "https://api.github.com/repos/XTLS/Xray-core/releases/latest" | /opt/bin/sed -E -n -e 's/^[[:space:]]*\"tag_name\":[[:space:]]*\"(.*)\".*/\1/p')" # # OPERATING_SYSTEM: Operating system of the ASUS Router # 设置自定义变量OPERATING_SYSTEM为华硕路由器系统 @@ -90,12 +90,12 @@ case "$(/opt/bin/uname -m)" in ;; esac # -# DOWNLOAD_LINK: Download link of the latest v2ray-core -# 设置自定义变量DOWNLOAD_LINK为最新版v2ray-core的下载链接 -DOWNLOAD_LINK="https://github.com/v2fly/v2ray-core/releases/download/${LATEST_VERSION}/v2ray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" +# DOWNLOAD_LINK: Download link of the latest xray-core +# 设置自定义变量DOWNLOAD_LINK为最新版xray-core的下载链接 +DOWNLOAD_LINK="https://github.com/XTLS/Xray-core/releases/download/${LATEST_VERSION}/Xray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" # -# DNS_PORT: Port of the V2RAY-DNS -# 设置自定义变量DNS_PORT为V2RAY-DNS的接收端口 +# DNS_PORT: Port of the XRAY-DNS +# 设置自定义变量DNS_PORT为XRAY-DNS的接收端口 DNS_PORT="2053" # ########## END ########## @@ -108,7 +108,7 @@ DNS_PORT="2053" ########## END ########## # # -########## INSTALL V2RAY ########## +########## INSTALL XRAY ########## # # Check if ENTWARE_ENABLE SERVICE has been loaded # 检查ENTWARE_ENABLE SERVICE是否已启用 @@ -122,9 +122,9 @@ then then /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: MONIT MANAGEMENT SYSTEM HAS BEEN DEPLOYED" # - # Remove vestigial v2ray-core package - # 删除遗留的v2ray-core包 - /opt/bin/rm -f "${PRIVATE_BIN}/v2ray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" + # Remove vestigial xray-core package + # 删除遗留的xray-core包 + /opt/bin/rm -f "${PRIVATE_BIN}/Xray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" # # Check if ${PRIVATE_ALTERNATIVE}/version exists # 检查文件${PRIVATE_ALTERNATIVE}/version是否存在 @@ -133,21 +133,21 @@ then # Prepare to install offline # 准备离线安装 LATEST_VERSION="$(/opt/bin/head -n 1 "${PRIVATE_ALTERNATIVE}/version")" - /opt/bin/cp -f "${PRIVATE_ALTERNATIVE}/v2ray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" "${PRIVATE_BIN}" + /opt/bin/cp -f "${PRIVATE_ALTERNATIVE}/Xray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" "${PRIVATE_BIN}" # else - # Download v2ray-core package - # 下载v2ray-core包 + # Download xray-core package + # 下载xray-core包 /opt/bin/wget-ssl -c -t 10 -T 120 --no-cookies --no-check-certificate -P "${PRIVATE_BIN}" "${DOWNLOAD_LINK}" # - # Check if ${PRIVATE_BIN}/v2ray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip exists - # 检查文件${PRIVATE_BIN}/v2ray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip是否存在 - if [ ! -s "${PRIVATE_BIN}/v2ray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" ] + # Check if ${PRIVATE_BIN}/Xray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip exists + # 检查文件${PRIVATE_BIN}/Xray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip是否存在 + if [ ! -s "${PRIVATE_BIN}/Xray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" ] then /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: CONNECTION FAILED" /opt/bin/echo -e "($(basename $0)): $$ \033[1;41;37mFAILURE\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" # - /opt/bin/rm -f "${PRIVATE_BIN}/v2ray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" + /opt/bin/rm -f "${PRIVATE_BIN}/Xray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" # exit 5 fi @@ -158,24 +158,23 @@ then # 创建${PRIVATE_USR}目录 /opt/bin/mkdir "${PRIVATE_USR}" # - # Unzip v2ray-core package - # 解压v2ray-core包 - /opt/bin/unzip "${PRIVATE_BIN}/v2ray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" -d "${PRIVATE_USR}" + # Unzip xray-core package + # 解压xray-core包 + /opt/bin/unzip "${PRIVATE_BIN}/Xray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" -d "${PRIVATE_USR}" # - # Remove v2ray-core package - # 删除v2ray-core包 - /opt/bin/rm -f "${PRIVATE_BIN}/v2ray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" + # Remove xray-core package + # 删除xray-core包 + /opt/bin/rm -f "${PRIVATE_BIN}/Xray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" # # Change the mode of the files # 更改文件权限 - /opt/bin/chmod 644 "${PRIVATE_USR}"/vpoint* - /opt/bin/chmod 555 "${PRIVATE_USR}"/v2* + /opt/bin/chmod 555 "${PRIVATE_USR}"/xray /opt/bin/chmod 644 "${PRIVATE_USR}/geosite.dat" - /opt/bin/chmod 755 "${PRIVATE_USR}/geoip.dat" + /opt/bin/chmod 644 "${PRIVATE_USR}/geoip.dat" # - # Configure v2ray - # 配置v2ray - "${PRIVATE_BIN}/v2ray_configure" + # Configure xray + # 配置xray + "${PRIVATE_BIN}/xray_configure" # # Configure dnsmasq.d # 配置dnsmasq.d @@ -184,30 +183,30 @@ then /opt/bin/mkdir "${PRIVATE_ETC}/dnsmasq.d" fi # - /opt/bin/echo -e "server=8.8.8.8" > "${PRIVATE_ETC}/dnsmasq.d/v2ray_dns_tproxy.conf" - /opt/bin/echo -e "server=127.0.0.1#${DNS_PORT}" > "${PRIVATE_ETC}/dnsmasq.d/v2ray_dns.conf" + /opt/bin/echo -e "server=8.8.8.8" > "${PRIVATE_ETC}/dnsmasq.d/xray_dns_tproxy.conf" + /opt/bin/echo -e "server=127.0.0.1#${DNS_PORT}" > "${PRIVATE_ETC}/dnsmasq.d/xray_dns_redirect.conf" # # Configure fwd # 配置fwd - /opt/bin/cp -f "${PRIVATE_ETC}/fw.d/v2ray_proxy_open" "${ENTWARE_FWD}" + /opt/bin/cp -f "${PRIVATE_ETC}/fw.d/xray_proxy_open" "${ENTWARE_FWD}" # # Configure monit # 配置monit - /opt/bin/cp -f "${PRIVATE_ETC}/monit.d/v2ray" "${ENTWARE_MONITD}" - /opt/bin/chmod 600 "${ENTWARE_MONITD}/v2ray" - /opt/bin/mv -f "${ENTWARE_MONITD}/v2ray" "${ENTWARE_MONITD}/v2ray.on" + /opt/bin/cp -f "${PRIVATE_ETC}/monit.d/xray_proxy" "${ENTWARE_MONITD}" + /opt/bin/chmod 600 "${ENTWARE_MONITD}/xray_proxy" + /opt/bin/mv -f "${ENTWARE_MONITD}/xray_proxy" "${ENTWARE_MONITD}/xray_proxy.on" # - /opt/bin/cp -f "${PRIVATE_ETC}/monit.d/fw_filter_INPUT_v2ray_proxy" "${ENTWARE_MONITD}" - /opt/bin/chmod 600 "${ENTWARE_MONITD}/fw_filter_INPUT_v2ray_proxy" - /opt/bin/mv -f "${ENTWARE_MONITD}/fw_filter_INPUT_v2ray_proxy" "${ENTWARE_MONITD}/fw_filter_INPUT_v2ray_proxy.on" + /opt/bin/cp -f "${PRIVATE_ETC}/monit.d/fw_filter_INPUT_xray_proxy" "${ENTWARE_MONITD}" + /opt/bin/chmod 600 "${ENTWARE_MONITD}/fw_filter_INPUT_xray_proxy" + /opt/bin/mv -f "${ENTWARE_MONITD}/fw_filter_INPUT_xray_proxy" "${ENTWARE_MONITD}/fw_filter_INPUT_xray_proxy.on" # - /opt/bin/cp -f "${PRIVATE_ETC}/monit.d/v2ray_transparent_proxy_file" "${ENTWARE_MONITD}" - /opt/bin/chmod 600 "${ENTWARE_MONITD}/v2ray_transparent_proxy_file" - /opt/bin/mv -f "${ENTWARE_MONITD}/v2ray_transparent_proxy_file" "${ENTWARE_MONITD}/v2ray_transparent_proxy_file.on" + /opt/bin/cp -f "${PRIVATE_ETC}/monit.d/xray_transparent_proxy_file" "${ENTWARE_MONITD}" + /opt/bin/chmod 600 "${ENTWARE_MONITD}/xray_transparent_proxy_file" + /opt/bin/mv -f "${ENTWARE_MONITD}/xray_transparent_proxy_file" "${ENTWARE_MONITD}/xray_transparent_proxy_file.on" # - /opt/bin/cp -f "${PRIVATE_ETC}/monit.d/v2ray_transparent_proxy_prog" "${ENTWARE_MONITD}" - /opt/bin/chmod 600 "${ENTWARE_MONITD}/v2ray_transparent_proxy_prog" - #/opt/bin/mv -f "${ENTWARE_MONITD}/v2ray_transparent_proxy_prog" "${ENTWARE_MONITD}/v2ray_transparent_proxy_prog.on" + /opt/bin/cp -f "${PRIVATE_ETC}/monit.d/xray_transparent_proxy_prog" "${ENTWARE_MONITD}" + /opt/bin/chmod 600 "${ENTWARE_MONITD}/xray_transparent_proxy_prog" + #/opt/bin/mv -f "${ENTWARE_MONITD}/xray_transparent_proxy_prog" "${ENTWARE_MONITD}/xray_transparent_proxy_prog.on" # /opt/bin/monit reload # diff --git a/shadowsocks/bin/ss_local_disable.service b/xray/bin/xray_proxy_disable.service similarity index 68% rename from shadowsocks/bin/ss_local_disable.service rename to xray/bin/xray_proxy_disable.service index bd6c145..4b06dea 100644 --- a/shadowsocks/bin/ss_local_disable.service +++ b/xray/bin/xray_proxy_disable.service @@ -7,15 +7,15 @@ # # NAME OF THE SERVICE # 服务名称 -SERVICE_NAME="SS-LOCAL" +SERVICE_NAME="XRAY-PROXY" # # FUNCTION OF THE SERVICE # 服务功能 SERVICE_FUNCTION="DISABLE" # -# SS_LOCAL_PID_FILE: The path to ss_local.pid -# 设置自定义变量SS_LOCAL_PID_FILE为文件ss_local.pid的绝对路径 -SS_LOCAL_PID_FILE="/var/run/ss_local.pid" +# XRAY_PROXY_PID_FILE: The path to xray_proxy.pid +# 设置自定义变量XRAY_PROXY_PID_FILE为文件xray_proxy.pid的绝对路径 +XRAY_PROXY_PID_FILE="/var/run/xray_proxy.pid" # ########## END ########## # @@ -27,14 +27,14 @@ SS_LOCAL_PID_FILE="/var/run/ss_local.pid" ########## END ########## # # -########## DISABLE SS-LOCAL ########## +########## DISABLE XRAY ########## # -for PID in $(/opt/bin/cat "${SS_LOCAL_PID_FILE}") +for PID in $(/opt/bin/cat "${XRAY_PROXY_PID_FILE}") do /opt/bin/kill ${PID} done # -/opt/bin/rm -f "${SS_LOCAL_PID_FILE}" +/opt/bin/rm -f "${XRAY_PROXY_PID_FILE}" # ########## END ########## # diff --git a/v2ray/bin/v2ray_enable.service b/xray/bin/xray_proxy_enable.service similarity index 70% rename from v2ray/bin/v2ray_enable.service rename to xray/bin/xray_proxy_enable.service index 6738aec..beca8d7 100644 --- a/v2ray/bin/v2ray_enable.service +++ b/xray/bin/xray_proxy_enable.service @@ -7,7 +7,7 @@ # # NAME OF THE SERVICE # 服务名称 -SERVICE_NAME="V2RAY" +SERVICE_NAME="XRAY-PROXY" # # FUNCTION OF THE SERVICE # 服务功能 @@ -23,7 +23,7 @@ SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" # # PRIVATE_ROOT: The root directory for this program # 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/v2ray" +PRIVATE_ROOT="${SBL_SYS_USR}/xray" # # PRIVATE_ETC: The directory which contains all the configuration files related to this program # 设置自定义变量PRIVATE_ETC为此程序配置文件目录 @@ -33,9 +33,9 @@ PRIVATE_ETC="${PRIVATE_ROOT}/etc" # 设置自定义变量PRIVATE_USR为此程序外部软件资源目录 PRIVATE_USR="${PRIVATE_ROOT}/usr" # -# V2RAY_PID_FILE: The path to v2ray.pid -# 设置自定义变量V2RAY_PID_FILE为文件v2ray.pid的绝对路径 -V2RAY_PID_FILE="/var/run/v2ray.pid" +# XRAY_PROXY_PID_FILE: The path to xray_proxy.pid +# 设置自定义变量XRAY_PROXY_PID_FILE为文件xray_proxy.pid的绝对路径 +XRAY_PROXY_PID_FILE="/var/run/xray_proxy.pid" # ########## END ########## # @@ -47,20 +47,20 @@ V2RAY_PID_FILE="/var/run/v2ray.pid" ########## END ########## # # -########## CHECK AND ENABLE V2RAY ########## +########## CHECK AND ENABLE XRAY ########## # -# Check if ${PRIVATE_USR}/v2ray and ${PRIVATE_ETC}/config_proxy.json exist -# 检查文件${PRIVATE_USR}/v2ray和文件${PRIVATE_ETC}/config_proxy.json是否存在 -if [ -e "${PRIVATE_USR}/v2ray" ] && [ -e "${PRIVATE_ETC}/config_proxy.json" ] +# Check if ${PRIVATE_USR}/xray and ${PRIVATE_ETC}/config_proxy.json exist +# 检查文件${PRIVATE_USR}/xray和文件${PRIVATE_ETC}/config_proxy.json是否存在 +if [ -e "${PRIVATE_USR}/xray" ] && [ -e "${PRIVATE_ETC}/config_proxy.json" ] then /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: ALL THE PREREQUISITES ARE MET" # - # Load ${PRIVATE_USR}/v2ray - # 如果文件${PRIVATE_USR}/v2ray存在,则执行 - /opt/bin/nohup "${PRIVATE_USR}/v2ray" -config "${PRIVATE_ETC}/config_proxy.json" &> /dev/null & + # Load ${PRIVATE_USR}/xray + # 如果文件${PRIVATE_USR}/xray存在,则执行 + /opt/bin/nohup "${PRIVATE_USR}/xray" run -config "${PRIVATE_ETC}/config_proxy.json" &> /dev/null & /opt/bin/sleep 10 - PID="$(pidof v2ray)" - /opt/bin/echo "${PID}" > "${V2RAY_PID_FILE}" + PID="$(pidof xray)" + /opt/bin/echo "${PID}" > "${XRAY_PROXY_PID_FILE}" # /opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" # @@ -68,7 +68,7 @@ then # else # Do nothing but prompt the user - # 如果文件${PRIVATE_USR}/v2ray不存在,则执行 + # 如果文件${PRIVATE_USR}/xray不存在,则执行 /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: NOT ALL THE PREREQUISITES ARE MET" /opt/bin/echo -e "($(basename $0)): $$ \033[1;41;37mFAILURE\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" # diff --git a/v2ray/bin/v2ray_transparent_proxy_disable_prog.service b/xray/bin/xray_transparent_proxy_disable_file.service similarity index 82% rename from v2ray/bin/v2ray_transparent_proxy_disable_prog.service rename to xray/bin/xray_transparent_proxy_disable_file.service index 41551f2..bec73d8 100644 --- a/v2ray/bin/v2ray_transparent_proxy_disable_prog.service +++ b/xray/bin/xray_transparent_proxy_disable_file.service @@ -7,7 +7,7 @@ # # NAME OF THE SERVICE # 服务名称 -SERVICE_NAME="V2RAY_TRANSPARENT_PROXY" +SERVICE_NAME="XRAY_TRANSPARENT_PROXY" # # FUNCTION OF THE SERVICE # 服务功能 @@ -23,7 +23,7 @@ SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" # # PRIVATE_ROOT: The root directory for this program # 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/v2ray" +PRIVATE_ROOT="${SBL_SYS_USR}/xray" # # PRIVATE_BIN: The directory which contains all the executable files related to this program # 设置自定义变量PRIVATE_BIN为此程序可执行文件目录 @@ -33,8 +33,8 @@ PRIVATE_BIN="${PRIVATE_ROOT}/bin" # 设置自定义变量PRIVATE_ETC为此程序配置文件目录 PRIVATE_ETC="${PRIVATE_ROOT}/etc" # -# SERVER_DOMAIN: Domain of the V2RAY-SERVER -# 设置自定义变量SERVER_DOMAIN为V2RAY-SERVER的域名 +# SERVER_DOMAIN: Domain of the XRAY-SERVER +# 设置自定义变量SERVER_DOMAIN为XRAY-SERVER的域名 SERVER_DOMAIN="$(/opt/bin/sed -E -n -e '/outbounds/,/port/s/^[[:space:]]*\"address\":[[:space:]]*\"(.*)\".*/\1/p' "${PRIVATE_ETC}/config_proxy.json")" # # ADMINUSER: The administrator of the router @@ -55,22 +55,22 @@ ADMINUSER="$(nvram get sbl_username)" # # Disable crontab because something is wrong with the poll time of monit # 因为monit的执行周期BUG,故禁用crontab进行进程周期执行 -#/opt/bin/sed -i '/v2ray_transparent_proxy_enable_file.service/d' "/var/spool/cron/crontabs/${ADMINUSER}" +/opt/bin/sed -i '/xray_transparent_proxy_enable_file.service/d' "/var/spool/cron/crontabs/${ADMINUSER}" # # Remove status file # 删除状态文件 -#/opt/bin/rm -f "/var/run/v2ray_transparent_proxy_enable_file" +/opt/bin/rm -f "/var/run/xray_transparent_proxy_enable" # ########## END ########## # # -########## DISABLE V2RAY AND V2RAY-FW ########## +########## DISABLE XRAY AND XRAY-FW ########## # # Stop all the relevant processes # 停止全部相关进程 -"${PRIVATE_BIN}/fw_v2ray_transparent_proxy_disable.service" > /dev/null 2>&1 +"${PRIVATE_BIN}/fw_xray_transparent_proxy_disable.service" > /dev/null 2>&1 /opt/bin/sleep 2 -"${PRIVATE_BIN}/v2ray_disable.service" > /dev/null 2>&1 +"${PRIVATE_BIN}/xray_proxy_disable.service" > /dev/null 2>&1 /opt/bin/sleep 2 # # Update /etc/hosts diff --git a/v2ray/bin/v2ray_transparent_proxy_disable_file.service b/xray/bin/xray_transparent_proxy_disable_prog.service similarity index 83% rename from v2ray/bin/v2ray_transparent_proxy_disable_file.service rename to xray/bin/xray_transparent_proxy_disable_prog.service index 910f479..7f58996 100644 --- a/v2ray/bin/v2ray_transparent_proxy_disable_file.service +++ b/xray/bin/xray_transparent_proxy_disable_prog.service @@ -7,7 +7,7 @@ # # NAME OF THE SERVICE # 服务名称 -SERVICE_NAME="V2RAY_TRANSPARENT_PROXY" +SERVICE_NAME="XRAY_TRANSPARENT_PROXY" # # FUNCTION OF THE SERVICE # 服务功能 @@ -23,7 +23,7 @@ SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" # # PRIVATE_ROOT: The root directory for this program # 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/v2ray" +PRIVATE_ROOT="${SBL_SYS_USR}/xray" # # PRIVATE_BIN: The directory which contains all the executable files related to this program # 设置自定义变量PRIVATE_BIN为此程序可执行文件目录 @@ -33,8 +33,8 @@ PRIVATE_BIN="${PRIVATE_ROOT}/bin" # 设置自定义变量PRIVATE_ETC为此程序配置文件目录 PRIVATE_ETC="${PRIVATE_ROOT}/etc" # -# SERVER_DOMAIN: Domain of the V2RAY-SERVER -# 设置自定义变量SERVER_DOMAIN为V2RAY-SERVER的域名 +# SERVER_DOMAIN: Domain of the XRAY-SERVER +# 设置自定义变量SERVER_DOMAIN为XRAY-SERVER的域名 SERVER_DOMAIN="$(/opt/bin/sed -E -n -e '/outbounds/,/port/s/^[[:space:]]*\"address\":[[:space:]]*\"(.*)\".*/\1/p' "${PRIVATE_ETC}/config_proxy.json")" # # ADMINUSER: The administrator of the router @@ -55,22 +55,22 @@ ADMINUSER="$(nvram get sbl_username)" # # Disable crontab because something is wrong with the poll time of monit # 因为monit的执行周期BUG,故禁用crontab进行进程周期执行 -/opt/bin/sed -i '/v2ray_transparent_proxy_enable_file.service/d' "/var/spool/cron/crontabs/${ADMINUSER}" +#/opt/bin/sed -i '/xray_transparent_proxy_enable_file.service/d' "/var/spool/cron/crontabs/${ADMINUSER}" # # Remove status file # 删除状态文件 -/opt/bin/rm -f "/var/run/v2ray_transparent_proxy_enable_file" +#/opt/bin/rm -f "/var/run/xray_transparent_proxy_enable" # ########## END ########## # # -########## DISABLE V2RAY AND V2RAY-FW ########## +########## DISABLE XRAY AND XRAY-FW ########## # # Stop all the relevant processes # 停止全部相关进程 -"${PRIVATE_BIN}/fw_v2ray_transparent_proxy_disable.service" > /dev/null 2>&1 +"${PRIVATE_BIN}/fw_xray_transparent_proxy_disable.service" > /dev/null 2>&1 /opt/bin/sleep 2 -"${PRIVATE_BIN}/v2ray_disable.service" > /dev/null 2>&1 +"${PRIVATE_BIN}/xray_proxy_disable.service" > /dev/null 2>&1 /opt/bin/sleep 2 # # Update /etc/hosts diff --git a/shadowsocks/bin/ss_transparent_proxy_without_dns_enable_file.service b/xray/bin/xray_transparent_proxy_enable_file.service similarity index 58% rename from shadowsocks/bin/ss_transparent_proxy_without_dns_enable_file.service rename to xray/bin/xray_transparent_proxy_enable_file.service index a4db6e9..10ffab8 100644 --- a/shadowsocks/bin/ss_transparent_proxy_without_dns_enable_file.service +++ b/xray/bin/xray_transparent_proxy_enable_file.service @@ -15,7 +15,7 @@ SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" # # PRIVATE_ROOT: The root directory for this program # 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/shadowsocks" +PRIVATE_ROOT="${SBL_SYS_USR}/xray" # # PRIVATE_BIN: The directory which contains all the executable files related to this program # 设置自定义变量PRIVATE_BIN为此程序可执行文件目录 @@ -25,25 +25,13 @@ PRIVATE_BIN="${PRIVATE_ROOT}/bin" # 设置自定义变量PRIVATE_ETC为此程序配置文件目录 PRIVATE_ETC="${PRIVATE_ROOT}/etc" # -# SS_REDIR_PID_FILE: The path to ss_redir.pid -# 设置自定义变量SS_REDIR_PID_FILE为文件ss_redir.pid的绝对路径 -SS_REDIR_PID_FILE="/var/run/ss_redir.pid" +# BOOTSTRAP_DNS_SERVER: DNS Server to resolve the domain of the XRAY-SERVER +# 设置自定义变量BOOTSTRAP_DNS_SERVER为解析XRAY-SERVER域名的DNS服务器 +BOOTSTRAP_DNS_SERVER="119.29.29.29" # -# SERVER_DOMAIN: Domain of the SS-SERVER -# 设置自定义变量SERVER_DOMAIN为SS-SERVER的域名 -SERVER_DOMAIN="$(/opt/bin/sed -E -n -e 's/^[[:space:]]*\"server\":[[:space:]]*\"(.*)\".*/\1/p' "${PRIVATE_ETC}/config_redir.json")" -# -# SERVER_IP: Domain of the SS-SERVER -# 设置自定义变量SERVER_IP为SS-SERVER的IP地址 -SERVER_IP="$(nslookup "${SERVER_DOMAIN}" | /opt/bin/sed -E -n -e '/Name/,+1s/.*:[[:space:]]+(([[:digit:]]+\.?){4})[[:space:]]+.*/\1/p')" -# -# BUILT_IN_CHAIN_NAME: Name of the built-in chain -# 设置自定义变量BUILT_IN_CHAIN_NAME为防火墙默认链名 -BUILT_IN_CHAIN_NAME="$(/opt/bin/sed -E -n -e 's/^BUILT_IN_CHAIN_NAME=\"(.*)\"/\1/p' "${PRIVATE_BIN}/fw_ss_transparent_proxy_enable.service")" -# -# USER_DEFINED_CHAIN_NAME: Name of the user-defined chain -# 设置自定义变量USER_DEFINED_CHAIN_NAME为防火墙自定义链名 -USER_DEFINED_CHAIN_NAME="$(/opt/bin/sed -E -n -e 's/^USER_DEFINED_CHAIN_NAME=\"(.*)\"/\1/p' "${PRIVATE_BIN}/fw_ss_transparent_proxy_enable.service")" +# XRAY_PROXY_PID_FILE: The path to xray_proxy.pid +# 设置自定义变量XRAY_PROXY_PID_FILE为文件xray_proxy.pid的绝对路径 +XRAY_PROXY_PID_FILE="/var/run/xray_proxy.pid" # # ADMINUSER: The administrator of the router # 设置环境变量ADMINUSER为路由器管理页面的登陆帐号 @@ -51,9 +39,10 @@ ADMINUSER="$(nvram get sbl_username)" # # TEST_FW: Test for firewall rules # 设置环境变量TEST_FW为防火墙规则测试值 -# 特殊说明:必须避免双引号多重嵌套 -CHECK_RULES="$(iptables -t nat -nvL "${BUILT_IN_CHAIN_NAME}" | /opt/bin/grep ''"${USER_DEFINED_CHAIN_NAME}"'_TCP')" -if [ -n "${CHECK_RULES}" ] +CHECK_RULE_1="$(iptables -t mangle -nvL PREROUTING | /opt/bin/grep 'XRAY_TPROXY')" +CHECK_RULE_2="$(iptables -t mangle -nvL OUTPUT | /opt/bin/grep 'XRAY_TPROXY_MASK')" +CHECK_RULE_3="$(iptables -t nat -nvL PREROUTING | /opt/bin/grep 'XRAY_REDIRECT')" +if [ -n "${CHECK_RULE_1}" ] && [ -n "${CHECK_RULE_2}" ] || [ -n "${CHECK_RULE_3}" ] then TEST_FW="true" else @@ -89,13 +78,13 @@ checkIfProcessAlive() ########## END ########## # # -########## ENABLE SS-REDIR AND SS-FW ########## +########## ENABLE XRAY AND XRAY-FW ########## # -# Check if ${PRIVATE_BIN}/ss_redir_enable.service and ${PRIVATE_BIN}/fw_ss_transparent_proxy_enable.service have been loaded -# 检查${PRIVATE_BIN}/ss_redir_enable.service和${PRIVATE_BIN}/fw_ss_transparent_proxy_enable.service是否被加载 -checkIfProcessAlive "${SS_REDIR_PID_FILE}" TEST_SS_REDIR +# Check if ${PRIVATE_BIN}/xray_proxy_enable.service and ${PRIVATE_BIN}/fw_xray_transparent_proxy_enable.service has been loaded +# 检查${PRIVATE_BIN}/xray_proxy_enable.service和${PRIVATE_BIN}/fw_xray_transparent_proxy_enable.service是否被加载 +checkIfProcessAlive "${XRAY_PROXY_PID_FILE}" TEST_XRAY # -if ${TEST_SS_REDIR} && ${TEST_FW} +if ${TEST_XRAY} && ${TEST_FW} then # Everything is OK # 满足全部条件 @@ -106,19 +95,27 @@ then else # Stop all the relevant processes # 如果有任意条件不符,则停止全部相关进程 - "${PRIVATE_BIN}/ss_transparent_proxy_without_dns_disable_file.service" > /dev/null 2>&1 + "${PRIVATE_BIN}/xray_transparent_proxy_disable_file.service" > /dev/null 2>&1 # /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: LOAD TRANSPARENT PROXY" # + # SERVER_DOMAIN: Domain of the XRAY-SERVER + # 设置自定义变量SERVER_DOMAIN为XRAY-SERVER的域名 + SERVER_DOMAIN="$(/opt/bin/sed -E -n -e '/outbounds/,/port/s/^[[:space:]]*\"address\":[[:space:]]*\"(.*)\".*/\1/p' "${PRIVATE_ETC}/config_proxy.json")" + # + # SERVER_IP: Domain of the XRAY-SERVER + # 设置自定义变量SERVER_IP为XRAY-SERVER的IP地址 + SERVER_IP="$(nslookup "${SERVER_DOMAIN}" "${BOOTSTRAP_DNS_SERVER}" | /opt/bin/sed -E -n -e '/Name/,$s/.*:[[:space:]]+([[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3})($|[[:space:]]+.*)/\1/p' | /opt/bin/head -n 1)" + # # Update /etc/hosts # 更新文件/etc/hosts /opt/bin/echo "${SERVER_IP} ${SERVER_DOMAIN}" >> "/etc/hosts" # # Start all the relevant processes # 启动全部相关进程 - "${PRIVATE_BIN}/ss_redir_enable.service" > /dev/null 2>&1 + "${PRIVATE_BIN}/xray_proxy_enable.service" > /dev/null 2>&1 /opt/bin/sleep 2 - "${PRIVATE_BIN}/fw_ss_transparent_proxy_enable.service" > /dev/null 2>&1 + "${PRIVATE_BIN}/fw_xray_transparent_proxy_enable.service" > /dev/null 2>&1 /opt/bin/sleep 2 # ########## END ########## @@ -128,12 +125,12 @@ else # # Enable crontab because something is wrong with the poll time of monit # 因为monit的执行周期BUG,故启用crontab进行进程周期执行 - /opt/bin/echo "*/5 * * * * \"${PRIVATE_BIN}/ss_transparent_proxy_without_dns_enable_file.service\"" >> "/var/spool/cron/crontabs/${ADMINUSER}" + /opt/bin/echo "*/5 * * * * \"${PRIVATE_BIN}/xray_transparent_proxy_enable_file.service\"" >> "/var/spool/cron/crontabs/${ADMINUSER}" /opt/bin/chmod 600 "/var/spool/cron/crontabs/${ADMINUSER}" # # Create status file # 创建状态文件 - /opt/bin/touch "/var/run/ss_transparent_proxy_without_dns_enable_file" + /opt/bin/touch "/var/run/xray_transparent_proxy_enable" # ########## END ########## # diff --git a/v2ray/bin/v2ray_transparent_proxy_enable_file.service b/xray/bin/xray_transparent_proxy_enable_prog.service similarity index 59% rename from v2ray/bin/v2ray_transparent_proxy_enable_file.service rename to xray/bin/xray_transparent_proxy_enable_prog.service index b245baf..c0ae97f 100644 --- a/v2ray/bin/v2ray_transparent_proxy_enable_file.service +++ b/xray/bin/xray_transparent_proxy_enable_prog.service @@ -15,7 +15,7 @@ SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" # # PRIVATE_ROOT: The root directory for this program # 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/v2ray" +PRIVATE_ROOT="${SBL_SYS_USR}/xray" # # PRIVATE_BIN: The directory which contains all the executable files related to this program # 设置自定义变量PRIVATE_BIN为此程序可执行文件目录 @@ -25,21 +25,13 @@ PRIVATE_BIN="${PRIVATE_ROOT}/bin" # 设置自定义变量PRIVATE_ETC为此程序配置文件目录 PRIVATE_ETC="${PRIVATE_ROOT}/etc" # -# V2RAY_PID_FILE: The path to v2ray.pid -# 设置自定义变量V2RAY_PID_FILE为文件v2ray.pid的绝对路径 -V2RAY_PID_FILE="/var/run/v2ray.pid" +# BOOTSTRAP_DNS_SERVER: DNS Server to resolve the domain of the XRAY-SERVER +# 设置自定义变量BOOTSTRAP_DNS_SERVER为解析XRAY-SERVER域名的DNS服务器 +BOOTSTRAP_DNS_SERVER="119.29.29.29" # -# SERVER_DOMAIN: Domain of the V2RAY-SERVER -# 设置自定义变量SERVER_DOMAIN为V2RAY-SERVER的域名 -SERVER_DOMAIN="$(/opt/bin/sed -E -n -e '/outbounds/,/port/s/^[[:space:]]*\"address\":[[:space:]]*\"(.*)\".*/\1/p' "${PRIVATE_ETC}/config_proxy.json")" -# -# SERVER_IP: Domain of the V2RAY-SERVER -# 设置自定义变量SERVER_IP为V2RAY-SERVER的IP地址 -SERVER_IP="$(nslookup "${SERVER_DOMAIN}" | /opt/bin/sed -E -n -e '/Name/,+1s/.*:[[:space:]]+(([[:digit:]]+\.?){4})[[:space:]]+.*/\1/p')" -# -# USER_DEFINED_CHAIN_NAME: Name of the user-defined chain -# 设置自定义变量USER_DEFINED_CHAIN_NAME为防火墙自定义链名 -USER_DEFINED_CHAIN_NAME="$(/opt/bin/sed -E -n -e 's/^USER_DEFINED_CHAIN_NAME=\"(.*)\"/\1/p' "${PRIVATE_BIN}/fw_v2ray_transparent_proxy_enable.service")" +# XRAY_PROXY_PID_FILE: The path to xray_proxy.pid +# 设置自定义变量XRAY_PROXY_PID_FILE为文件xray_proxy.pid的绝对路径 +XRAY_PROXY_PID_FILE="/var/run/xray_proxy.pid" # # ADMINUSER: The administrator of the router # 设置环境变量ADMINUSER为路由器管理页面的登陆帐号 @@ -47,9 +39,10 @@ ADMINUSER="$(nvram get sbl_username)" # # TEST_FW: Test for firewall rules # 设置环境变量TEST_FW为防火墙规则测试值 -# 特殊说明:必须避免双引号多重嵌套 -CHECK_RULES="$(iptables -t nat -nvL PREROUTING | /opt/bin/grep ''"${USER_DEFINED_CHAIN_NAME}"'_TCP')" -if [ -n "${CHECK_RULES}" ] +CHECK_RULE_1="$(iptables -t mangle -nvL PREROUTING | /opt/bin/grep 'XRAY_TPROXY')" +CHECK_RULE_2="$(iptables -t mangle -nvL OUTPUT | /opt/bin/grep 'XRAY_TPROXY_MASK')" +CHECK_RULE_3="$(iptables -t nat -nvL PREROUTING | /opt/bin/grep 'XRAY_REDIRECT')" +if [ -n "${CHECK_RULE_1}" ] && [ -n "${CHECK_RULE_2}" ] || [ -n "${CHECK_RULE_3}" ] then TEST_FW="true" else @@ -85,13 +78,13 @@ checkIfProcessAlive() ########## END ########## # # -########## ENABLE V2RAY AND V2RAY-FW ########## +########## ENABLE XRAY AND XRAY-FW ########## # -# Check if ${PRIVATE_BIN}/v2ray_enable.service and ${PRIVATE_BIN}/fw_v2ray_transparent_proxy_enable.service has been loaded -# 检查${PRIVATE_BIN}/v2ray_enable.service和${PRIVATE_BIN}/fw_v2ray_transparent_proxy_enable.service是否被加载 -checkIfProcessAlive "${V2RAY_PID_FILE}" TEST_V2RAY +# Check if ${PRIVATE_BIN}/xray_proxy_enable.service and ${PRIVATE_BIN}/fw_xray_transparent_proxy_enable.service has been loaded +# 检查${PRIVATE_BIN}/xray_proxy_enable.service和${PRIVATE_BIN}/fw_xray_transparent_proxy_enable.service是否被加载 +checkIfProcessAlive "${XRAY_PROXY_PID_FILE}" TEST_XRAY # -if ${TEST_V2RAY} && ${TEST_FW} +if ${TEST_XRAY} && ${TEST_FW} then # Everything is OK # 满足全部条件 @@ -102,19 +95,27 @@ then else # Stop all the relevant processes # 如果有任意条件不符,则停止全部相关进程 - "${PRIVATE_BIN}/v2ray_transparent_proxy_disable_file.service" > /dev/null 2>&1 + "${PRIVATE_BIN}/xray_transparent_proxy_disable_prog.service" > /dev/null 2>&1 # /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: LOAD TRANSPARENT PROXY" # + # SERVER_DOMAIN: Domain of the XRAY-SERVER + # 设置自定义变量SERVER_DOMAIN为XRAY-SERVER的域名 + SERVER_DOMAIN="$(/opt/bin/sed -E -n -e '/outbounds/,/port/s/^[[:space:]]*\"address\":[[:space:]]*\"(.*)\".*/\1/p' "${PRIVATE_ETC}/config_proxy.json")" + # + # SERVER_IP: Domain of the XRAY-SERVER + # 设置自定义变量SERVER_IP为XRAY-SERVER的IP地址 + SERVER_IP="$(nslookup "${SERVER_DOMAIN}" "${BOOTSTRAP_DNS_SERVER}" | /opt/bin/sed -E -n -e '/Name/,$s/.*:[[:space:]]+([[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3})($|[[:space:]]+.*)/\1/p' | /opt/bin/head -n 1)" + # # Update /etc/hosts # 更新文件/etc/hosts /opt/bin/echo "${SERVER_IP} ${SERVER_DOMAIN}" >> "/etc/hosts" # # Start all the relevant processes # 启动全部相关进程 - "${PRIVATE_BIN}/v2ray_enable.service" > /dev/null 2>&1 + "${PRIVATE_BIN}/xray_proxy_enable.service" > /dev/null 2>&1 /opt/bin/sleep 2 - "${PRIVATE_BIN}/fw_v2ray_transparent_proxy_enable.service" > /dev/null 2>&1 + "${PRIVATE_BIN}/fw_xray_transparent_proxy_enable.service" > /dev/null 2>&1 /opt/bin/sleep 2 # ########## END ########## @@ -124,12 +125,12 @@ else # # Enable crontab because something is wrong with the poll time of monit # 因为monit的执行周期BUG,故启用crontab进行进程周期执行 - /opt/bin/echo "*/5 * * * * \"${PRIVATE_BIN}/v2ray_transparent_proxy_enable_file.service\"" >> "/var/spool/cron/crontabs/${ADMINUSER}" - /opt/bin/chmod 600 "/var/spool/cron/crontabs/${ADMINUSER}" + #/opt/bin/echo "*/5 * * * * \"${PRIVATE_BIN}/xray_transparent_proxy_enable_file.service\"" >> "/var/spool/cron/crontabs/${ADMINUSER}" + #/opt/bin/chmod 600 "/var/spool/cron/crontabs/${ADMINUSER}" # # Create status file # 创建状态文件 - /opt/bin/touch "/var/run/v2ray_transparent_proxy_enable_file" + #/opt/bin/touch "/var/run/xray_transparent_proxy_enable" # ########## END ########## # diff --git a/v2ray/bin/v2ray_update b/xray/bin/xray_update similarity index 73% rename from v2ray/bin/v2ray_update rename to xray/bin/xray_update index 9eea01a..97d4758 100644 --- a/v2ray/bin/v2ray_update +++ b/xray/bin/xray_update @@ -14,7 +14,7 @@ ROUTER_MODEL="$(nvram get model)" # # NAME OF THE SERVICE # 服务名称 -SERVICE_NAME="V2RAY" +SERVICE_NAME="XRAY" # # FUNCTION OF THE SERVICE # 服务功能 @@ -30,7 +30,7 @@ SBL_SYS_USR="${USB_MOUNT_POINT}/script_bootloader/usr" # # PRIVATE_ROOT: The root directory for this program # 设置自定义变量PRIVATE_ROOT为此程序根目录 -PRIVATE_ROOT="${SBL_SYS_USR}/v2ray" +PRIVATE_ROOT="${SBL_SYS_USR}/xray" # # PRIVATE_ALTERNATIVE: The directory which contains all the alternatives # 设置自定义变量PRIVATE_ALTERNATIVE为此程序备用文件目录 @@ -44,13 +44,13 @@ PRIVATE_BIN="${PRIVATE_ROOT}/bin" # 设置自定义变量PRIVATE_USR为此程序外部软件资源目录 PRIVATE_USR="${PRIVATE_ROOT}/usr" # -# LATEST_VERSION: Version of the latest v2ray-core -# 设置自定义变量LATEST_VERSION为最新版v2ray-core的版本号 -LATEST_VERSION="$(/opt/bin/curl -s "https://api.github.com/repos/v2fly/v2ray-core/releases/latest" | /opt/bin/sed -E -n -e 's/^[[:space:]]*\"tag_name\":[[:space:]]*\"(.*)\".*/\1/p')" +# LATEST_VERSION: Version of the latest xray-core +# 设置自定义变量LATEST_VERSION为最新版xray-core的版本号 +LATEST_VERSION="$(/opt/bin/curl -s "https://api.github.com/repos/XTLS/Xray-core/releases/latest" | /opt/bin/sed -E -n -e 's/^[[:space:]]*\"tag_name\":[[:space:]]*\"(.*)\".*/\1/p')" # -# CURRENT_VERSION: Version of the current v2ray-core -# 设置自定义变量CURRENT_VERSION为当前v2ray-core的版本号 -CURRENT_VERSION="$("${PRIVATE_USR}/v2ray" -version | /opt/bin/sed -E -n -e 's/.*[[:space:]]+([[:digit:]\.]*)[[:space:]]+.*/v\1/p')" +# CURRENT_VERSION: Version of the current xray-core +# 设置自定义变量CURRENT_VERSION为当前xray-core的版本号 +CURRENT_VERSION="$("${PRIVATE_USR}/xray" -version | /opt/bin/sed -E -n -e 's/.*[[:space:]]+([[:digit:]\.]*)[[:space:]]+.*/v\1/p')" # # OPERATING_SYSTEM: Operating system of the ASUS Router # 设置自定义变量OPERATING_SYSTEM为华硕路由器系统 @@ -78,9 +78,9 @@ case "$(/opt/bin/uname -m)" in ;; esac # -# DOWNLOAD_LINK: Download link of the latest v2ray-core -# 设置自定义变量DOWNLOAD_LINK为最新版v2ray-core的下载链接 -DOWNLOAD_LINK="https://github.com/v2fly/v2ray-core/releases/download/${LATEST_VERSION}/v2ray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" +# DOWNLOAD_LINK: Download link of the latest xray-core +# 设置自定义变量DOWNLOAD_LINK为最新版xray-core的下载链接 +DOWNLOAD_LINK="https://github.com/XTLS/Xray-core/releases/download/${LATEST_VERSION}/Xray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" # ########## END ########## # @@ -92,7 +92,7 @@ DOWNLOAD_LINK="https://github.com/v2fly/v2ray-core/releases/download/${LATEST_VE ########## END ########## # # -########## UPGRADE V2RAY ########## +########## UPGRADE XRAY ########## # if [ "${CURRENT_VERSION}" == "${LATEST_VERSION}" ] then @@ -115,22 +115,22 @@ else then /opt/bin/echo -e "($(basename $0)): $$ \033[1;44;37mINFO\033[0m: MONIT MANAGEMENT SYSTEM HAS BEEN DEPLOYED" # - # Remove vestigial v2ray-core package - # 删除遗留的v2ray-core包 - /opt/bin/rm -f "${PRIVATE_BIN}/v2ray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" + # Remove vestigial xray-core package + # 删除遗留的xray-core包 + /opt/bin/rm -f "${PRIVATE_BIN}/Xray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" # - # Download v2ray-core - # 下载v2ray-core + # Download xray-core + # 下载xray-core /opt/bin/wget-ssl -c -t 10 -T 120 --no-cookies --no-check-certificate -P "${PRIVATE_BIN}" "${DOWNLOAD_LINK}" # - # Check if ${PRIVATE_BIN}/v2ray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip exists - # 检查文件${PRIVATE_BIN}/v2ray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip是否存在 - if [ ! -s "${PRIVATE_BIN}/v2ray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" ] + # Check if ${PRIVATE_BIN}/Xray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip exists + # 检查文件${PRIVATE_BIN}/Xray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip是否存在 + if [ ! -s "${PRIVATE_BIN}/Xray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" ] then /opt/bin/echo -e "($(basename $0)): $$ \033[1;43;31mNOTICE\033[0m: CONNECTION FAILED" /opt/bin/echo -e "($(basename $0)): $$ \033[1;41;37mFAILURE\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" # - /opt/bin/rm -f "${PRIVATE_BIN}/v2ray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" + /opt/bin/rm -f "${PRIVATE_BIN}/Xray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" # exit 5 fi @@ -143,20 +143,19 @@ else # 备份旧版本 /opt/bin/mv -f "${PRIVATE_USR}" "${PRIVATE_ROOT}/usr_prev" # - # Create directory v2ray - # 创建v2ray目录 + # Create directory xray + # 创建xray目录 /opt/bin/mkdir "${PRIVATE_USR}" # - # Unzip v2ray-core package - # 解压v2ray-core包 - /opt/bin/unzip "${PRIVATE_BIN}/v2ray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" -d "${PRIVATE_USR}" + # Unzip xray-core package + # 解压xray-core包 + /opt/bin/unzip "${PRIVATE_BIN}/Xray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" -d "${PRIVATE_USR}" # # Change the mode of the files # 更改文件权限 - /opt/bin/chmod 644 "${PRIVATE_USR}"/vpoint* - /opt/bin/chmod 555 "${PRIVATE_USR}"/v2* + /opt/bin/chmod 555 "${PRIVATE_USR}"/xray /opt/bin/chmod 644 "${PRIVATE_USR}/geosite.dat" - /opt/bin/chmod 755 "${PRIVATE_USR}/geoip.dat" + /opt/bin/chmod 644 "${PRIVATE_USR}/geoip.dat" # # Check if ${PRIVATE_ALTERNATIVE}/version exists # 检查文件${PRIVATE_ALTERNATIVE}/version是否存在 @@ -166,16 +165,16 @@ else # 删除过时的文件 /opt/bin/rm -f "${PRIVATE_ALTERNATIVE}"/* # - # Move v2ray-core package - # 移动v2ray-core包 - /opt/bin/mv -f "${PRIVATE_BIN}/v2ray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" "${PRIVATE_ALTERNATIVE}" + # Move xray-core package + # 移动xray-core包 + /opt/bin/mv -f "${PRIVATE_BIN}/Xray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" "${PRIVATE_ALTERNATIVE}" # /opt/bin/echo "${LATEST_VERSION}" > "${PRIVATE_ALTERNATIVE}/version" # else - # Remove v2ray-core package - # 删除v2ray-core包 - /opt/bin/rm -f "${PRIVATE_BIN}/v2ray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" + # Remove xray-core package + # 删除xray-core包 + /opt/bin/rm -f "${PRIVATE_BIN}/Xray-${OPERATING_SYSTEM}-${ROUTER_ARCHITECTURE}.zip" fi # /opt/bin/echo -e "($(basename $0)): $$ \033[1;42;37mSUCCESS\033[0m: ${SERVICE_FUNCTION} ${SERVICE_NAME}" diff --git a/xray/etc/config_proxy.json.template b/xray/etc/config_proxy.json.template new file mode 100644 index 0000000..bd53334 --- /dev/null +++ b/xray/etc/config_proxy.json.template @@ -0,0 +1,323 @@ +{ + "inbounds": + [ + { + "listen": "0.0.0.0", + "port": 1080, + "protocol": "socks", + "settings": + { + "auth": "noauth", + "udp": true, + "ip": "127.0.0.1", + "userLevel": 0 + }, + "tag": "inbound_socks_LAN_to_VPS" + }, + { + "listen": "0.0.0.0", + "port": 9080, + "protocol": "http", + "settings": + { + "timeout": 300, + "allowTransparent": false, + "userLevel": 0 + }, + "tag": "inbound_http_LAN_to_VPS" + }, + { + "listen": "0.0.0.0", + "port": 2053, + "protocol": "dokodemo-door", + "settings": + { + "address": "", + "port": 53, + "network": "tcp,udp", + "timeout": 300, + "followRedirect": false, + "userLevel": 0 + }, + "tag": "inbound_dokodemo_LAN(DNS)_to_VPS" + }, + { + "listen": "0.0.0.0", + "port": 45154, + "protocol": "dokodemo-door", + "settings": + { + "network": "tcp,udp", + "timeout": 30, + "followRedirect": true, + "userLevel": 0 + }, + "streamSettings": + { + "sockopt": + { + "tproxy": "redirect" + } + }, + "tag": "inbound_dokodemo_LAN(Redirect)_to_VPS" + }, + { + "listen": "0.0.0.0", + "port": 55155, + "protocol": "dokodemo-door", + "settings": + { + "network": "tcp,udp", + "timeout": 30, + "followRedirect": true, + "userLevel": 0 + }, + "streamSettings": + { + "sockopt": + { + "tproxy": "tproxy" + } + }, + "tag": "inbound_dokodemo_LAN(TProxy)_to_VPS" + }, + { + "listen": "0.0.0.0", + "port": 22815, + "protocol": "vmess", + "settings": + { + "clients": + [ + { + "id": "", + "level": 0 + } + ] + }, + "streamSettings": + { + "network": "tcp", + "security": "none", + "tcpSettings": + { + "header": + { + "type": "http", + "response": + { + "version": "1.1", + "status": "200", + "reason": "OK", + "headers": + { + "Content-Type": + [ + "application/octet-stream", + "video/mpeg" + ], + "Transfer-Encoding": + [ + "chunked" + ], + "Connection": + [ + "keep-alive" + ], + "Pragma": "no-cache" + } + } + } + } + }, + "tag": "inbound_vmess_WAN_to_LAN" + }, + { + "listen": "0.0.0.0", + "port": 22816, + "protocol": "vmess", + "settings": + { + "clients": + [ + { + "id": "", + "level": 0 + } + ] + }, + "streamSettings": + { + "network": "tcp", + "security": "none", + "tcpSettings": + { + "header": + { + "type": "http", + "response": + { + "version": "1.1", + "status": "200", + "reason": "OK", + "headers": + { + "Content-Type": + [ + "application/octet-stream", + "video/mpeg" + ], + "Transfer-Encoding": + [ + "chunked" + ], + "Connection": + [ + "keep-alive" + ], + "Pragma": "no-cache" + } + } + } + } + }, + "tag": "inbound_vmess_WAN_to_VPS" + } + ], + "outbounds": + [ + { + "sendThrough": "0.0.0.0", + "protocol": "vless", + "settings": + { + "vnext": + [ + { + "address": "", + "port": 443, + "users": + [ + { + "id": "", + "encryption": "none", + "flow": "xtls-rprx-vision", + "level": 0 + } + ] + } + ] + }, + "tag": "outbound_vless_VPS", + "streamSettings": + { + "network": "tcp", + "security": "reality", + "realitySettings": + { + "serverName": "www.magnite.com", + "fingerprint": "random", + "shortID": "", + "publicKey": "", + "spiderX": "" + } + } + }, + { + "sendThrough": "0.0.0.0", + "protocol": "freedom", + "settings": + { + "domainStrategy": "AsIs", + "userLevel": 0 + }, + "tag": "outbound_freedom_LAN" + } + ], + "routing": + { + "domainStrategy": "AsIs", + "domainMatcher": "hybrid", + "rules": + [ + { + "type": "field", + "inboundTag": + [ + "inbound_socks_LAN_to_VPS" + ], + "outboundTag": "outbound_vless_VPS" + }, + { + "type": "field", + "inboundTag": + [ + "inbound_http_LAN_to_VPS" + ], + "outboundTag": "outbound_vless_VPS" + }, + { + "type": "field", + "inboundTag": + [ + "inbound_dokodemo_LAN(DNS)_to_VPS" + ], + "outboundTag": "outbound_vless_VPS" + }, + { + "type": "field", + "inboundTag": + [ + "inbound_dokodemo_LAN(Redirect)_to_VPS" + ], + "outboundTag": "outbound_vless_VPS" + }, + { + "type": "field", + "inboundTag": + [ + "inbound_dokodemo_LAN(TProxy)_to_VPS" + ], + "outboundTag": "outbound_vless_VPS" + }, + { + "type": "field", + "inboundTag": + [ + "inbound_vmess_WAN_to_LAN" + ], + "outboundTag": "outbound_freedom_LAN" + }, + { + "type": "field", + "inboundTag": + [ + "inbound_vmess_WAN_to_VPS" + ], + "outboundTag": "outbound_vless_VPS" + } + ] + }, + "policy": + { + "levels": + { + "0": + { + "handshake": 4, + "connIdle": 300, + "uplinkOnly": 2, + "downlinkOnly": 5, + "statsUserUplink": false, + "statsUserDownlink": false + } + }, + "system": + { + "statsInboundUplink": false, + "statsInboundDownlink": false, + "statsOutboundUplink": false, + "statsOutboundDownlink": false + } + } +} \ No newline at end of file diff --git a/xray/etc/fw.d/xray_proxy_open b/xray/etc/fw.d/xray_proxy_open new file mode 100644 index 0000000..f91d6be --- /dev/null +++ b/xray/etc/fw.d/xray_proxy_open @@ -0,0 +1,3 @@ +NAME="XRAY_PROXY" +RULE="OPEN#TCP#22815" +RULE="OPEN#TCP#22816" \ No newline at end of file diff --git a/xray/etc/monit.d/fw_filter_INPUT_xray_proxy b/xray/etc/monit.d/fw_filter_INPUT_xray_proxy new file mode 100644 index 0000000..1adb58f --- /dev/null +++ b/xray/etc/monit.d/fw_filter_INPUT_xray_proxy @@ -0,0 +1,4 @@ +check program FW_PORT_OPENING_XRAY_PROXY with path "/opt/bin/fwd enable /opt/etc/fw.d/xray_proxy_open" every 6 cycles + start program = "/opt/bin/fwd enable /opt/etc/fw.d/xray_proxy_open" + stop program = "/opt/bin/fwd disable /opt/etc/fw.d/xray_proxy_open" + if status == 1 then alert \ No newline at end of file diff --git a/xray/etc/monit.d/xray_proxy b/xray/etc/monit.d/xray_proxy new file mode 100644 index 0000000..3690d51 --- /dev/null +++ b/xray/etc/monit.d/xray_proxy @@ -0,0 +1,4 @@ +check process XRAY_PROXY with pidfile '/var/run/xray_proxy.pid' + start program = "/opt/script_bootloader/usr/xray/bin/xray_proxy_enable.service" + stop program = "/opt/script_bootloader/usr/xray/bin/xray_proxy_disable.service" + if does not exist then restart \ No newline at end of file diff --git a/xray/etc/monit.d/xray_transparent_proxy_file b/xray/etc/monit.d/xray_transparent_proxy_file new file mode 100644 index 0000000..a6e968f --- /dev/null +++ b/xray/etc/monit.d/xray_transparent_proxy_file @@ -0,0 +1,4 @@ +check file XRAY_TRANSPARENT_PROXY path "/var/run/xray_transparent_proxy_enable" every 6 cycles + start program = "/opt/script_bootloader/usr/xray/bin/xray_transparent_proxy_enable_file.service" with timeout 120 seconds + stop program = "/opt/script_bootloader/usr/xray/bin/xray_transparent_proxy_disable_file.service" with timeout 120 seconds + if does not exist then alert \ No newline at end of file diff --git a/xray/etc/monit.d/xray_transparent_proxy_prog b/xray/etc/monit.d/xray_transparent_proxy_prog new file mode 100644 index 0000000..4619021 --- /dev/null +++ b/xray/etc/monit.d/xray_transparent_proxy_prog @@ -0,0 +1,4 @@ +check program XRAY_TRANSPARENT_PROXY with path "/opt/script_bootloader/usr/xray/bin/xray_transparent_proxy_enable_prog.service" every 6 cycles + start program = "/opt/script_bootloader/usr/xray/bin/xray_transparent_proxy_enable_prog.service" with timeout 120 seconds + stop program = "/opt/script_bootloader/usr/xray/bin/xray_transparent_proxy_disable_prog.service" with timeout 120 seconds + if status == 1 then alert \ No newline at end of file