Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

dht functionality #1857

@yonderblue

Description

@yonderblue
  • Version:
    feat/dht-part-ii branch (b0acc71)
  • Platform:
    mac/linux
  • Subsystem:
    dht

I just used browserify directly on a little example while having the feat/dhs-part-ii branch checked out.

So now my index.js looks like

'use strict'

const IPFS = require('ipfs')
const Protector = require('libp2p-pnet')

const swarmKey = Buffer.from("/key/swarm/psk/1.0.0/\n/base16/\nTHEKEY")

const node = new IPFS({
	repo: String(Math.random() + Date.now()),
	relay: {
		enabled: true,
		hop: {enabled: true}
	}, 
	preload: {enabled: false},
	libp2p2: {
		modules: {
			connProtector: new Protector(swarmKey)
		}
	},
	config: {
		Bootstrap: ["/ip4/IP_TO_A_GOLANG_NODE/tcp/9443/ws/ipfs/THE_PEER_ID"]
	}
})

node.once('ready', function() {
	console.log('IPFS node is ready')
	
	window.node = node

	node.dht.findPeer('THE_PEER_ID')
})

However I always get Error: Peer lookup failed from that last line.
Also even trying to do a node.get('THE_PEER_FILE_HASH') just hangs, even though that peers is in the node.swarm.peers() (only one since its the bootstrap).
If I take out the swarm key and connect to public network, the findPeer doesn't fail but always returns nothing, same with findProvs etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High: Likely tackled by core team if no one steps upexp/expertHaving worked on the specific codebase is importantkind/bugA bug in existing code (including security flaws)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions