dns: add support for Offline Usage with libp2p::SwarmBuilder with_dns
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.6k
- Forks
- 1.3k
- Avg merge
- 8h 47m
- Merged PRs (30d)
- 19
Description
Description
I was running a local build and had with_dns enabled, but I didn't have Wi-Fi in this instance, which it understandably threw me the error.
Error: Custom { kind: Other, error: ResolveError { kind: Proto(ProtoError { kind: Io(Custom { kind: Other, error: "no nameservers found in config" }) }) } }
I'd like to avoid un-commenting it if possible and just have the function with_dns downgrade back to the previous step builder phase in the small case of testing within the builder SawmBuilder with_dns within a local environment without a connection to the internet.
Motivation
- Enable offline peer-to-peer communication for nodes in environments lacking internet access, ensuring that DNS errors don't disrupt functionality.
Current Implementation
There exist not current implementation as I am aware. without commentating it in the instance to which I have no internet
let mut swarm = libp2p::SwarmBuilder::with_new_identity()
.with_tokio() // tokio runtime
.with_tcp(
tcp::Config::default(), // tcp Config defautlt
noise::Config::new,
yamux::Config::default,
)?
.with_quic() // quic, and udp on top of ip4/ip6
// .with_dns()?
.with_behaviour(|_| stream::Behaviour::new())? // stream behavioud
.with_swarm_config(|c| c.with_idle_connection_timeout(Duration::from_secs(10))) // duration of stream lasts 10 seconds until given up
.build();
Are you planning to do it yourself in a pull request?
Yes
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the libp2p::SwarmBuilder::with_dns entry point and the provided builder example, focusing on how DNS setup currently handles a missing nameserver. Verify the intended behavior in an offline environment: enabling with_dns should not prevent the builder from reaching the behaviour and build stages when DNS is unavailable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100