├── template ├── quantumultx_subscribe.tpl ├── README.md ├── snippet │ ├── youtube_rules.tpl │ ├── blocked_rules.tpl │ └── direct_rules.tpl ├── quantumultx_rules.tpl ├── quantumultx.tpl ├── clash.tpl └── surge_v3.tpl ├── .idea ├── misc.xml ├── vcs.xml ├── inspectionProfiles │ ├── profiles_settings.xml │ └── Project_Default.xml ├── modules.xml ├── surgio.iml └── workspace.xml ├── provider ├── v2ray_subscribe_demo.js ├── README.md ├── subscribe_demo.js └── demo.js ├── ecosystem.config.js ├── docker-compose.yml ├── gateway.js ├── Dockerfile ├── README.md ├── LICENSE ├── .github └── workflows │ ├── surgio-3.0.2.yml │ ├── surgio-3.2.3.yml │ └── surgio-latest.yml ├── entrypoint.sh ├── start.sh └── surgio.conf.js /template/quantumultx_subscribe.tpl: -------------------------------------------------------------------------------- 1 | {{ getQuantumultXNodes(nodeList, customParams.magicVariable) }} 2 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /provider/v2ray_subscribe_demo.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | url: 'https://raw.githubusercontent.com/geekdada/surgio/master/test/asset/test-v2rayn-sub.txt', 5 | type: 'v2rayn_subscribe', 6 | }; 7 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /ecosystem.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | apps: [ 3 | { 4 | name: "app", 5 | cwd: "./", 6 | script: 'gateway.js', 7 | args: "", 8 | watch: true, 9 | watch_delay: 1000 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /template/README.md: -------------------------------------------------------------------------------- 1 | # 模板 2 | 3 | ## 自定义模板 4 | 5 | - [文档](https://surgio.js.org/guide/custom-template.html) 6 | 7 | ## 更新 8 | 9 | 你可以在 [这里](https://github.com/geekdada/create-surgio-store/tree/master/template/template) 查看该目录的更新版本。 10 | -------------------------------------------------------------------------------- /provider/README.md: -------------------------------------------------------------------------------- 1 | # Provider 2 | 3 | ## 自定义 Provider 4 | 5 | - [文档](https://surgio.js.org/guide/custom-provider.html) 6 | 7 | ## 更新 8 | 9 | 你可以在 [这里](https://github.com/geekdada/create-surgio-store/tree/master/template/provider) 查看该目录的更新版本。 10 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "2.0" 2 | services: 3 | surgio: 4 | image: chiupam/surgio:latest 5 | container_name: surgio 6 | restart: unless-stopped 7 | hostname: surgio 8 | volumes: 9 | - $PWD/surgio:/surgio 10 | ports: 11 | - 3000:3000 12 | -------------------------------------------------------------------------------- /gateway.js: -------------------------------------------------------------------------------- 1 | const gateway = require('@surgio/gateway') 2 | const PORT = process.env.PORT || 3000 3 | 4 | ;(async () => { 5 | const app = await gateway.bootstrapServer() 6 | await app.listen(PORT, '0.0.0.0') 7 | console.log('> Your app is ready at http://0.0.0.0:' + PORT) 8 | })() 9 | -------------------------------------------------------------------------------- /provider/subscribe_demo.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | url: 'https://gist.githubusercontent.com/geekdada/34353d6ae23abd48f6e200b00747a87e/raw', 5 | type: 'clash', 6 | // 定义所有的节点都支持 udpRelay 7 | udpRelay: true, 8 | // 添加国旗 emoji 9 | addFlag: true, 10 | }; 11 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/surgio.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /template/snippet/youtube_rules.tpl: -------------------------------------------------------------------------------- 1 | # YouTube 2 | DOMAIN,youtubei.googleapis.com 3 | DOMAIN-SUFFIX,youtube.com 4 | DOMAIN-SUFFIX,googlevideo.com 5 | DOMAIN-SUFFIX,youtube-nocookie.com 6 | DOMAIN-SUFFIX,youtu.be 7 | USER-AGENT,*YouTube* 8 | USER-AGENT,com.google.ios.youtube* 9 | 10 | # Youtube Music 11 | USER-AGENT,YouTubeMusic* 12 | USER-AGENT,com.google.ios.youtubemusic* 13 | DOMAIN-SUFFIX,music.youtube.com 14 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:latest 2 | 3 | ENV PATH=/usr/local/bin:$PATH LANG=C.UTF-8 4 | 5 | WORKDIR /app 6 | 7 | COPY ./*.sh /app 8 | 9 | RUN set -ex \ 10 | && apk update -f \ 11 | && apk upgrade \ 12 | && apk add --no-cache bash tzdata git npm \ 13 | && rm -rf /var/cache/apk/* \ 14 | && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ 15 | && echo "Asia/Shanghai" > /etc/timezone \ 16 | && npm install -g pm2@latest \ 17 | && mv /app/*.sh /usr/local/bin \ 18 | && chmod +x /usr/local/bin/*.sh 19 | 20 | ENTRYPOINT ["entrypoint.sh"] 21 | -------------------------------------------------------------------------------- /provider/demo.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | module.exports = { 4 | type: 'custom', 5 | nodeList: [ 6 | { 7 | nodeName: '🇺🇸US', 8 | type: 'shadowsocks', 9 | hostname: 'us.example.com', 10 | port: 10000, 11 | method: 'chacha20-ietf-poly1305', 12 | password: 'password', 13 | obfs: 'tls', 14 | obfsHost: 'gateway-carry.icloud.com', 15 | udpRelay: true, 16 | }, 17 | { 18 | nodeName: '🇭🇰HK(Netflix)', 19 | type: 'shadowsocks', 20 | hostname: 'hk.example.com', 21 | port: 10000, 22 | method: 'chacha20-ietf-poly1305', 23 | password: 'password', 24 | udpRelay: true, 25 | }, 26 | ], 27 | } 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # surgio 2 | 3 | [**Surgio官网**](https://surgio.js.org/guide.html) 4 | 5 | ## Docker 6 | 7 | ```shell 8 | docker run -dit \ 9 | --name surgio \ 10 | --restart unless-stopped \ 11 | --hostname surgio \ 12 | -v $PWD/surgio:/app \ 13 | -p 3000:3000 \ 14 | chiupam/surgio:latest 15 | ``` 16 | 17 | ## Docker-compose 18 | ```shell 19 | cat > ./docker-compose.yml << EOF 20 | version: "2.0" 21 | services: 22 | surgio: 23 | image: chiupam/surgio:latest 24 | container_name: surgio 25 | restart: unless-stopped 26 | hostname: surgio 27 | volumes: 28 | - $PWD/surgio:/app 29 | ports: 30 | - 3000:3000 31 | EOF 32 | docker-compose up -d 33 | ``` 34 | 35 | ## 初始化设置 36 | ```shell 37 | docker exec -it surgio start.sh 38 | ``` -------------------------------------------------------------------------------- /template/quantumultx_rules.tpl: -------------------------------------------------------------------------------- 1 | {% filter quantumultx %} 2 | {{ remoteSnippets.apple.main('PROXY', 'Apple', 'Apple CDN', 'DIRECT', 'PROXY') }} 3 | {{ remoteSnippets.hbo.main('PROXY') }} 4 | {{ remoteSnippets.netflix.main('Netflix') }} 5 | {{ remoteSnippets.telegram.main('PROXY') }} 6 | {{ snippet("snippet/youtube_rules.tpl").main('YouTube') }} 7 | {{ snippet("snippet/blocked_rules.tpl").main('PROXY') }} 8 | {{ snippet("snippet/direct_rules.tpl").main('DIRECT') }} 9 | {{ remoteSnippets.overseaTlds.main('PROXY') }} 10 | {% endfilter %} 11 | 12 | # LAN, debugging rules should place above this line 13 | DOMAIN-SUFFIX,local,DIRECT 14 | IP-CIDR,10.0.0.0/8,DIRECT 15 | IP-CIDR,100.64.0.0/10,DIRECT 16 | IP-CIDR,127.0.0.0/8,DIRECT 17 | IP-CIDR,172.16.0.0/12,DIRECT 18 | IP-CIDR,192.168.0.0/16,DIRECT 19 | 20 | GEOIP,CN,DIRECT 21 | FINAL,PROXY 22 | -------------------------------------------------------------------------------- /template/snippet/blocked_rules.tpl: -------------------------------------------------------------------------------- 1 | # 可能被屏蔽 2 | DOMAIN-KEYWORD,evernote 3 | 4 | # Bloomberg 5 | USER-AGENT,Bloomberg* 6 | 7 | # Taiwan 8 | DOMAIN-SUFFIX,tw 9 | 10 | DOMAIN-KEYWORD,bitly 11 | DOMAIN-KEYWORD,blogspot 12 | DOMAIN-KEYWORD,dropbox 13 | DOMAIN-KEYWORD,facebook 14 | DOMAIN-KEYWORD,gmail 15 | DOMAIN-KEYWORD,google 16 | DOMAIN-KEYWORD,instagram 17 | DOMAIN-KEYWORD,oculus 18 | DOMAIN-KEYWORD,twitter 19 | DOMAIN-KEYWORD,whatsapp 20 | DOMAIN-KEYWORD,youtube 21 | 22 | DOMAIN-SUFFIX,cdn.ampproject.org 23 | DOMAIN-SUFFIX,fb.com 24 | DOMAIN-SUFFIX,fb.me 25 | DOMAIN-SUFFIX,fbcdn.net 26 | DOMAIN-SUFFIX,gstatic.com 27 | DOMAIN-SUFFIX,scdn.co 28 | DOMAIN-SUFFIX,t.co 29 | DOMAIN-SUFFIX,telegra.ph 30 | DOMAIN-SUFFIX,twimg.co 31 | DOMAIN-SUFFIX,twimg.com 32 | DOMAIN-SUFFIX,twitpic.com 33 | DOMAIN-SUFFIX,youtu.be 34 | DOMAIN-SUFFIX,ytimg.com 35 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Chiupam 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/workflows/surgio-3.0.2.yml: -------------------------------------------------------------------------------- 1 | name: 构建 surgio(3.0.2) 镜像 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | docker: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Checkout 11 | uses: actions/checkout@master 12 | 13 | - name: Set up QEMU 14 | uses: docker/setup-qemu-action@v1 15 | 16 | - name: Set up Docker Buildx 17 | uses: docker/setup-buildx-action@v1 18 | 19 | - name: Login to DockerHub 20 | uses: docker/login-action@v1 21 | with: 22 | username: ${{ secrets.DOCKERHUB_USERNAME }} 23 | password: ${{ secrets.DOCKERHUB_TOKEN }} 24 | 25 | - name: Build and push 26 | uses: docker/build-push-action@v2 27 | with: 28 | context: . 29 | push: true 30 | file: ./Dockerfile 31 | tags: chiupam/surgio:3.0.2 32 | platforms: linux/amd64,linux/arm64 33 | 34 | - name: Delete Workflow Runs 35 | uses: Mattraks/delete-workflow-runs@main 36 | with: 37 | token: ${{ github.token }} 38 | repository: ${{ github.repository }} 39 | retain_days: 0 40 | keep_minimum_runs: 0 41 | -------------------------------------------------------------------------------- /.github/workflows/surgio-3.2.3.yml: -------------------------------------------------------------------------------- 1 | name: 构建 surgio(3.2.3) 镜像 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | docker: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Checkout 11 | uses: actions/checkout@master 12 | 13 | - name: Set up QEMU 14 | uses: docker/setup-qemu-action@v1 15 | 16 | - name: Set up Docker Buildx 17 | uses: docker/setup-buildx-action@v1 18 | 19 | - name: Login to DockerHub 20 | uses: docker/login-action@v1 21 | with: 22 | username: ${{ secrets.DOCKERHUB_USERNAME }} 23 | password: ${{ secrets.DOCKERHUB_TOKEN }} 24 | 25 | - name: Build and push 26 | uses: docker/build-push-action@v2 27 | with: 28 | context: . 29 | push: true 30 | file: ./Dockerfile 31 | tags: chiupam/surgio:3.2.3 32 | platforms: linux/amd64,linux/arm64 33 | 34 | - name: Delete Workflow Runs 35 | uses: Mattraks/delete-workflow-runs@main 36 | with: 37 | token: ${{ github.token }} 38 | repository: ${{ github.repository }} 39 | retain_days: 0 40 | keep_minimum_runs: 0 41 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | # 克隆 4 | clone() { 5 | if [ ! -d "/app/.git" ]; then 6 | echo "未检测到 surgio 仓库, 正在克隆中, 请耐心等待..." 7 | git clone https://github.com/chiupam/surgio.git /app >/dev/null 2>&1 8 | git -C /app fetch --all >/dev/null 2>&1 9 | git -C /app checkout main >/dev/null 2>&1 10 | rm -rf /app/.idea >/dev/null 2>&1 11 | rm -rf /app/.github >/dev/null 2>&1 12 | rm -rf $(ls | egrep -v "js|node|provider|template") >/dev/null 2>&1 13 | fi 14 | } 15 | 16 | # 安装依赖 17 | install() { 18 | local path="/app/node_modules" 19 | 20 | if [ ! -d "$path/surgio/" ]; then 21 | echo "未检测到 surgio 依赖, 正在安装中, 请耐心等待..." 22 | npm install surgio@latest >/dev/null 2>&1 23 | rm -f /app/package*.json >/dev/null 2>&1 24 | fi 25 | 26 | if [ ! -d "$path/@surgio/gateway" ]; then 27 | echo "未检测到 gateway 依赖, 正在安装中, 请耐心等待..." 28 | npm install @surgio/gateway@latest >/dev/null 2>&1 29 | rm -f /app/package*.json >/dev/null 2>&1 30 | fi 31 | } 32 | 33 | # 启动服务 34 | start() { 35 | echo "初始化完成, 正在启动中, 监听文件如有更新则自动重启服务..." 36 | pm2-runtime start /app/ecosystem.config.js 37 | } 38 | 39 | # 主函数 40 | main() { 41 | clone 42 | install 43 | start 44 | } 45 | 46 | # 执行主函数 47 | main 48 | -------------------------------------------------------------------------------- /.github/workflows/surgio-latest.yml: -------------------------------------------------------------------------------- 1 | name: 构建 surgio 镜像 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - "main" 8 | 9 | jobs: 10 | docker: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@master 15 | 16 | - name: Set up QEMU 17 | uses: docker/setup-qemu-action@v1 18 | 19 | - name: Set up Docker Buildx 20 | uses: docker/setup-buildx-action@v1 21 | 22 | - name: Login to DockerHub 23 | uses: docker/login-action@v1 24 | with: 25 | username: ${{ secrets.DOCKERHUB_USERNAME }} 26 | password: ${{ secrets.DOCKERHUB_TOKEN }} 27 | 28 | - name: Build and push 29 | uses: docker/build-push-action@v2 30 | with: 31 | context: . 32 | push: true 33 | file: ./Dockerfile 34 | tags: chiupam/surgio:latest 35 | platforms: linux/amd64,linux/arm64 36 | 37 | - name: Delete Workflow Runs 38 | uses: Mattraks/delete-workflow-runs@main 39 | with: 40 | token: ${{ github.token }} 41 | repository: ${{ github.repository }} 42 | retain_days: 0 43 | keep_minimum_runs: 0 44 | -------------------------------------------------------------------------------- /template/quantumultx.tpl: -------------------------------------------------------------------------------- 1 | # https://github.com/crossutility/Quantumult-X/blob/master/sample.conf 2 | 3 | [general] 4 | server_check_url={{ proxyTestUrl }} 5 | 6 | [dns] 7 | server=223.5.5.5 8 | server=114.114.114.114 9 | server=119.29.29.29 10 | 11 | [server_remote] 12 | {{ getDownloadUrl('Quantumult_subscribe_us.conf') }}, tag=🇺🇸 US 13 | {{ getDownloadUrl('Quantumult_subscribe_hk.conf') }}, tag=🇭🇰 HK 14 | 15 | [policy] 16 | available=🇺🇸 Auto US, {{ getQuantumultXNodeNames(nodeList, usFilter) }} 17 | available=🇭🇰 Auto HK, {{ getQuantumultXNodeNames(nodeList, hkFilter) }} 18 | static=Netflix, PROXY, {{ getQuantumultXNodeNames(nodeList, netflixFilter) }}, img-url=https://raw.githubusercontent.com/zealson/Zure/master/IconSet/Netflix.png 19 | static=YouTube, PROXY, {{ getQuantumultXNodeNames(nodeList, youtubePremiumFilter) }}, img-url=https://raw.githubusercontent.com/zealson/Zure/master/IconSet/YouTube.png 20 | static=Apple, DIRECT, 🇺🇸 Auto US, 🇭🇰 Auto HK, img-url=https://raw.githubusercontent.com/zealson/Zure/master/IconSet/Apple.png 21 | static=Apple CDN, DIRECT, Apple, img-url=https://raw.githubusercontent.com/zealson/Zure/master/IconSet/Apple.png 22 | 23 | [filter_remote] 24 | {{ getDownloadUrl('QuantumultX_rules.conf') }}, tag=分流规则 25 | 26 | [filter_local] 27 | ip-cidr, 10.0.0.0/8, direct 28 | ip-cidr, 127.0.0.0/8, direct 29 | ip-cidr, 172.16.0.0/12, direct 30 | ip-cidr, 192.168.0.0/16, direct 31 | ip-cidr, 224.0.0.0/24, direct 32 | geoip, cn, direct 33 | final, proxy 34 | -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | config=/app/surgio.conf.js 4 | 5 | # 显示参考格式 6 | echo "域名格式:example.com IP格式:192.168.1.1" 7 | 8 | # 获取接口地址 9 | read -e -p "请输入接口地址:" -r urlBase 10 | 11 | # 检查接口地址是否为空 12 | if [ -z "$urlBase" ]; then 13 | echo "接口地址不能为空!" 14 | exit 1 15 | fi 16 | 17 | # 判断输入的接口地址是否为IP地址 18 | if echo "$urlBase" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'; then 19 | # 输入的是IP地址,需要用户输入端口号 20 | read -e -p "请输入端口号:" -r port 21 | # 检查端口号是否为空 22 | if [ -z "$port" ]; then 23 | echo "端口号不能为空!" 24 | exit 1 25 | fi 26 | urlBase="http://$urlBase:$port" 27 | else 28 | # 输入的是域名,使用https 29 | urlBase="https://$urlBase" 30 | fi 31 | 32 | # 获取面板登录密码 33 | read -e -p "请设置面板登录密码:" -r webToken 34 | 35 | # 检查面板登录密码是否为空 36 | if [ -z "$webToken" ]; then 37 | echo "面板登录密码不能为空!" 38 | exit 1 39 | fi 40 | 41 | # MD5生成随机接口密码 42 | random_password=$(tr -dc 'A-Za-z0-9' < /dev/urandom | head -c 12 | xargs) 43 | artifactToken=$(echo -n "$random_password" | md5sum | awk '{print $1}') 44 | 45 | # 处理URL中的特殊字符 46 | escaped_urlBase=$(printf '%s\n' "$urlBase" | sed -e 's/[\/&]/\\&/g') 47 | escaped_passwd=$(echo "$webToken" | sed -e 's/[\/&]/\\&/g') 48 | escaped_token=$(echo "$artifactToken" | sed -e 's/[\/&]/\\&/g') 49 | 50 | # 替换urlBase和接口密码 51 | if grep -q "https://example.com" "$config"; then 52 | # 使用转义字符处理可能包含特殊字符的接口地址和密码 53 | sed -i "s|https://example.com|$escaped_urlBase|g; s|webToken|$escaped_passwd|g; s|artifactToken|$escaped_token|g" "$config" 54 | echo -e "\n面板地址:$urlBase/" 55 | echo "面板密码:$webToken" 56 | echo -e "接口密码:$artifactToken\n" 57 | echo "自动重启服务中……" 58 | fi 59 | 60 | rm "$0" 61 | -------------------------------------------------------------------------------- /template/clash.tpl: -------------------------------------------------------------------------------- 1 | # {{ downloadUrl }} 2 | 3 | external-controller: 127.0.0.1:9090 4 | port: 7890 5 | socks-port: 7891 6 | redir-port: 7892 7 | 8 | {% if customParams.dns %} 9 | dns: 10 | enable: true 11 | nameserver: 12 | - https://223.5.5.5/dns-query 13 | fallback: # IP addresses who is outside CN in GEOIP will fallback here 14 | - https://223.6.6.6/dns-query 15 | - https://rubyfish.cn/dns-query 16 | fallback-filter: 17 | geoip: true # Enable GEOIP-based fallback 18 | ipcidr: 19 | - 240.0.0.0/4 20 | {% endif %} 21 | 22 | proxies: {{ getClashNodes(nodeList) | json }} 23 | 24 | proxy-groups: 25 | - type: select 26 | name: 🚀 Proxy 27 | proxies: {{ getClashNodeNames(nodeList) | json }} 28 | - type: select 29 | name: 🎬 Netflix 30 | proxies: {{ getClashNodeNames(nodeList, netflixFilter) | json }} 31 | - type: url-test 32 | name: US 33 | proxies: {{ getClashNodeNames(nodeList, usFilter) | json }} 34 | url: {{ proxyTestUrl }} 35 | interval: 1200 36 | - type: url-test 37 | name: HK 38 | proxies: {{ getClashNodeNames(nodeList, hkFilter) | json }} 39 | url: {{ proxyTestUrl }} 40 | interval: 1200 41 | - type: select 42 | name: 🍎 Apple 43 | proxies: 44 | - DIRECT 45 | - 🚀 Proxy 46 | - US 47 | - HK 48 | - type: select 49 | name: 🍎 Apple CDN 50 | proxies: 51 | - DIRECT 52 | - 🍎 Apple 53 | 54 | rules: 55 | {% filter clash %} 56 | {{ remoteSnippets.apple.main('🚀 Proxy', '🍎 Apple', '🍎 Apple CDN', 'DIRECT', 'US') }} 57 | {{ remoteSnippets.netflix.main('🎬 Netflix') }} 58 | {{ remoteSnippets.hbo.main('🚀 Proxy') }} 59 | {{ snippet("snippet/youtube_rules.tpl").main('📺 YouTube') }} 60 | {{ remoteSnippets.telegram.main('🚀 Proxy') }} 61 | {{ snippet("snippet/blocked_rules.tpl").main('🚀 Proxy') }} 62 | {{ snippet("snippet/direct_rules.tpl").main('DIRECT') }} 63 | {{ remoteSnippets.overseaTlds.main('🚀 Proxy')}} 64 | {% endfilter %} 65 | 66 | # LAN 67 | - DOMAIN-SUFFIX,local,DIRECT 68 | - IP-CIDR,127.0.0.0/8,DIRECT 69 | - IP-CIDR,172.16.0.0/12,DIRECT 70 | - IP-CIDR,192.168.0.0/16,DIRECT 71 | - IP-CIDR,10.0.0.0/8,DIRECT 72 | - IP-CIDR,100.64.0.0/10,DIRECT 73 | 74 | # Final 75 | - GEOIP,CN,DIRECT 76 | - MATCH,🚀 Proxy 77 | -------------------------------------------------------------------------------- /template/surge_v3.tpl: -------------------------------------------------------------------------------- 1 | #!MANAGED-CONFIG {{ downloadUrl }} interval=43200 strict=false 2 | 3 | [General] 4 | # 日志等级: warning, notify, info, verbose (默认值: notify) 5 | loglevel = notify 6 | # 跳过某个域名或者 IP 段,这些目标主机将不会由 Surge Proxy 处理。(在 macOS 7 | # 版本中,如果启用了 Set as System Proxy, 那么这些值会被写入到系统网络代理 8 | # 设置中.) 9 | skip-proxy = 127.0.0.1, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, 100.84.0.0/10, localhost, *.local 10 | # 强制使用特定的 DNS 服务器 11 | dns-server = system, 119.29.29.29, 223.5.5.5, 1.1.1.1 12 | 13 | # 将特定 IP 段跳过 Surge TUN,详见 Manual 14 | bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12 15 | # 是否截取并保存 HTTP 流量 (启用后将对性能有较大影响) (默认值: false) 16 | replica = false 17 | # 是否启动完整的 IPv6 支持 (默认值: false) 18 | ipv6 = false 19 | 20 | # 以下参数仅供 macOS 版本使用(多端口监听仅 Surge 3 支持) 21 | http-listen = 0.0.0.0:6152 22 | socks5-listen = 0.0.0.0:6153 23 | 24 | # 测速地址 25 | internet-test-url = {{ proxyTestUrl }} 26 | proxy-test-url = {{ proxyTestUrl }} 27 | 28 | # 其它 29 | # external-controller-access = password@0.0.0.0:6170 30 | show-primary-interface-changed-notification = true 31 | proxy-settings-interface = Primary Interface (Auto) 32 | menu-bar-show-speed = false 33 | allow-wifi-access = true 34 | hide-crashlytics-request = true 35 | 36 | [Proxy] 37 | {{ getSurgeNodes(nodeList) }} 38 | 39 | [Proxy Group] 40 | 🚀 Proxy = select, {{ getSurgeNodeNames(nodeList) }} 41 | 🎬 Netflix = select, {{ getSurgeNodeNames(nodeList, netflixFilter) }} 42 | 📺 YouTube = select, 🚀 Proxy, US, HK 43 | 🍎 Apple = select, DIRECT, 🚀 Proxy, US, HK 44 | 🍎 Apple CDN = select, DIRECT, 🍎 Apple 45 | US = url-test, {{ getSurgeNodeNames(nodeList, usFilter) }}, url = {{ proxyTestUrl }}, interval = 1200 46 | HK = url-test, {{ getSurgeNodeNames(nodeList, hkFilter) }}, url = {{ proxyTestUrl }}, interval = 1200 47 | 48 | [Rule] 49 | {{ remoteSnippets.apple.main('🚀 Proxy', '🍎 Apple', '🍎 Apple CDN', 'DIRECT', 'US') }} 50 | 51 | RULE-SET,{{ remoteSnippets.netflix.url }},🎬 Netflix 52 | 53 | RULE-SET,{{ remoteSnippets.hbo.url }},🎬 Netflix 54 | 55 | {{ snippet("snippet/youtube_rules.tpl").main('📺 YouTube') }} 56 | 57 | RULE-SET,{{ remoteSnippets.telegram.url }},🚀 Proxy 58 | 59 | {{ snippet("snippet/blocked_rules.tpl").main('🚀 Proxy') }} 60 | 61 | {{ snippet("snippet/direct_rules.tpl").main('DIRECT') }} 62 | 63 | RULE-SET,{{ remoteSnippets.overseaTlds.url }},🚀 Proxy 64 | 65 | RULE-SET,SYSTEM,DIRECT 66 | 67 | # LAN 68 | RULE-SET,LAN,DIRECT 69 | 70 | # GeoIP CN 71 | GEOIP,CN,DIRECT 72 | 73 | # Final 74 | FINAL,🚀 Proxy,dns-failed 75 | 76 | [URL Rewrite] 77 | ^https?://(www.)?g.cn https://www.google.com 302 78 | ^https?://(www.)?google.cn https://www.google.com 302 79 | -------------------------------------------------------------------------------- /surgio.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { utils } = require('surgio'); 4 | 5 | /** 6 | * 使用文档:https://surgio.js.org/ 7 | */ 8 | module.exports = { 9 | /** 10 | * 远程片段 11 | * 文档:https://surgio.js.org/guide/custom-config.html#remotesnippets 12 | */ 13 | remoteSnippets: [ 14 | { 15 | name: 'apple', // 模板中对应 remoteSnippets.apple 16 | url: 'https://github.com/geekdada/surge-list/raw/master/surgio-snippet/apple.tpl', 17 | surgioSnippet: true 18 | }, 19 | { 20 | name: 'telegram', // 模板中对应 remoteSnippets.telegram 21 | url: 'https://github.com/DivineEngine/Profiles/raw/master/Surge/Ruleset/Extra/Telegram/Telegram.list' 22 | }, 23 | { 24 | name: 'netflix', // 模板中对应 remoteSnippets.netflix 25 | url: 'https://github.com/DivineEngine/Profiles/raw/master/Surge/Ruleset/StreamingMedia/Video/Netflix.list' 26 | }, 27 | { 28 | name: 'hbo', // 模板中对应 remoteSnippets.hbo 29 | url: 'https://github.com/DivineEngine/Profiles/raw/master/Surge/Ruleset/StreamingMedia/Video/HBO.list' 30 | }, 31 | { 32 | name: 'disney', // 模板中对应 remoteSnippets.disney 33 | url: 'https://github.com/geekdada/surge-list/raw/master/disney.list', 34 | }, 35 | { 36 | name: 'overseaTlds', // 模板中对应 remoteSnippets.overseaTlds 37 | url: 'https://github.com/geekdada/surge-list/raw/master/oversea-tld.list', 38 | }, 39 | ], 40 | customFilters: { 41 | hktFilter: utils.useKeywords(['hkt', 'HKT']), 42 | }, 43 | artifacts: [ 44 | /** 45 | * Surge 46 | */ 47 | { 48 | name: 'SurgeV3.conf', // 新版 Surge 49 | template: 'surge_v3', 50 | provider: 'demo', 51 | }, 52 | // 合并 Provider 53 | { 54 | name: 'SurgeV3_combine.conf', 55 | template: 'surge_v3', 56 | provider: 'demo', 57 | combineProviders: ['subscribe_demo'], 58 | }, 59 | 60 | /** 61 | * Clash 62 | */ 63 | { 64 | name: 'Clash.yaml', 65 | template: 'clash', 66 | provider: 'subscribe_demo', 67 | }, 68 | { 69 | name: 'Clash_custom_dns.yaml', 70 | template: 'clash', 71 | provider: 'subscribe_demo', 72 | customParams: { 73 | dns: true, 74 | } 75 | }, 76 | 77 | /** 78 | * Quantumult X 79 | */ 80 | { 81 | name: 'QuantumultX_rules.conf', 82 | template: 'quantumultx_rules', 83 | provider: 'demo', 84 | }, 85 | { 86 | name: 'QuantumultX.conf', 87 | template: 'quantumultx', 88 | provider: 'demo', 89 | }, 90 | { 91 | name: 'QuantumultX_subscribe_us.conf', 92 | template: 'quantumultx_subscribe', 93 | provider: 'demo', 94 | customParams: { 95 | magicVariable: utils.usFilter, 96 | }, 97 | }, 98 | { 99 | name: 'QuantumultX_subscribe_hk.conf', 100 | template: 'quantumultx_subscribe', 101 | provider: 'demo', 102 | customParams: { 103 | magicVariable: utils.hkFilter, 104 | }, 105 | }, 106 | ], 107 | urlBase: 'https://example.com/', 108 | gateway: { 109 | auth: true, 110 | // 用于调用接口和登录的鉴权码 111 | accessToken: 'webToken', 112 | /** 113 | * 专门用于调用以下三个接口的鉴权码 114 | * /get-artifact 115 | * /export-providers 116 | * /render 117 | */ 118 | viewerToken: 'artifactToken', 119 | useCacheOnError: false, 120 | }, 121 | 122 | // 非常有限的报错信息收集 123 | analytics: false, 124 | }; 125 | 126 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 19 | 20 | 21 | 24 | { 25 | "keyToString": { 26 | "RunOnceActivity.OpenProjectViewOnStart": "true", 27 | "RunOnceActivity.ShowReadmeOnStart": "true", 28 | "git-widget-placeholder": "main", 29 | "last_opened_file_path": "C:/Users/赵磊/OneDrive/Project", 30 | "settings.editor.selected.configurable": "preferences.keymap" 31 | } 32 | } 33 | 34 | 35 | 36 | 55 | 56 | 57 | 58 | 59 | 60 | 1656353774658 61 | 65 | 66 | 67 | 68 | 77 | 78 | -------------------------------------------------------------------------------- /template/snippet/direct_rules.tpl: -------------------------------------------------------------------------------- 1 | # Alibaba 2 | DOMAIN-KEYWORD,alibaba-inc 3 | DOMAIN-KEYWORD,alibaba 4 | DOMAIN-KEYWORD,alipay-inc 5 | DOMAIN-KEYWORD,aliyuncs 6 | DOMAIN-KEYWORD,alipay 7 | DOMAIN-KEYWORD,taobao 8 | DOMAIN-KEYWORD,alicdn 9 | DOMAIN-KEYWORD,aliyun 10 | DOMAIN-KEYWORD,9game 11 | DOMAIN-KEYWORD,ucweb 12 | 13 | # Battle.net 14 | DOMAIN-SUFFIX,blizzard.com 15 | DOMAIN-SUFFIX,battle.net 16 | 17 | # P2P 18 | PROCESS-NAME,*Folx* 19 | PROCESS-NAME,*Thunder* 20 | PROCESS-NAME,*DownloadService* 21 | PROCESS-NAME,*Soda* 22 | PROCESS-NAME,*p4pclient* 23 | PROCESS-NAME,aria2c 24 | PROCESS-NAME,fdm 25 | PROCESS-NAME,Folx 26 | PROCESS-NAME,NetTransport 27 | PROCESS-NAME,Transmission 28 | PROCESS-NAME,uTorrent 29 | PROCESS-NAME,WebTorrent 30 | PROCESS-NAME,WebTorrent Helper 31 | DOMAIN-KEYWORD,tracker 32 | 33 | # Booking 34 | DOMAIN-SUFFIX,booking.com 35 | DOMAIN-SUFFIX,booking.cn 36 | 37 | # Misc 38 | PROCESS-NAME,百度网盘 39 | PROCESS-NAME,*Clash* 40 | PROCESS-NAME,*clash* 41 | PROCESS-NAME,v2ray 42 | PROCESS-NAME,ss-local 43 | PROCESS-NAME,ssr-local 44 | # iStat Menu IP Test 45 | DOMAIN,ip.bjango.com 46 | DOMAIN-SUFFIX,biquge.com.tw 47 | DOMAIN-SUFFIX,maoyun.tv 48 | DOMAIN-SUFFIX,moke.com 49 | DOMAIN-SUFFIX,test-ipv6.com 50 | DOMAIN-SUFFIX,zimuzu.tv 51 | DOMAIN-SUFFIX,zmzapi.com 52 | DOMAIN-SUFFIX,zmzapi.net 53 | DOMAIN-SUFFIX,zmzfile.com 54 | 55 | # China Apps 56 | USER-AGENT,MApi* 57 | USER-AGENT,MicroMessenger* 58 | USER-AGENT,WeChat* 59 | DOMAIN-SUFFIX,cn 60 | DOMAIN-KEYWORD,-cn 61 | DOMAIN-KEYWORD,alicdn 62 | DOMAIN-SUFFIX,126.com 63 | DOMAIN-SUFFIX,126.net 64 | DOMAIN-SUFFIX,127.net 65 | DOMAIN-SUFFIX,163.com 66 | DOMAIN-SUFFIX,360buyimg.com 67 | DOMAIN-SUFFIX,36kr.com 68 | DOMAIN-SUFFIX,acfun.tv 69 | DOMAIN-SUFFIX,air-matters.com 70 | DOMAIN-SUFFIX,aixifan.com 71 | DOMAIN-SUFFIX,weibo.com 72 | DOMAIN-SUFFIX,alipayobjects.com 73 | DOMAIN-SUFFIX,amap.com 74 | DOMAIN-SUFFIX,autonavi.com 75 | DOMAIN-SUFFIX,baidu.com 76 | DOMAIN-SUFFIX,baidupcs.com 77 | DOMAIN-SUFFIX,bdimg.com 78 | DOMAIN-SUFFIX,bdstatic.com 79 | DOMAIN-SUFFIX,bilibili.com 80 | DOMAIN-SUFFIX,caiyunapp.com 81 | DOMAIN-SUFFIX,clouddn.com 82 | DOMAIN-SUFFIX,cnbeta.com 83 | DOMAIN-SUFFIX,cnbetacdn.com 84 | DOMAIN-SUFFIX,cootekservice.com 85 | DOMAIN-SUFFIX,csdn.net 86 | DOMAIN-SUFFIX,ctrip.com 87 | DOMAIN-SUFFIX,dgtle.com 88 | DOMAIN-SUFFIX,dianping.com 89 | DOMAIN-SUFFIX,douban.com 90 | DOMAIN-SUFFIX,doubanio.com 91 | DOMAIN-SUFFIX,duokan.com 92 | DOMAIN-SUFFIX,easou.com 93 | DOMAIN-SUFFIX,ele.me 94 | DOMAIN-SUFFIX,fast.com 95 | DOMAIN-SUFFIX,feng.com 96 | DOMAIN-SUFFIX,fir.im 97 | DOMAIN-SUFFIX,frdic.com 98 | DOMAIN-SUFFIX,g-cores.com 99 | DOMAIN-SUFFIX,godic.net 100 | DOMAIN-SUFFIX,gtimg.com 101 | DOMAIN-SUFFIX,hongxiu.com 102 | DOMAIN-SUFFIX,hxcdn.net 103 | DOMAIN-SUFFIX,iciba.com 104 | DOMAIN-SUFFIX,ifeng.com 105 | DOMAIN-SUFFIX,ifengimg.com 106 | DOMAIN-SUFFIX,images-amazon.com 107 | DOMAIN-SUFFIX,ipip.net 108 | DOMAIN-SUFFIX,iqiyi.com 109 | DOMAIN-SUFFIX,jd.com 110 | DOMAIN-SUFFIX,jianshu.com 111 | DOMAIN-SUFFIX,knewone.com 112 | DOMAIN-SUFFIX,le.com 113 | DOMAIN-SUFFIX,lecloud.com 114 | DOMAIN-SUFFIX,lemicp.com 115 | DOMAIN-SUFFIX,luoo.net 116 | DOMAIN-SUFFIX,meituan.com 117 | DOMAIN-SUFFIX,meituan.net 118 | DOMAIN-SUFFIX,mi.com 119 | DOMAIN-SUFFIX,miaopai.com 120 | DOMAIN-SUFFIX,miui.com 121 | DOMAIN-SUFFIX,miwifi.com 122 | DOMAIN-SUFFIX,mob.com 123 | DOMAIN-SUFFIX,netease.com 124 | DOMAIN-SUFFIX,oschina.net 125 | DOMAIN-SUFFIX,ppsimg.com 126 | DOMAIN-SUFFIX,pstatp.com 127 | DOMAIN-SUFFIX,qcloud.com 128 | DOMAIN-SUFFIX,qdaily.com 129 | DOMAIN-SUFFIX,qdmm.com 130 | DOMAIN-SUFFIX,qhimg.com 131 | DOMAIN-SUFFIX,qidian.com 132 | DOMAIN-SUFFIX,qihucdn.com 133 | DOMAIN-SUFFIX,qiniu.com 134 | DOMAIN-SUFFIX,qiniucdn.com 135 | DOMAIN-SUFFIX,qiyipic.com 136 | DOMAIN-SUFFIX,qq.com 137 | DOMAIN-SUFFIX,qqurl.com 138 | DOMAIN-SUFFIX,rarbg.is 139 | DOMAIN-SUFFIX,rr.tv 140 | DOMAIN-SUFFIX,ruguoapp.com 141 | DOMAIN-SUFFIX,segmentfault.com 142 | DOMAIN-SUFFIX,sinaapp.com 143 | DOMAIN-SUFFIX,sogou.com 144 | DOMAIN-SUFFIX,sogoucdn.com 145 | DOMAIN-SUFFIX,sohu.com 146 | DOMAIN-SUFFIX,soku.com 147 | DOMAIN-SUFFIX,speedtest.net 148 | DOMAIN-SUFFIX,sspai.com 149 | DOMAIN-SUFFIX,suning.com 150 | DOMAIN-SUFFIX,tenpay.com 151 | DOMAIN-SUFFIX,tmall.com 152 | DOMAIN-SUFFIX,tudou.com 153 | DOMAIN-SUFFIX,umetrip.com 154 | DOMAIN-SUFFIX,upaiyun.com 155 | DOMAIN,update.microsoft.com 156 | DOMAIN-SUFFIX,upyun.com 157 | DOMAIN-SUFFIX,veryzhun.com 158 | DOMAIN-SUFFIX,weibo.com 159 | DOMAIN-SUFFIX,xiami.com 160 | DOMAIN-SUFFIX,xiami.net 161 | DOMAIN-SUFFIX,xiaomicp.com 162 | DOMAIN-SUFFIX,ximalaya.com 163 | DOMAIN-SUFFIX,xmcdn.com 164 | DOMAIN-SUFFIX,xunlei.com 165 | DOMAIN-SUFFIX,yhd.com 166 | DOMAIN-SUFFIX,yihaodianimg.com 167 | DOMAIN-SUFFIX,yinxiang.com 168 | DOMAIN-SUFFIX,ykimg.com 169 | DOMAIN-SUFFIX,youdao.com 170 | DOMAIN-SUFFIX,youku.com 171 | DOMAIN-SUFFIX,zealer.com 172 | DOMAIN-SUFFIX,zhihu.com 173 | DOMAIN-SUFFIX,zhimg.com 174 | DOMAIN-SUFFIX,chinacloudapi.cn 175 | DOMAIN-SUFFIX,mymm.com 176 | DOMAIN-SUFFIX,akadns.net 177 | --------------------------------------------------------------------------------