├── .github └── workflows │ └── main.yml ├── GeoLite2-City.mmdb ├── README.md ├── config.txt ├── hy2pac.txt ├── ip └── cesu.csv ├── main.py ├── nekoray_g6NZqPlsZX.webp ├── requirements.txt ├── test.py └── update_time.txt /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Hourly Workflow 2 | 3 | on: 4 | schedule: 5 | - cron: '0 */6 * * *' # 每6小时运行一次 6 | workflow_dispatch: # 允许手动触发 7 | inputs: 8 | manual_run: 9 | description: 'Run the workflow manually' 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - name: Checkout repository 17 | uses: actions/checkout@v4 18 | - uses: szenius/set-timezone@v1.0 # 设置执行环境的时区 19 | with: 20 | timezoneLinux: "Asia/Shanghai" 21 | - name: Set up Python 22 | uses: actions/setup-python@v3 23 | with: 24 | python-version: 3.7 # 替换为你的Python版本 25 | - name: Upgrade pip 26 | run: python -m pip install --upgrade pip 27 | 28 | - name: Install requirements 29 | run: | 30 | python3 -m pip install --upgrade pip 31 | pip3 install -r ./requirements.txt 32 | 33 | - name: Execute main.py 34 | run: python3 ./main.py # 替换为你的main.py的实际文件名 35 | 36 | - name: Commit 37 | env: 38 | GIT_NAME: GitHub Actions[Bot] 39 | GIT_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com 40 | run: | 41 | git config --local user.name $GIT_NAME 42 | git config --local user.email $GIT_EMAIL 43 | git add . 44 | git commit -m "Github action update at `date '+%Y-%m-%d %H:%M:%S'`." 45 | - name: Push 46 | uses: ad-m/github-push-action@master 47 | with: 48 | github_token: ${{ secrets.GITHUB_TOKEN }} 49 | branch: main 50 | -------------------------------------------------------------------------------- /GeoLite2-City.mmdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbang/chromegopacs/1a249616412d8439d2c9a54c85770ed5f432d6d4/GeoLite2-City.mmdb -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 本项目仅供学习交流 2 | 3 | [感谢大佬Alvin🥳🥳🥳](https://github.com/Alvin9999) 4 | 5 | Chromego项目地址:https://github.com/Alvin9999/new-pac Star一下吧! 6 | 7 | ![](nekoray_g6NZqPlsZX.webp) 8 | 9 | 大概就是这样的,显示节点地理位置,尽量别滥用,谢谢 10 | 11 | 项目只是提取大佬项目中的节点,没有技术含量(节点不是项目中的全部,我只提取了经常更新维护的部分) 12 | 13 | Windows: https://github.com/MatsuriDayo/nekoray/releases 14 | 15 | Andriod: https://github.com/MatsuriDayo/NekoBoxForAndroid/releases 16 | 17 | 当然,全平台客户端查看:[https://v2rayse.com/client](https://v2rayse.com/client) 18 | 19 | > 订阅链接 20 | 21 | ``` 22 | https://raw.githubusercontent.com/markbang/chromegopacs/main/hy2pac.txt 23 | ``` 24 | -------------------------------------------------------------------------------- /config.txt: -------------------------------------------------------------------------------- 1 | secret: dongtaiwang.com 2 | mixed-port: 7890 3 | allow-lan: false 4 | log-level: info 5 | dns: 6 | enabled: true 7 | nameserver: 8 | - 119.29.29.29 9 | - 223.5.5.5 10 | fallback: 11 | - 8.8.8.8 12 | - 8.8.4.4 13 | - tls://1.0.0.1:853 14 | - tls://dns.google:853 15 | proxies: 16 | - name: ip 17 | type: hysteria 18 | server: www.dtku46.xyz 19 | port: 11223 20 | auth-str: mqoE9qSoyMFa 21 | alpn: 22 | - h3 23 | protocol: udp 24 | up: "50 Mbps" 25 | down: "100 Mbps" 26 | skip-cert-verify: true 27 | proxy-groups: 28 | - name: 🚀 节点选择 29 | type: select 30 | proxies: 31 | - ♻️ 自动选择 32 | - DIRECT 33 | - ip 34 | - name: ♻️ 自动选择 35 | type: url-test 36 | url: http://www.gstatic.com/generate_204 37 | interval: 300 38 | tolerance: 50 39 | proxies: 40 | - ip 41 | - name: 🌍 国外媒体 42 | type: select 43 | proxies: 44 | - 🚀 节点选择 45 | - ♻️ 自动选择 46 | - 🎯 全球直连 47 | - ip 48 | - name: 📲 电报信息 49 | type: select 50 | proxies: 51 | - 🚀 节点选择 52 | - 🎯 全球直连 53 | - ip 54 | - name: Ⓜ️ 微软服务 55 | type: select 56 | proxies: 57 | - 🎯 全球直连 58 | - 🚀 节点选择 59 | - ip 60 | - name: 🍎 苹果服务 61 | type: select 62 | proxies: 63 | - 🚀 节点选择 64 | - 🎯 全球直连 65 | - ip 66 | - name: 🎯 全球直连 67 | type: select 68 | proxies: 69 | - DIRECT 70 | - 🚀 节点选择 71 | - ♻️ 自动选择 72 | - name: 🛑 全球拦截 73 | type: select 74 | proxies: 75 | - REJECT 76 | - DIRECT 77 | - name: 🍃 应用净化 78 | type: select 79 | proxies: 80 | - REJECT 81 | - DIRECT 82 | - name: 🐟 漏网之鱼 83 | type: select 84 | proxies: 85 | - 🚀 节点选择 86 | - 🎯 全球直连 87 | - ♻️ 自动选择 88 | - ip 89 | 90 | rules: 91 | - MATCH,🚀 节点选择 92 | -------------------------------------------------------------------------------- /hy2pac.txt: -------------------------------------------------------------------------------- 1 | hy2://dongtaiwang.com@207.90.239.157:12344,20000-30000/?insecure=1&sni=www.bing.com#United States, None 2 | hy2://dongtaiwang.com@207.90.239.157:12344,20000-30000/?insecure=1&sni=www.bing.com#United States, None 3 | hy2://dongtaiwang.com@207.90.239.157:12344,20000-30000/?insecure=1&sni=www.bing.com#United States, None 4 | hy2://dongtaiwang.com@207.90.239.157:12344,20000-30000/?insecure=1&sni=www.bing.com#United States, None 5 | hysteria://46.17.43.223:12311/?insecure=1&peer=bing.com&auth=dongtaiwang.com&upmbps=55&downmbps=110&alpn=h3#Russia, Moscow 6 | hysteria://46.17.43.223:12311/?insecure=1&peer=bing.com&auth=dongtaiwang.com&upmbps=55&downmbps=110&alpn=h3#Russia, Moscow 7 | hysteria://46.17.43.223:12311/?insecure=1&peer=bing.com&auth=dongtaiwang.com&upmbps=55&downmbps=110&alpn=h3#Russia, Moscow 8 | hysteria://46.17.43.223:12311/?insecure=1&peer=bing.com&auth=dongtaiwang.com&upmbps=55&downmbps=110&alpn=h3#Russia, Moscow -------------------------------------------------------------------------------- /ip/cesu.csv: -------------------------------------------------------------------------------- 1 | IP地址,端口,回源端口,TLS,数据中心,地区,城市,TCP延迟(ms),速度(MB/s) 2 | 8.219.245.187,2087,2087,true,SIN,Asia Pacific,Singapore,74,10.63 3 | 8.219.210.64,2053,2053,true,SIN,Asia Pacific,Singapore,119,10.63 4 | 8.210.39.96,2096,2096,true,HKG,Asia Pacific,Hong Kong,34,10.63 5 | 8.222.208.83,2052,2052,false,SIN,Asia Pacific,Singapore,46,10.62 6 | 8.219.198.34,80,80,false,SIN,Asia Pacific,Singapore,10,10.62 7 | 8.219.209.14,2053,2053,true,SIN,Asia Pacific,Singapore,77,10.62 8 | 8.222.221.90,2083,2083,true,SIN,Asia Pacific,Singapore,70,10.61 9 | 8.222.249.98,2083,2083,true,SIN,Asia Pacific,Singapore,39,10.61 10 | 8.222.253.235,2052,2052,false,SIN,Asia Pacific,Singapore,3,10.61 11 | 8.219.73.21,2087,2087,true,SIN,Asia Pacific,Singapore,89,10.61 12 | 8.219.11.158,2086,2086,false,SIN,Asia Pacific,Singapore,4,10.61 13 | 8.219.241.189,2095,2095,false,SIN,Asia Pacific,Singapore,30,10.60 14 | 8.222.222.64,2052,2052,false,SIN,Asia Pacific,Singapore,4,10.60 15 | 8.219.194.170,8443,8443,true,SIN,Asia Pacific,Singapore,102,10.60 16 | 8.218.146.204,443,443,true,HKG,Asia Pacific,Hong Kong,68,10.60 17 | 8.222.210.182,8443,8443,true,SIN,Asia Pacific,Singapore,58,10.60 18 | 8.219.201.8,2087,2087,true,SIN,Asia Pacific,Singapore,84,10.59 19 | 8.219.74.35,8443,8443,true,SIN,Asia Pacific,Singapore,119,10.59 20 | 47.236.164.215,2087,2087,true,SIN,Asia Pacific,Singapore,47,10.59 21 | 8.219.110.88,8880,8880,false,SIN,Asia Pacific,Singapore,9,10.58 22 | 8.222.193.208,2053,2053,true,SIN,Asia Pacific,Singapore,66,10.58 23 | 8.222.214.231,80,80,false,SIN,Asia Pacific,Singapore,6,10.57 24 | 8.219.197.111,8880,8880,false,SIN,Asia Pacific,Singapore,19,10.57 25 | 8.219.141.174,8880,8880,false,SIN,Asia Pacific,Singapore,23,10.56 26 | 8.219.199.220,8443,8443,true,SIN,Asia Pacific,Singapore,105,10.56 27 | 8.219.126.3,2053,2053,true,SIN,Asia Pacific,Singapore,76,10.56 28 | 8.219.238.145,8443,8443,true,SIN,Asia Pacific,Singapore,74,10.56 29 | 47.236.158.158,2087,2087,true,SIN,Asia Pacific,Singapore,102,10.55 30 | 47.236.116.182,2082,2082,false,SIN,Asia Pacific,Singapore,13,10.55 31 | 8.217.250.222,8880,8880,false,HKG,Asia Pacific,Hong Kong,38,10.55 32 | 8.219.84.214,2086,2086,false,SIN,Asia Pacific,Singapore,16,10.55 33 | 47.245.115.6,80,80,false,SIN,Asia Pacific,Singapore,36,10.54 34 | 47.236.166.131,2053,2053,true,SIN,Asia Pacific,Singapore,100,10.54 35 | 47.236.145.85,2082,2082,false,SIN,Asia Pacific,Singapore,13,10.54 36 | 8.219.107.199,2096,2096,true,SIN,Asia Pacific,Singapore,133,10.54 37 | 8.219.147.58,80,80,false,SIN,Asia Pacific,Singapore,7,10.54 38 | 8.219.196.24,2083,2083,true,SIN,Asia Pacific,Singapore,99,10.53 39 | 8.218.146.204,2086,2086,false,HKG,Asia Pacific,Hong Kong,45,10.53 40 | 47.236.180.51,8880,8880,false,SIN,Asia Pacific,Singapore,8,10.53 41 | 8.219.5.10,8880,8880,false,SIN,Asia Pacific,Singapore,50,10.52 42 | 8.219.179.34,8880,8880,false,SIN,Asia Pacific,Singapore,16,10.52 43 | 8.219.58.64,443,443,true,SIN,Asia Pacific,Singapore,131,10.51 44 | 8.219.122.55,8080,8080,false,SIN,Asia Pacific,Singapore,6,10.51 45 | 47.236.169.15,2095,2095,false,SIN,Asia Pacific,Singapore,26,10.51 46 | 8.219.210.64,8080,8080,false,SIN,Asia Pacific,Singapore,2,10.51 47 | 8.219.93.5,8080,8080,false,SIN,Asia Pacific,Singapore,10,10.50 48 | 8.219.237.250,8080,8080,false,SIN,Asia Pacific,Singapore,31,10.50 49 | 8.222.255.15,2052,2052,false,SIN,Asia Pacific,Singapore,9,10.50 50 | 8.219.201.8,8443,8443,true,SIN,Asia Pacific,Singapore,73,10.49 51 | 47.236.7.106,2053,2053,true,SIN,Asia Pacific,Singapore,60,10.48 52 | 8.222.140.87,2096,2096,true,SIN,Asia Pacific,Singapore,87,10.48 53 | 47.236.253.41,2082,2082,false,SIN,Asia Pacific,Singapore,19,10.48 54 | 8.219.198.139,2082,2082,false,SIN,Asia Pacific,Singapore,13,10.48 55 | 8.219.122.96,2052,2052,false,SIN,Asia Pacific,Singapore,56,10.48 56 | 8.219.74.35,8880,8880,false,SIN,Asia Pacific,Singapore,8,10.47 57 | 47.236.170.54,2083,2083,true,SIN,Asia Pacific,Singapore,52,10.47 58 | 8.219.74.35,2052,2052,false,SIN,Asia Pacific,Singapore,7,10.47 59 | 47.88.15.127,443,443,true,SJC,North America,San Jose,176,10.46 60 | 47.245.108.213,2052,2052,false,SIN,Asia Pacific,Singapore,32,10.46 61 | 8.219.247.203,2096,2096,true,SIN,Asia Pacific,Singapore,80,10.46 62 | 8.219.140.63,8080,8080,false,SIN,Asia Pacific,Singapore,12,10.45 63 | 8.222.197.251,2087,2087,true,SIN,Asia Pacific,Singapore,47,10.44 64 | 8.222.167.147,8880,8880,false,SIN,Asia Pacific,Singapore,12,10.44 65 | 47.236.253.41,8443,8443,true,SIN,Asia Pacific,Singapore,17,10.44 66 | 8.219.196.24,2096,2096,true,SIN,Asia Pacific,Singapore,58,10.43 67 | 8.219.101.72,80,80,false,SIN,Asia Pacific,Singapore,13,10.42 68 | 8.222.253.235,2083,2083,true,SIN,Asia Pacific,Singapore,140,10.42 69 | 47.236.168.17,2087,2087,true,SIN,Asia Pacific,Singapore,70,10.42 70 | 8.219.99.169,8080,8080,false,SIN,Asia Pacific,Singapore,26,10.42 71 | 47.236.104.11,2082,2082,false,SIN,Asia Pacific,Singapore,32,10.41 72 | 8.219.222.8,2083,2083,true,SIN,Asia Pacific,Singapore,91,10.41 73 | 8.219.241.189,2082,2082,false,SIN,Asia Pacific,Singapore,28,10.41 74 | 8.222.211.16,2095,2095,false,SIN,Asia Pacific,Singapore,34,10.40 75 | 8.219.3.53,80,80,false,SIN,Asia Pacific,Singapore,4,10.40 76 | 8.219.102.252,2053,2053,true,SIN,Asia Pacific,Singapore,201,10.39 77 | 8.222.224.17,2095,2095,false,SIN,Asia Pacific,Singapore,7,10.39 78 | 8.219.140.63,8080,8080,false,SIN,Asia Pacific,Singapore,6,10.38 79 | 8.219.245.187,8080,8080,false,SIN,Asia Pacific,Singapore,148,10.38 80 | 8.222.214.13,2082,2082,false,SIN,Asia Pacific,Singapore,5,10.37 81 | 8.219.50.180,80,80,false,SIN,Asia Pacific,Singapore,142,10.36 82 | 8.219.104.242,2087,2087,true,SIN,Asia Pacific,Singapore,85,10.35 83 | 8.219.153.237,80,80,false,NRT,Asia Pacific,Tokyo,73,10.35 84 | 47.236.169.141,2083,2083,true,SIN,Asia Pacific,Singapore,57,10.34 85 | 8.219.77.222,2087,2087,true,SIN,Asia Pacific,Singapore,18,10.34 86 | 8.219.174.213,2053,2053,true,SIN,Asia Pacific,Singapore,95,10.34 87 | 47.236.125.62,2082,2082,false,NRT,Asia Pacific,Tokyo,88,10.33 88 | 47.236.117.48,80,80,false,SIN,Asia Pacific,Singapore,78,10.33 89 | 8.219.67.133,2087,2087,true,SIN,Asia Pacific,Singapore,144,10.32 90 | 8.219.241.189,2053,2053,true,SIN,Asia Pacific,Singapore,95,10.32 91 | 8.218.11.90,2086,2086,false,HKG,Asia Pacific,Hong Kong,70,10.32 92 | 8.219.86.200,2086,2086,false,SIN,Asia Pacific,Singapore,19,10.31 93 | 8.219.196.24,2087,2087,true,SIN,Asia Pacific,Singapore,94,10.31 94 | 47.236.146.249,2086,2086,false,SIN,Asia Pacific,Singapore,26,10.31 95 | 47.236.125.62,2052,2052,false,NRT,Asia Pacific,Tokyo,105,10.31 96 | 8.217.207.60,8880,8880,false,HKG,Asia Pacific,Hong Kong,37,10.31 97 | 47.236.166.131,8443,8443,true,SIN,Asia Pacific,Singapore,72,10.30 98 | 8.219.74.35,2095,2095,false,SIN,Asia Pacific,Singapore,10,10.30 99 | 47.236.202.91,2083,2083,true,SIN,Asia Pacific,Singapore,35,10.30 100 | 8.219.111.147,443,443,true,SIN,Asia Pacific,Singapore,95,10.29 101 | 8.219.179.34,2087,2087,true,SIN,Asia Pacific,Singapore,82,10.29 102 | 8.222.198.105,8443,8443,true,SIN,Asia Pacific,Singapore,56,10.29 103 | 8.219.58.64,2052,2052,false,SIN,Asia Pacific,Singapore,49,10.28 104 | 8.222.253.235,2086,2086,false,SIN,Asia Pacific,Singapore,3,10.27 105 | 8.219.199.220,2052,2052,false,SIN,Asia Pacific,Singapore,10,10.27 106 | 8.222.210.182,8080,8080,false,SIN,Asia Pacific,Singapore,3,10.27 107 | 8.219.73.188,2095,2095,false,SIN,Asia Pacific,Singapore,26,10.27 108 | 8.219.206.53,2087,2087,true,SIN,Asia Pacific,Singapore,86,10.27 109 | 47.243.86.79,2095,2095,false,HKG,Asia Pacific,Hong Kong,38,10.26 110 | 8.222.208.38,8880,8880,false,SIN,Asia Pacific,Singapore,5,10.26 111 | 8.222.236.229,8880,8880,false,SIN,Asia Pacific,Singapore,5,10.26 112 | 8.219.195.47,2083,2083,true,SIN,Asia Pacific,Singapore,87,10.26 113 | 8.219.229.190,8880,8880,false,SIN,Asia Pacific,Singapore,16,10.25 114 | 8.222.213.221,2053,2053,true,SIN,Asia Pacific,Singapore,77,10.25 115 | 8.222.221.86,80,80,false,SIN,Asia Pacific,Singapore,3,10.25 116 | 8.222.214.13,8880,8880,false,SIN,Asia Pacific,Singapore,5,10.25 117 | 8.219.124.227,2087,2087,true,SIN,Asia Pacific,Singapore,116,10.25 118 | 8.219.228.157,2053,2053,true,SIN,Asia Pacific,Singapore,46,10.25 119 | 8.217.221.165,80,80,false,HKG,Asia Pacific,Hong Kong,37,10.25 120 | 8.219.111.175,2096,2096,true,SIN,Asia Pacific,Singapore,85,10.25 121 | 8.219.73.188,8443,8443,true,SIN,Asia Pacific,Singapore,132,10.25 122 | 8.222.249.190,2086,2086,false,SIN,Asia Pacific,Singapore,60,10.24 123 | 8.222.255.15,2095,2095,false,SIN,Asia Pacific,Singapore,3,10.24 124 | 8.219.186.189,2095,2095,false,SIN,Asia Pacific,Singapore,29,10.23 125 | 8.219.229.190,8080,8080,false,SIN,Asia Pacific,Singapore,32,10.23 126 | 8.219.151.193,2095,2095,false,SIN,Asia Pacific,Singapore,12,10.22 127 | 8.222.208.38,2087,2087,true,SIN,Asia Pacific,Singapore,151,10.22 128 | 8.219.13.143,2052,2052,false,SIN,Asia Pacific,Singapore,16,10.22 129 | 8.219.201.174,8443,8443,true,SIN,Asia Pacific,Singapore,78,10.22 130 | 8.219.97.179,2082,2082,false,SIN,Asia Pacific,Singapore,16,10.22 131 | 8.218.85.128,443,443,true,HKG,Asia Pacific,Hong Kong,79,10.22 132 | 8.222.212.219,2053,2053,true,SIN,Asia Pacific,Singapore,63,10.22 133 | 8.222.146.222,2082,2082,false,SIN,Asia Pacific,Singapore,16,10.21 134 | 8.219.103.65,2096,2096,true,SIN,Asia Pacific,Singapore,76,10.21 135 | 8.219.202.130,8080,8080,false,SIN,Asia Pacific,Singapore,5,10.21 136 | 8.219.201.174,2086,2086,false,SIN,Asia Pacific,Singapore,32,10.20 137 | 8.219.251.81,80,80,false,SIN,Asia Pacific,Singapore,27,10.20 138 | 8.222.208.38,2082,2082,false,SIN,Asia Pacific,Singapore,5,10.20 139 | 8.222.209.223,443,443,true,SIN,Asia Pacific,Singapore,110,10.19 140 | 47.236.171.205,2053,2053,true,SIN,Asia Pacific,Singapore,96,10.19 141 | 8.219.42.72,443,443,true,SIN,Asia Pacific,Singapore,66,10.19 142 | 8.219.104.242,80,80,false,SIN,Asia Pacific,Singapore,14,10.19 143 | 47.236.123.133,2086,2086,false,SIN,Asia Pacific,Singapore,15,10.18 144 | 8.222.146.222,8443,8443,true,SIN,Asia Pacific,Singapore,97,10.18 145 | 47.236.87.206,2082,2082,false,SIN,Asia Pacific,Singapore,12,10.18 146 | 8.219.215.214,2083,2083,true,SIN,Asia Pacific,Singapore,128,10.18 147 | 47.236.169.15,2087,2087,true,SIN,Asia Pacific,Singapore,91,10.18 148 | 8.218.122.55,443,443,true,HKG,Asia Pacific,Hong Kong,53,10.17 149 | 8.219.101.138,80,80,false,SIN,Asia Pacific,Singapore,20,10.17 150 | 8.219.228.193,8443,8443,true,SIN,Asia Pacific,Singapore,94,10.17 151 | 8.222.180.86,2083,2083,true,SIN,Asia Pacific,Singapore,97,10.17 152 | 8.219.66.156,2095,2095,false,NRT,Asia Pacific,Tokyo,96,10.17 153 | 8.219.40.37,2082,2082,false,SIN,Asia Pacific,Singapore,5,10.17 154 | 8.222.214.13,2095,2095,false,SIN,Asia Pacific,Singapore,5,10.17 155 | 8.219.159.232,2052,2052,false,SIN,Asia Pacific,Singapore,31,10.17 156 | 47.236.170.54,8080,8080,false,SIN,Asia Pacific,Singapore,56,10.17 157 | 47.236.171.205,8443,8443,true,SIN,Asia Pacific,Singapore,72,10.16 158 | 8.219.72.51,8080,8080,false,SIN,Asia Pacific,Singapore,22,10.16 159 | 47.236.144.196,2053,2053,true,SIN,Asia Pacific,Singapore,127,10.16 160 | 8.219.170.223,80,80,false,SIN,Asia Pacific,Singapore,2,10.16 -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import re 3 | import json 4 | import geoip2.database 5 | import socket 6 | from datetime import datetime 7 | import yaml 8 | 9 | protocol = {"hysteria2": "hy2", "hysteria": "hysteria","tuic": "tuic"} 10 | def fetch_github_files(username, repository, file_paths): 11 | base_url = f"https://raw.githubusercontent.com/{username}/{repository}/master/" 12 | results = {} 13 | for file_path in file_paths: 14 | url = base_url + file_path 15 | try: 16 | response = requests.get(url) 17 | response.encoding = 'utf-8' 18 | if response.status_code == 200: 19 | results[file_path] = response.text 20 | else: 21 | print(f"Request for {file_path} failed with status code {response.status_code}") 22 | except requests.exceptions.RequestException as e: 23 | print(f"Request for {file_path} failed with error {e}") 24 | results[file_path] = None 25 | return results 26 | 27 | def convert_to_hyproxy(json_string): 28 | try: 29 | data = json.loads(json_string) 30 | server = data.get('server') 31 | auth = data.get('auth') 32 | tls = data.get('tls') 33 | insecure = tls.get('insecure') if tls else False 34 | sni = tls.get('sni') if tls else None 35 | location = get_physical_location(server) 36 | 37 | hyproxy_string = f"hy2://{auth}@{server}/?insecure={int(insecure)}" 38 | if sni: 39 | hyproxy_string += f"&sni={sni}" 40 | if location: 41 | hyproxy_string += f"#{location}" 42 | 43 | return hyproxy_string 44 | 45 | except json.JSONDecodeError as e: 46 | print(f"Error decoding JSON: {e}") 47 | return None 48 | 49 | def convert_to_hysteria(json_string): 50 | try: 51 | json_data = json.loads(json_string) 52 | location = get_physical_location(json_data['server']) 53 | hysteria_string = f"hysteria://{json_data['server']}/?insecure=1&peer={json_data['server_name']}&auth={json_data['auth_str']}&upmbps={json_data['up_mbps'] * 5}&downmbps={json_data['down_mbps'] * 2}&alpn={json_data['alpn']}#{location}" 54 | return hysteria_string 55 | except json.JSONDecodeError as e: 56 | print(f"Error decoding JSON: {e}") 57 | return None 58 | 59 | def convert_to_all(content): 60 | try: 61 | data = yaml.safe_load(content) 62 | server_info = data['proxies'][0] 63 | # if server_info['type'].startswith("hysteria"): 64 | # return None 65 | # all_string = f"hysteria://{server_info['server']}:{server_info['port']}/?auth={server_info['auth-str']}&upmbps={server_info['up'].split(' ')[0]}&downmbps={server_info['down'].split(' ')[0]}&alpn={server_info['alpn'][0]}#{get_physical_location(server_info['server'])}" 66 | if server_info['type'].startswith("hysteria2"): 67 | all_string = f"hy2://{server_info['password']}@{server_info['server']}:{server_info['port']}/?insecure=1&sni={server_info['sni']}#{get_physical_location(server_info['server'])}" 68 | elif server_info['type'].startswith("tuic"): 69 | all_string = f"tuic://{server_info['uuid']}:{server_info['password']}@{server_info['server']}:{server_info['port']}/?congestion_control={server_info['congestion-controller']}&udp_relay_mode={server_info['udp-relay-mode']}&alpn={server_info['alpn'][0]}&allow_insecure=1#{get_physical_location(server_info['server'])}" 70 | else: 71 | return None 72 | return all_string 73 | 74 | except json.JSONDecodeError as e: 75 | print(f"Error: {e}") 76 | return None 77 | 78 | def get_physical_location(address): 79 | address = re.sub(':.*', '', address) # 用正则表达式去除端口部分 80 | try: 81 | ip_address = socket.gethostbyname(address) 82 | except socket.gaierror: 83 | ip_address = address 84 | 85 | try: 86 | reader = geoip2.database.Reader('GeoLite2-City.mmdb') # 这里的路径需要指向你自己的数据库文件 87 | response = reader.city(ip_address) 88 | country = response.country.name 89 | city = response.city.name 90 | return f"{country}, {city}" 91 | except geoip2.errors.AddressNotFoundError as e: 92 | print(f"Error: {e}") 93 | return "Unknown" 94 | 95 | 96 | # 示例用法 97 | username = "Alvin9999" 98 | repository = "pac2" 99 | file_paths = ["hysteria2/config.json", "hysteria2/1/config.json", "hysteria2/13/config.json", "hysteria2/2/config.json", "hysteria/config.json", "hysteria/1/config.json", "hysteria/13/config.json", "hysteria/2/config.json","clash.meta2/config.yaml","clash.meta2/1/config.yaml","clash.meta2/13/config.yaml","clash.meta2/2/config.yaml","clash.meta2/15/config.yaml","clash.meta2/3/config.yaml",] 100 | pac_list = [] 101 | results = fetch_github_files(username, repository, file_paths) 102 | for file_path, content in results.items(): 103 | if file_path.startswith("hysteria2"): 104 | pac_list.append(convert_to_hyproxy(content)) 105 | elif file_path.startswith("hysteria"): 106 | pac_list.append(convert_to_hysteria(content)) 107 | else: 108 | pac_list.append(convert_to_all(content)) 109 | filtered_pac_list = [item for item in pac_list if item is not None] 110 | with open('hy2pac.txt','w') as f: 111 | f.write('\n'.join(filtered_pac_list)) 112 | current_time = datetime.now() 113 | with open(f"update_time.txt", 'w') as a: 114 | a.write(current_time.strftime("%Y-%m-%d %H:%M:%S")) 115 | -------------------------------------------------------------------------------- /nekoray_g6NZqPlsZX.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markbang/chromegopacs/1a249616412d8439d2c9a54c85770ed5f432d6d4/nekoray_g6NZqPlsZX.webp -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | requests 2 | geoip2 3 | pyyaml -------------------------------------------------------------------------------- /test.py: -------------------------------------------------------------------------------- 1 | import yaml 2 | import requests 3 | # 读取 .yaml 文件 4 | response = requests.get("https://raw.githubusercontent.com/Alvin9999/pac2/master/clash.meta2/2/config.yaml") 5 | response.encoding = 'utf-8' 6 | data = yaml.safe_load(response.text) 7 | print(data) 8 | # 构建 `hysteria` URL 9 | server_info = data['proxies'][0] 10 | if server_info['type'].startswith("hysteria"): 11 | 12 | url = f"hysteria://{server_info['server']}:{server_info['port']}/?auth={server_info['auth-str']}&upmbps={server_info['up'].split(' ')[0]}&downmbps={server_info['down'].split(' ')[0]}&alpn={server_info['alpn'][0]}" 13 | 14 | # 打印构建的 `hysteria` URL 15 | print(url) 16 | -------------------------------------------------------------------------------- /update_time.txt: -------------------------------------------------------------------------------- 1 | 2024-10-10 14:24:25 --------------------------------------------------------------------------------