GithubHelp home page GithubHelp logo

dhtspider's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dhtspider's Issues

Problem

Hey,作者你好,我这段时间在研究dht爬虫,自己也写了一个,效果不是很好,就准备down下来大神的源码看一看,运行的过程中出了一些问题,不知道是不是我的环境不对?请教
-------------------- 分割线 上面是废话---------------------
问题:拿到代码跑了一晚上之后,发现输出的全部都是unensure的infohash,即get_peers 返回的infohash,announce_peer 一次也没有,所以很纳闷。这是我的问题,希望作者可以解答一下

关于协议标准bep_0005的实现

根据bep_0005规定,响应findNode的res中r的id应为

 {"id" : "<queried nodes id>", "nodes" : "<compact node info>"}

而在你的源码中在响应其他的节点的findNode请求时,返回的不是自己节点的id

onFindNodeRequest(message, address) {
  const {t: tid, a: {id: nid, target: infohash}} = message

    if (tid === undefined || target.length != 20 || nid.length != 20) {
        return
    }

    this.send({
        t: tid,
        y: 'r',
        r: {
            id: Node.neighbor(nid, this.table.id),// 这里穿的参数为何不是this.table.id
            nodes: Node.encodeNodes(this.table.first())
        }
    }, address)
}

根据你源码中的实现,this.table.id为你这个节点的id,Node.neighbor方法传入2个参数,取第一个参数的前6个,和第2个参数的后14位,将id重组。

源码中类似的实现也很多,请问为何这样实现,要变化返回的id?

虽然说重点信息应该是nodes字段中前8个‘有用’的node信息(ip和port),节点的id本身并不重要。

另外想延伸的讨论一下node的id在dht中扮演的角色,node的id是不是并没有太大的用处,因为重要的是节点中维护的table中的其他可用的node的ip和port。

如果有说错的地方请指出,谢谢回复

运行sample报错

报错内容

const {Table, Node} = require('./table')
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (/Users/long/gopath/src/github.com/alanyang/dhtspider/sample/index.js:3:21)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
执行命令 :node index.js

node版本

node --version
v5.9.1

Complete Guide about How to make it working?

Hi,
Is there possible to make a complete guide about how to make it working like on your sample website?
I mean, I did make it running and listening on port 6339, then i see scrolling hashes like this: https://vgy.me/AsjRDT.jpg , then what im supposed to do after?

I hope to get an answer, thank you!

does not work.

if I start the sample I get:

lib/spider.js:6
const {Table, Node} = require('./table')
^

SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object. (/home/zibri/dhtspider/sample/index.js:3:21)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.