Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: 1)增加 safe360 DNS,并将 usa 重命名为 cloudflare;2)为部分域名预设IP;3)PIP加速中,新增两个镜像。 #312

Merged
merged 26 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a26d9cb
优化github.com的IP查询
cuicanmengxing May 10, 2024
94557ce
Create build-and-release.yml
cuicanmengxing May 10, 2024
bbc397a
Update build-and-release.yml
cuicanmengxing May 10, 2024
9c23af0
Update https.js
cuicanmengxing May 10, 2024
b7033a4
Update build-and-release.yml
cuicanmengxing May 10, 2024
2a780fa
Update build-and-release.yml
cuicanmengxing May 10, 2024
0d9a1ad
Update build-and-release.yml
cuicanmengxing May 10, 2024
e21aef3
Update build-and-release.yml
cuicanmengxing May 10, 2024
0f5f1a3
Update build-and-release.yml
cuicanmengxing May 10, 2024
47695f5
Update build-and-release.yml
cuicanmengxing May 10, 2024
cda2e4b
Update build-and-release.yml
cuicanmengxing May 10, 2024
61f732b
Update build-and-release.yml
cuicanmengxing May 10, 2024
d65f348
Update build-and-release.yml
cuicanmengxing May 10, 2024
5460fd4
Update build-and-release.yml
cuicanmengxing May 10, 2024
d7ca3f9
Update build-and-release.yml
cuicanmengxing May 10, 2024
d7ea4cf
Update https.js
cuicanmengxing May 10, 2024
c6651c0
delete
cuicanmengxing May 10, 2024
89254af
误删
cuicanmengxing May 10, 2024
1a41eca
Update index.js
cuicanmengxing May 10, 2024
c0f5c32
超级优化
cuicanmengxing May 12, 2024
1e42110
修复语法
cuicanmengxing May 12, 2024
9e58ed3
Update package.json
cuicanmengxing May 12, 2024
37b229c
错误修复和hub.docker.com的IP预设
cuicanmengxing May 12, 2024
9782492
拦截collector.github.com
cuicanmengxing May 12, 2024
f4888f8
Update https.js
cuicanmengxing May 12, 2024
6af96e2
Merge remote-tracking branch 'upstream/master'
wangliang181230 Jul 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/core/src/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ module.exports = {
server: 'https://dns.alidns.com/dns-query',
cacheSize: 1000
},
usa: {
cloudflare: {
type: 'https',
server: 'https://1.1.1.1/dns-query',
cacheSize: 1000
Expand All @@ -291,6 +291,11 @@ module.exports = {
server: 'https://9.9.9.9/dns-query',
cacheSize: 1000
},
safe360: {
type: 'https',
server: 'https://doh.360.cn/dns-query',
cacheSize: 1000
},
rubyfish: {
type: 'https',
server: 'https://rubyfish.cn/dns-query',
Expand Down Expand Up @@ -320,7 +325,7 @@ module.exports = {
enabled: true,
interval: 300000,
hostnameList: ['github.com'],
dnsProviders: ['usa', 'quad9', 'rubyfish']
dnsProviders: ['safe360', 'cloudflare', 'rubyfish']
}
}
},
Expand Down
6 changes: 6 additions & 0 deletions packages/gui/src/view/pages/plugin/pip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
<a-radio-button value="https://mirrors.aliyun.com/pypi/simple/">
aliyun镜像
</a-radio-button>
<a-radio-button value="https://mirrors.bfsu.edu.cn/pypi/web/simple">
北京外国语大学镜像
</a-radio-button>
<a-radio-button value="https://mirror.nju.edu.cn/pypi/web/simple">
南京大学镜像
</a-radio-button>
</a-radio-group>
<div class="form-help">设置后立即生效,即使关闭ds也会继续保持</div>
</a-form-item>
Expand Down
45 changes: 44 additions & 1 deletion packages/mitmproxy/src/lib/dns/https.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,57 @@ module.exports = class DNSOverHTTPS extends BaseDNS {
}

async _lookup (hostname) {
// 直接判断域名是否为example.com
if (hostname === 'github.com') {
log.info('域名github.com使用内置IP集')
// 返回预设的IP地址集
return ['140.82.114.4', '20.87.245.0', '20.27.177.113', '20.205.243.166', '20.248.137.48', '140.82.121.3', '140.82.116.4', '20.200.245.247', '20.26.156.215', '140.82.113.3', '140.82.121.4', '20.201.28.151']
}
// 直接判断域名是否为example.com
if (hostname === 'api.github.com') {
log.info('域名api.github.com使用内置IP集')
// 返回预设的IP地址集
return ['20.87.245.6', '140.82.112.5', '140.82.116.6', '20.26.156.210', '20.200.245.245', '20.27.177.116', '20.248.137.49', '20.201.28.148', '140.82.113.6', '20.205.243.168', '140.82.121.6']
}
if (hostname === 'codeload.github.com') {
log.info('域名codeload.github.com使用内置IP集')
// 返回预设的IP地址集
return ['20.27.177.114', '140.82.116.10', '140.82.114.10', '20.26.156.216', '20.87.245.7', '20.200.245.246', '20.248.137.55', '20.205.243.165', '20.201.28.149', '140.82.121.9', '140.82.113.9']
}
if (hostname.match(/.*\.githubusercontent\.com$/)) {
log.info('域名githubusercontent及其子域使用内置IP集')
// 返回预设的IP地址集
return ['185.199.111.133', '185.199.108.133', '185.199.109.133', '185.199.110.133']
}
if (hostname === 'github.githubassets.com') {
log.info('域名github.githubassets.com使用内置IP集')
// 返回预设的IP地址集
return ['185.199.110.154', '185.199.111.154', '185.199.109.154', '185.199.108.154']
}
if (hostname === 'collector.github.com') {
log.info('域名collector.github.com已根据AdGuard DNS filter规则拦截')
// 返回预设的IP地址集
return ['0.0.0.0']
}
if (hostname === 'github.io') {
log.info('域名github.io使用内置IP集')
// 返回预设的IP地址集
return ['185.199.108.153', '185.199.109.153', '185.199.111.153', '185.199.110.153']
}
if (hostname === 'hub.docker.com') {
log.info('域名hub.docker.com使用内置IP集')
// 返回预设的IP地址集
return ['54.156.140.159', '52.44.227.212', '44.221.37.199']
}

try {
const result = await dohQueryAsync({ url: this.dnsServer }, [{ type: 'A', name: hostname }])
if (result.answers.length === 0) {
// 说明没有获取到ip
log.info('该域名没有ip地址解析:', hostname)
return []
}
const ret = result.answers.filter(item => { return item.type === 'A' }).map(item => { return item.data })
const ret = result.answers.filter(item => item.type === 'A').map(item => item.data)
if (ret.length === 0) {
log.info('该域名没有IPv4地址解析:', hostname)
} else {
Expand Down