libp2p / go-libp2p-examples

Example libp2p applications
MIT License
338 stars 145 forks source link

dial attempt failed: <peer.ID Qm*oYtu85> --> <peer.ID Qm*k8syvm> dial attempt failed: connection refused #41

Closed hktalent closed 5 years ago

hktalent commented 5 years ago
1、in my nat lan host(A)
http-proxy

p2p Key,like
abcdef999999

2、my remoute pc host(B)
#./http-proxy -d /ip4/127.0.0.1/tcp/12000/ipfs/abcdef999999
Proxy server is ready
libp2p-peer addresses:
/p2p-circuit/ipfs/abcdef999999
/ip4/127.0.0.1/tcp/12001/ipfs/abcdef999999
proxy listening on  127.0.0.1:9900

3、test
#curl -x "127.0.0.1:9900" "http://ipfs.io/ipfs/abcdef999999"
dial attempt failed: <peer.ID Qm*oYtu85> --> <peer.ID Qm*k8syvm> dial attempt failed: connection refused

local server err
proxying request for http://ipfs.io/ipfs/abcdef999999 to peer abcdef999999
2019/01/07 12:55:39 dial attempt failed: <peer.ID Qm*7Uecfu> --> <peer.ID Qm*k8syvm> dial attempt failed: connection refused

curl -x "127.0.0.1:9900" http://172.17.1.2:80/

proxying request for http://172.17.1.2:80/ to peer abcdef999999
2019/01/07 12:57:34 dial backoff
anacrolix commented 5 years ago

I think you have the peers reversed. The invocation of http-proxy with -d should be the local one accessed by curl. That instance must be able to access the gateway instance of http-proxy. I'm not sure what your network configuration is, but it seems unlikely that you could access the remote host's http-proxy's localhost address in the example you've provided.

hktalent commented 5 years ago

@anacrolix
I am accessing host(A) from host(B) so,run "http-proxy" get the p2p key("abcdef999999") from my host,use the key "abcdef999999"