通用下载组件

    两年前开始业余做一个产品,产品中一重要的模块就是下载,搜索互联网已经有很多人在做,但是大多都是GPL协议的,而我的产品是要商业化的,作为一个职业的coder,我想还是要尊重同行,有一个高的职业道德和职业修养更为重要,于是这两年一直在写一个下载组件,这个下载组件支持HTTP、FTP、BT等各种下载方式。

    与其说是开发不如说是在集成,大致思路如下:

    1.集成CURL,使其支持ftps、https下载方式。

    2.集成libtorrent,使其支持bt下载方式。

    3.集成xmlrpc,使其支持rpc调用接口。

    4.新建一个win32项目,将所有第三方库编译为静态库,集成到一个应用程序当中来(这样做的目的是尽可能的减少文件数,以便于封装调用),然后建立统一下载接口,以RPC方式开放。

    5.新建一个dll项目,开放与RPC接口同样的导出函数,由Dll来调用RPC方式,这样应用程序只需要和dll交互即可,这样的优势是应用程序不需要再引入xmlrpc库等第三方库,免去了coder们的上手时间,也免去了浪费在研究宏定义等参数上的时间。

    6. 集成完毕后,编译为一个EXE、一个DLL,至此进入测试阶段。

    说来简单,本项目足足花了我一年多的时间,总结原因如下:

    1.每个第三方组件的文档都要仔细阅读,然后配置编译选项,然后自行编译。

    2.如此多的第三方组件难免有冲突的设置选项,解决这些冲突选项浪费了相当一部分的时间。

    3.其中引用第三方库无数,要确定每个第三方组件是否允许商用。

    目前项目已经集成完毕,进入测试,下面这个组件的特点:

    一.支持BT下载方式(集成libtorrent)以下是libttorrent特点,懒得翻译,同行看关键词便懂。

  • plugin interface for implementing custom bittorrent extensions without having to modify libtorrent
  • supports trackerless torrents (using the Mainline kademlia DHT protocol) with someDHT extensions.BEP 5.
  • supports the bittorrent extension protocol. See extensions.BEP 10.
  • supports the uTorrent metadata transfer protocolBEP 9 (i.e. magnet links).
  • supports the uTorrent peer exchange protocol (PEX).
  • supports local peer discovery (multicasts for peers on the same local network)
  • multitracker extension support (supports both strictBEP 12 and the uTorrent interpretation).
  • tracker scrapes
  • supports lt_trackers extension, to exchange trackers between peers
  • HTTP seeding, as specified inBEP 17 andBEP 19.
  • supports the udp-tracker protocol. (BEP 15).
  • supports the no_peer_id=1 extension that will ease the load off trackers.
  • supports the compact=1 tracker parameter.
  • super seeding/initial seeding (BEP 16).
  • private torrents (BEP 27).
  • upload-only extension (BEP 21).
  • support for IPv6, including BEP 7 andBEP 24.
  • support for merkle hash tree torrents. This makes the size of torrent files scale well with the size of the content.
  • share-mode. This is a special mode torrents can be put in to optimize share ratio rather than downloading the torrent.

     以上是一些扩展,更多特点参考这里http://www.rasterbar.com/products/libtorrent/features.html
     二、支持HTTP/HTTPS、FTP/SFTP下载方式

     三、支持RPC调用、支持Dll调用,支持POSIX标准命令行参数。

    最后上一张图,鼓励一下自己的劳动成果。

    

      
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值