一种另类离线下载的思路(免费)(同时适用于 GIT 仓库克隆)

2017-04-15 13:23:43 +08:00
 codehz

我们知道国内好多提供离线下载的站都已经炸掉了,而且现有能用的支持离线下载的网盘也是限制很大。。。

百度云的限速就不提了。

我们也知道国内 github 的 clone 是比较蛋疼的事情,即使挂了梯子,对于比较大的仓库,比如动辄几个 G 的 linux 内核, Chromium 之类的,也不一定能一次性 clone 完毕(然而 git 不支持断点续传)

我最近想到了一个另类的方法,利用网络上现有的免费服务,为我们离线下载。。

先看看回传的速度(我这网速 20 兆)

这个速度还是可以接受的吧。。

方法就是利用各种提供 Docker 构建的云的构建服务,直接把需要的文件的下载方式写在 Dockerfile 里,然后就是启动构建,构建完成后直接下载最顶层的镜像即可。。。对于 git clone 来说,要么写子模块,要么直接写 git clone 命令

这个方法最大的优势就是免费,而且不违反任何能查阅到的 EULA/ToS ,而且,有些国内的构建平台有海外构建节点,用来 clone github 上的仓库是最适合不过的了。不过即使没有,我们还是可以直接使用 docker.io 的资源的:国内有一堆 docker 加速服务

缺陷就是速度比较慢——因为文件要经过好多节点才能到达目的地,先是海外构建节点,然后是国内的 regisity ,最后才是你的电脑。。。

至于如何下载 docker 的镜像,除了 docker pull 之外,还有很多选择——毕竟 docker 的协议是开放的,随便写一个客户端就可以获取到下载地址和 token...

PS :用来搞 BT 下载的就算了,好多海外机房是禁止 BT 的,出现问题可能导致服务商服务中断,到时候势必会对其他用户产生影响,我们要的是合理利用,不要竭泽而渔。。。

PPS :到时候我搞一个自动化工具来做这个。。

6354 次点击
所在节点    程序员
43 条回复
zsj950618
2017-04-15 13:43:03 +08:00
反正我可以说,如果被发现用 USTC 的 docker.io 代理做这个事情,我会直接封 ip
codehz
2017-04-15 13:50:37 +08:00
@zsj950618 直接走 docker.io 官方的也比 git clone 靠谱,至少可以断点续传。。所以即使国内全部禁用(使用的人多了,必然会这样),这个方法依旧是有效的。。。
momocraft
2017-04-15 14:05:55 +08:00
真是不容易..
reus
2017-04-15 14:14:11 +08:00
滥用就是违反 tos
jccg90
2017-04-15 14:16:14 +08:00
感觉像是在滥用啊。。。玩烂了大家都不方便了。。。自己开个 vps 中转一下比较好吧,妥妥的满速。。。
codehz
2017-04-15 14:42:16 +08:00
@jccg90 这个思路绝对不是我第一个想出来的。。。 docker.io 上好多意义不明(拉取次数个位数,无执行语句,无任何有效软件安装,但是有很多明显不属于项目的大文件)的镜像。。说明这类用法已经玩烂了,只是没人明面说出来而已
imn1
2017-04-15 14:55:10 +08:00
看到最后都没提供一个带尾巴的免费 url ,差评
codehz
2017-04-15 15:09:01 +08:00
@imn1 我只是分享思路,不提供服务,按这个思路去做后果自负🙃
loopio
2017-04-15 15:20:02 +08:00
讲真,国内 git clone 速度感人。为了省事还是用 vps 。写个自动同步的脚本,再打包压缩放在网站目录下。用 http 下载速度都在 3M/s 以上。
pagxir
2017-04-15 16:39:09 +08:00
没必要,因为我网络
1 网速够快
2 tcp 连接可以断点恢复,类似 quic 。
3 再不济也可以利用国外的 vps 打包,然后 HTTP 下载。
v1024
2017-04-15 17:38:56 +08:00
怪不得那么多好服务都对国人敬而远之
TJT
2017-04-15 17:41:12 +08:00
git clone 不是可以用代理么, clone 的时候记得加上 --depth 1 就好,没有 checkout 旧版本的需求的话。
codehz
2017-04-15 17:48:16 +08:00
@TJT 用了代理,速度跑满然后中途挂掉了。。。。。一直都是--depth 1 ,但是对于这样规模的项目,该挂的还是挂。。。。。我们这网络一直都不太稳定,即使是国内的大文件下载,如果不支持断点续传,还是有几率会挂。。。。。
t123yh
2017-04-15 17:50:42 +08:00
@codehz 开 kcptun ,可以避免。
loading
2017-04-15 17:59:32 +08:00
这种事别人都是私底下做的,你写成教程就是罪人!
phrack
2017-04-15 18:11:43 +08:00
有些国人就是爱吸血,以吸死宿主吸肥自己为己任。

那么多好服务用不了,也许真是不配,遭殃了那些看不懂套路的人。
netfee
2017-04-15 18:32:39 +08:00
不明觉厉。但是觉得楼主这么做不妥。网上“免费”的资源,也不该这么滥用。
codehz
2017-04-15 18:41:08 +08:00
@phrack 法无禁止则可为,在 Docker.io 的 ToS 中明确指出了使用 docker.io 的服务是有硬限制和软限制的,超出限制有权终止服务,本文提到的这种方法中并不存在任何试图绕过这些限制的方法,因此使用这个方法是否超出使用范围取决于使用者,你要是觉得这个不合理,你去修改 ToS 就好了
相关 ToS 条款
2.3 You agree not to (a) access (or attempt to access) the administrative interface of the Service by any means other than through the interface that is provided by Docker in connection with the Service, unless you have been specifically allowed to do so in a separate agreement with Docker, or (b) engage in any activity that interferes with or disrupts the Service (or the servers and networks which are connected to the Service).(是否会干扰 Docker.io 提供服务取决于下载内容有无违禁内容)
3.3 You agree that you are responsible for your own conduct while accessing or using the Service and for any consequences thereof. You agree to use the Service only for purposes that are legal, proper and in accordance with these Terms and any applicable laws or regulations. By way of example, and not as a limitation, you may not and may not allow any third party to:(还是违法内容的相关条例,以及禁止 P2P 连接,取决于使用者)
ryd994
2017-04-15 21:48:20 +08:00
@codehz You agree to use the Service only for purposes that are legal, proper
这个真的叫 proper ?
codehz
2017-04-15 22:19:29 +08:00
@ryd994 你准备怎么定义恰当?还是贴完整一点的吧,上面只是顶部一小部分
3.3 You agree that you are responsible for your own conduct while accessing or using the Service and for any consequences thereof. You agree to use the Service only for purposes that are legal, proper and in accordance with these Terms and any applicable laws or regulations. By way of example, and not as a limitation, you may not and may not allow any third party to:

a. Send, upload, distribute or disseminate or offer to do the same with respect to any unlawful, defamatory, harassing, abusive, fraudulent, obscene, or otherwise objectionable content;传播违禁内容

b. Distribute viruses, worms, defects, Trojan horses, corrupted files, hoaxes, or any other items of a destructive or deceptive nature;分发危害性内容

c. Impersonate another person (via the use of an email address or otherwise) or otherwise misrepresent yourself or the source of any content;模仿他人或者伪造内容来源

d. Upload, post, transmit or otherwise make available through the Service any content that infringes any patent, trademark, copyright, trade secret or other proprietary right of any party, unless you are the owner of such rights or have the permission of the owner to post such content;侵犯专利权

e. Download any content posted by another user that you know, or reasonably should know, that cannot be legally distributed in such manner;下载不能合法分发的内容

f. Submit content that falsely expresses or implies that such content is sponsored or endorsed by Docker;提交暗示由 docker 赞同的内容

g. Use the Service to violate the legal rights (such as rights of privacy and publicity) of others;使用本服务侵犯他人权利

h. Promote or encourage illegal activity;鼓励非法活动

i. Interfere with other users' enjoyment of the Service;干扰其他用户

j. Exploit the Service for any unauthorized commercial purpose;未经授权的商业利用

k. Modify, adapt, translate, or reverse engineer any portion of the Service;修改或者逆向工程

l. Remove any copyright, trademark or other proprietary rights notices contained in or on the Service or any content posted thereon;移除版权商标等按要求必须保留的内容

m. Reformat or frame any portion of the web pages that are part of the Service's administration display;把服务管理页面重新格式化

n. Use the Service in connection with illegal peer-to-peer file sharing;使用 P2P 文件分享服务

o. Display any content on the Service that contains any hate-related or violent content or contains any other material, products or services that violate or encourage conduct that would violate any criminal laws, any other applicable laws, or any third party rights;显示任何暴力 /仇恨相关的内容

p. Use any robot, spider, site search/retrieval application, or other device to retrieve or index any portion of the Service or the content posted thereon or to collect information about its users for any unauthorized purpose;使用爬虫

q. Create user accounts by automated means or under false or fraudulent pretenses; or 自动化 /虚假方式创建用户

r. Use the Service, or any interfaces provided with the Service, to access any Docker product or service in a manner that violates the Terms or other terms and conditions for use of such Docker product or service.使用本服务或者本服务提供的接口进行违反本条例或者其他 Docker 服务条款的行为

在构建过程中下载其他合法资源,本来就是正常构建过程的一部分, docker 并没有限定镜像的除了违法用途以外的用途(它可没说镜像只能拿来运行,况且 docker 并没有提供运行环境),你一定要说它不恰当,那请给出“恰当”的定义,并且确保这个定义是广泛认可的

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/355056

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX