Comments (4)
That's because of a recent change in libp2p, which enables relay by default. The code is faulty and blindly uses the first address, which happens to be a relay address.
Possible solutions:
- pass
libp2p.DisableRelay()
tolibp2p.New
to turn off relay - fix the code to be more clever about the use of addresses and don't try to dial the relay address.
edit: the simplest solution is to print all addrs in the I am ...
part, not just the first address.
from go-libp2p-examples.
That's because of a recent change in libp2p, which enables relay by default. The code is faulty and blindly uses the first address, which happens to be a relay address.
Possible solutions:
- pass
libp2p.DisableRelay()
tolibp2p.New
to turn off relay- fix the code to be more clever about the use of addresses and don't try to dial the relay address.
edit: the simplest solution is to print all addrs in the
I am ...
part, not just the first address.
it is not ok for me, when i dial other address such as 127.0.10.1, the error is:
19:53:38.817 WARNI swarm2: listen on /ip4/127.0.10.1/tcp/10000 failed: listen tcp4 127.0.10.1:10000: bind: can't assign requested address swarm_listen.go:25
19:53:38.817 WARNI swarm2: swarm listener accept error: process closing swarm_listen.go:77
2018/10/29 19:53:38 failed to listen on any addresses: [listen tcp4 127.0.10.1:10000: bind: can't assign requested address]
when i pass disableRelay() after libp2p.new, there is nothing change. And i cannot understand the the last word。
from go-libp2p-examples.
pass libp2p.DisableRelay() to libp2p.New to turn off relay
this indeed worked as I added opts = append(opts, libp2p.DisableRelay())
Thank you @vyzo
from go-libp2p-examples.
For me, this does the trick:
// Range over the addresses to find the first non relay address
for _, addr := range basicHost.Addrs() {
if strings.SplitN(addr.String(), "/", 3)[1] != "p2p-circuit" {
// Now we can build a full multiaddress to reach this host
// by encapsulating both addresses:
fullAddr := addr.Encapsulate(hostAddr)
log.Printf("I am %s\n", fullAddr)
if secio {
log.Printf("Now run \"./echo -l %d -d %s -secio\" on a different terminal\n",
listenPort+1, fullAddr)
} else {
log.Printf("Now run \"./echo -l %d -d %s\" on a different terminal\n",
listenPort+1, fullAddr)
}
}
}
Is it a realistic scenario to have a relay and not to use it?
Cheers, Stefan
from go-libp2p-examples.
Related Issues (20)
- pubsub\chat example - Can't see others clients messages HOT 1
- Relay Example error HOT 2
- pubsub chat example datarace
- how to init RendezvousString in chat-with-rendezvous? HOT 2
- How do I keep nodeID unchanged every time I start it HOT 4
- Does libP2P support authentication? HOT 1
- How can i make other peers persist when another peer disconnects HOT 2
- An Error in Echo client/server with libp2p
- Dependencies out of date
- Automated testing
- How can I help PRs get merged? HOT 2
- chat-with-rendezvous doesn't work: dht failed to query self during routing table refresh HOT 3
- Add Example on configuring and using AutoRelay
- Add example to show how to configure AutoNAT client and how it discovers reachability
- go-libp2p-autonat-svc deprecated
- libp2p-host example missing _peer import
- Should I openStream every time like multipro did
- Errors with simple libp2p HOT 1
- routed-echo example: invalid character '-' after top-level value
- Modifying http_proxy/proxy.go to make the remote proxy to act as an egress gateway to connect to a non-p2p real server. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-libp2p-examples.