feat(install): resolve GEO assets via GitHub mirror proxy#254
Merged
Conversation
mihomo 默认从 raw.githubusercontent.com 下载 GEO 数据库 (https://github.com/MetaCubeX/mihomo/blob/Meta/config/config.go#L570-L575), 在大部分国内网络环境下无法获取,导致启动失败。 复现方式: cat >/tmp/geosite-test.yaml <<'YAML' mixed-port: 7890 allow-lan: false mode: rule log-level: debug proxies: [] proxy-groups: [] rules: - GEOSITE,cn,DIRECT YAML /root/clash/runtime/bin/mihomo -t -f /tmp/geosite-test.yaml -d /root/clash/runtime 报错: INFO Start initial configuration in progress INFO Geodata Loader mode: memconservative INFO Geosite Matcher implementation: succinct INFO Can't find GeoSite.dat, start download ERRO can't initial GeoSite: can't download GeoSite.dat: Get "https://release-assets.githubusercontent.com/...": context deadline exceeded ERRO rules[0] [GEOSITE,cn,DIRECT] error: can't download GeoSite.dat: context deadline exceeded configuration file /tmp/geosite-test.yaml test failed 新增 resolve_geo_assets 在安装阶段通过 GitHub 镜像池预下载全部 GEO 资产 到 RUNTIME_DIR,避免 mihomo 启动时因网络不通而失败。 资产列表对齐 mihomo GeoXUrl 默认值: Country.mmdb / geoip.metadb / GeoLite2-ASN.mmdb / GeoIP.dat / GeoSite.dat - 复用 copy_bundled_asset 优先从 resources/geo/ 复制 - 本地不存在时通过 download_file 走 default_github_mirror_pool 镜像加速 - copy_bundled_asset 增加 $RESOURCE_DIR/$category/$file 搜索路径
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mihomo 默认从 raw.githubusercontent.com 下载 GEO 数据库
(https://github.com/MetaCubeX/mihomo/blob/Meta/config/config.go#L570-L575), 在部分国内网络环境下无法获取,导致启动失败。
复现方式 「在不可达github的时候可以复现」:
报错:
新增 resolve_geo_assets 在安装阶段通过 GitHub 镜像池预下载全部 GEO 资产 到 RUNTIME_DIR,避免 mihomo 启动时因网络不通而失败。
资产列表对齐 mihomo GeoXUrl 默认值:
Country.mmdb / geoip.metadb / GeoLite2-ASN.mmdb / GeoIP.dat / GeoSite.dat