├── .github └── workflows │ └── main.yml ├── GetRoutes.py └── README.md /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Build and Package 2 | 3 | on: 4 | schedule: 5 | - cron: 0 0 * * * 6 | workflow_dispatch: 7 | # release: 8 | # types: [published] 9 | 10 | jobs: 11 | build_and_package: 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - name: Checkout Repository 16 | uses: actions/checkout@v3.5.3 17 | 18 | - name: Install Python 19 | uses: actions/setup-python@v4.7.0 20 | with: 21 | python-version: 3.8 22 | 23 | - name: Run GetRoutes.py 24 | run: python3 GetRoutes.py 25 | 26 | - name: Archive 27 | run: zip -r acl.zip routes.acl Country.mmdb 28 | 29 | 30 | - name: Upload Release Asset 31 | uses: svenstaro/upload-release-action@2.5.0 32 | with: 33 | repo_token: ${{ secrets.GITHUB_TOKEN }} 34 | tag: ${{ github.ref }} 35 | file: acl.zip 36 | asset_name: acl.zip 37 | prerelease: true 38 | overwrite: true 39 | -------------------------------------------------------------------------------- /GetRoutes.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | import re 3 | import urllib.request 4 | from datetime import date,datetime 5 | 6 | start = datetime.now() 7 | print(f'{date.today().strftime("%B %d, %Y")},Loading...\n') 8 | urllib.request.urlretrieve( 9 | 'https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country.mmdb', './Country.mmdb' 10 | ) 11 | 12 | domain_direct = urllib.request.urlopen( 13 | 'https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/direct.txt' 14 | ) 15 | 16 | domain_ad = urllib.request.urlopen( 17 | 'https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/reject.txt' 18 | ) 19 | domain_proxy = urllib.request.urlopen( 20 | 'https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/proxy.txt' 21 | ) 22 | 23 | a = re.compile(r'([a-z]|[0-9]|[A-Z])(.*[a-z]|[A-Z])') 24 | 25 | with open('routes.acl', 'w') as f: 26 | f.write('# Author:github.com/A1-hub\n# hysteria acl routes\n# Generated on %s\n\n' % 27 | date.today().strftime("%B %d, %Y")) 28 | sumc = 0 29 | 30 | count = 0 31 | for ad in domain_ad: 32 | rad = str(ad, 'UTF8').strip() 33 | m = re.search(a, rad).group() 34 | if m != 'payload': 35 | count += 1 36 | f.write('block domain-suffix %s\n' % m) 37 | print(f'Block rules: {count} done.') 38 | sumc += count 39 | 40 | count = 0 41 | for direct in domain_direct: 42 | rdirect = str(direct, 'UTF8').strip() 43 | m = re.search(a, rdirect).group() 44 | if m != 'payload': 45 | count += 1 46 | f.write('direct domain-suffix %s\n' % m) 47 | print(f'Direct rules: {count} done.') 48 | sumc += count 49 | 50 | count = 0 51 | for proxy in domain_proxy: 52 | rproxy = str(proxy, 'UTF8').strip() 53 | m = re.search(a,rproxy).group() 54 | if m !='payload' : 55 | count += 1 56 | f.write('proxy domain-suffix %s\n' % m) 57 | print(f'Proxy rules: {count} done.') 58 | sumc += count 59 | 60 | print('\nAll rules:', str(sumc)) 61 | 62 | f.write('direct country cn\n') 63 | f.write('proxy all') 64 | f.close() 65 | end = datetime.now() 66 | print(f'\nUse: {(end-start).seconds}s\nGenerate completed!') 67 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 如想使用最新的Hysteria2,推荐使用甬哥新出的[sing-box-yg脚本](https://github.com/yonggekkk/sing-box-yg) 2 | 3 | ------------------------------------------------------------- 4 | 5 | ### Hysteria多功能一键脚本,支持范围端口及多端口复用、四模式IP优先级切换 6 | 7 | ### 支持纯IPV4、纯IPV6的VPS直接安装,主流linux系统均支持 8 | 9 | ### 相关说明及注意点请查看[博客说明](https://ygkkk.blogspot.com/2022/11/hysteria-yg-youtube.html) 10 | 11 | ### 一键脚本: 12 | ``` 13 | wget -N https://gitlab.com/rwkgyg/hysteria-yg/raw/main/hysteria.sh && bash hysteria.sh 14 | ``` 15 | 16 | 17 | 18 | --------------------------------------------------------------------------------