├── assets └── img │ ├── shark.png │ ├── global.png │ └── shark.svg ├── luci-app-fchomo ├── docs │ ├── audio │ │ └── A!.mp3 │ ├── img │ │ └── shark-taiko.gif │ ├── Ruleset-URI-Scheme.md │ ├── css │ │ └── ClearnessDark.css │ └── example │ │ ├── gfwlist.config │ │ └── bypasscn.config ├── root │ ├── usr │ │ ├── libexec │ │ │ └── fchomo │ │ │ │ ├── clean_log.sh │ │ │ │ ├── natcheck.sh │ │ │ │ └── update_resources.sh │ │ └── share │ │ │ ├── rpcd │ │ │ ├── acl.d │ │ │ │ └── luci-app-fchomo.json │ │ │ └── ucode │ │ │ │ └── luci.fchomo │ │ │ ├── fchomo │ │ │ ├── firewall_pre.ut │ │ │ ├── generate_server.uc │ │ │ └── firewall_post.ut │ │ │ ├── luci │ │ │ └── menu.d │ │ │ │ └── luci-app-fchomo.json │ │ │ └── ucode │ │ │ └── fchomo.uc │ └── etc │ │ ├── capabilities │ │ └── fchomo.json │ │ ├── uci-defaults │ │ ├── 99_luci-app-fchomo-migration_node │ │ ├── 99_luci-app-fchomo-migration │ │ ├── 99_luci-app-fchomo-migration_rule │ │ └── 99_luci-app-fchomo │ │ ├── config │ │ └── fchomo │ │ └── init.d │ │ └── fchomo ├── htdocs │ └── luci-static │ │ └── resources │ │ └── view │ │ └── fchomo │ │ ├── hosts.js │ │ ├── node.css │ │ ├── log.js │ │ └── ruleset.js ├── Makefile └── .prepare.sh ├── mihomo ├── .prepare.sh └── Makefile ├── .github ├── dependabot.yml └── workflows │ ├── check.yml │ └── update_initialpack.yml ├── README.md └── LICENSE /assets/img/shark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fcshark-org/openwrt-fchomo/HEAD/assets/img/shark.png -------------------------------------------------------------------------------- /assets/img/global.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fcshark-org/openwrt-fchomo/HEAD/assets/img/global.png -------------------------------------------------------------------------------- /luci-app-fchomo/docs/audio/A!.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fcshark-org/openwrt-fchomo/HEAD/luci-app-fchomo/docs/audio/A!.mp3 -------------------------------------------------------------------------------- /luci-app-fchomo/docs/img/shark-taiko.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fcshark-org/openwrt-fchomo/HEAD/luci-app-fchomo/docs/img/shark-taiko.gif -------------------------------------------------------------------------------- /mihomo/.prepare.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | VERSION="$1" 3 | CURDIR="$2" 4 | BIN_PATH="$3" 5 | 6 | if [ -d "$CURDIR/.git" ]; then 7 | config="$CURDIR/.git/config" 8 | else 9 | config="$(sed "s|^gitdir:\s*|$CURDIR/|;s|$|/config|" "$CURDIR/.git")" 10 | fi 11 | [ -n "$(sed -En '/^\[remote /{h;:top;n;/^\[/b;s,(https?://gitcode\.(com|net)),\1,;T top;H;x;s|\n\s*|: |;p;}' "$config")" ] && { 12 | echo -e "#!/bin/sh\necho $VERSION" > "$BIN_PATH" 13 | } 14 | exit 0 15 | -------------------------------------------------------------------------------- /luci-app-fchomo/root/usr/libexec/fchomo/clean_log.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Thanks to homeproxy 3 | 4 | NAME="fchomo" 5 | 6 | log_max_size="30" #KB 7 | main_log_file="/var/run/$NAME/$NAME.log" 8 | singc_log_file="/var/run/$NAME/mihomo-c.log" 9 | sings_log_file="/var/run/$NAME/mihomo-s.log" 10 | 11 | while true; do 12 | sleep 180 13 | for i in "$main_log_file" "$singc_log_file" "$sings_log_file"; do 14 | [ -s "$i" ] || continue 15 | [ "$(( $(ls -l "$i" | awk -F ' ' '{print $5}') / 1024 >= log_max_size))" -eq "0" ] || echo "" > "$i" 16 | done 17 | done 18 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "github-actions" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "weekly" 12 | -------------------------------------------------------------------------------- /luci-app-fchomo/root/usr/share/rpcd/acl.d/luci-app-fchomo.json: -------------------------------------------------------------------------------- 1 | { 2 | "luci-app-fchomo": { 3 | "description": "Grant access to fchomo configuration", 4 | "read": { 5 | "file": { 6 | "/etc/init.d/fchomo reload *": [ "exec" ], 7 | "/usr/libexec/fchomo/natcheck.sh": [ "exec" ], 8 | "/var/run/fchomo/fchomo.log": [ "read" ], 9 | "/var/run/fchomo/mihomo-c.log": [ "read" ], 10 | "/var/run/fchomo/mihomo-s.log": [ "read" ] 11 | }, 12 | "ubus": { 13 | "service": [ "list" ], 14 | "luci.fchomo": [ "*" ] 15 | }, 16 | "uci": [ "fchomo" ] 17 | }, 18 | "write": { 19 | "file": { 20 | "/tmp/fchomo_certificate.tmp": [ "write" ], 21 | "/tmp/fchomo_initialpack.tmp": [ "write" ] 22 | }, 23 | "uci": [ "fchomo" ] 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /.github/workflows/check.yml: -------------------------------------------------------------------------------- 1 | name: mihomo version check 2 | on: 3 | workflow_dispatch: 4 | schedule: 5 | - cron: 0 16 * * 5 6 | push: 7 | branches: 8 | - master 9 | 10 | jobs: 11 | check: 12 | name: Check new mihomo version 13 | runs-on: ubuntu-latest 14 | permissions: 15 | contents: write # To push a branch 16 | pull-requests: write # To create a PR from that branch 17 | steps: 18 | - uses: actions/checkout@v6 19 | with: 20 | fetch-depth: 0 21 | 22 | - uses: EkkoG/openwrt-packages-version-checker@main 23 | env: 24 | COMMIT_TOKEN: ${{ secrets.GITHUB_TOKEN }} 25 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 26 | REPO: metacubex/mihomo 27 | BRANCH: master 28 | MAKEFILE: mihomo/Makefile 29 | CREATE_PR: true 30 | SOURCE_URL: https://github.com/metacubex/mihomo/archive/refs/tags/v{{version}}.tar.gz 31 | -------------------------------------------------------------------------------- /luci-app-fchomo/root/usr/share/fchomo/firewall_pre.ut: -------------------------------------------------------------------------------- 1 | #!/usr/bin/utpl -S 2 | 3 | {%- 4 | import { cursor } from 'uci'; 5 | const uci = cursor(); 6 | 7 | const cfgname = 'fchomo'; 8 | uci.load(cfgname); 9 | 10 | const proxy_mode = uci.get(cfgname, 'inbound', 'proxy_mode') || 'redir_tproxy'; 11 | let client_enabled, tun_name; 12 | if (match(proxy_mode, /tun/)) { 13 | client_enabled = uci.get(cfgname, 'routing', 'client_enabled') || '0'; 14 | 15 | if (client_enabled === '1') 16 | tun_name = uci.get(cfgname, 'config', 'tun_name') || 'hmtun0'; 17 | } 18 | -%} 19 | 20 | {% if (tun_name): %} 21 | chain forward { 22 | iifname {{ tun_name }} counter accept comment "!{{ cfgname }}: accept tun forward" 23 | oifname {{ tun_name }} counter accept comment "!{{ cfgname }}: accept tun forward" 24 | } 25 | 26 | chain input { 27 | iifname {{ tun_name }} counter accept comment "!{{ cfgname }}: accept tun input" 28 | oifname {{ tun_name }} counter accept comment "!{{ cfgname }}: accept tun input" 29 | } 30 | {% endif %} 31 | -------------------------------------------------------------------------------- /luci-app-fchomo/root/etc/capabilities/fchomo.json: -------------------------------------------------------------------------------- 1 | { 2 | "bounding": [ 3 | "CAP_NET_ADMIN", 4 | "CAP_NET_RAW", 5 | "CAP_NET_BIND_SERVICE", 6 | "CAP_SYS_TIME", 7 | "CAP_SYS_PTRACE", 8 | "CAP_DAC_READ_SEARCH", 9 | "CAP_DAC_OVERRIDE" 10 | ], 11 | "effective": [ 12 | "CAP_NET_ADMIN", 13 | "CAP_NET_RAW", 14 | "CAP_NET_BIND_SERVICE", 15 | "CAP_SYS_TIME", 16 | "CAP_SYS_PTRACE", 17 | "CAP_DAC_READ_SEARCH", 18 | "CAP_DAC_OVERRIDE" 19 | ], 20 | "ambient": [ 21 | "CAP_NET_ADMIN", 22 | "CAP_NET_RAW", 23 | "CAP_NET_BIND_SERVICE", 24 | "CAP_SYS_TIME", 25 | "CAP_SYS_PTRACE", 26 | "CAP_DAC_READ_SEARCH", 27 | "CAP_DAC_OVERRIDE" 28 | ], 29 | "permitted": [ 30 | "CAP_NET_ADMIN", 31 | "CAP_NET_RAW", 32 | "CAP_NET_BIND_SERVICE", 33 | "CAP_SYS_TIME", 34 | "CAP_SYS_PTRACE", 35 | "CAP_DAC_READ_SEARCH", 36 | "CAP_DAC_OVERRIDE" 37 | ], 38 | "inheritable": [ 39 | "CAP_NET_ADMIN", 40 | "CAP_NET_RAW", 41 | "CAP_NET_BIND_SERVICE", 42 | "CAP_SYS_TIME", 43 | "CAP_SYS_PTRACE", 44 | "CAP_DAC_READ_SEARCH", 45 | "CAP_DAC_OVERRIDE" 46 | ] 47 | } 48 | -------------------------------------------------------------------------------- /luci-app-fchomo/root/etc/uci-defaults/99_luci-app-fchomo-migration_node: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Migration script for fchomo node 3 | # Used to migrate LuCI application nodes option. 4 | 5 | . /lib/functions.sh 6 | . /usr/share/libubox/jshn.sh 7 | 8 | CONF=fchomo 9 | 10 | config_load "$CONF" 11 | 12 | # isDefined