Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Ipv6 network/binds #113

Merged
merged 6 commits into from
May 14, 2023
Merged

Conversation

PetrichorIT
Copy link
Contributor

This PR implements a IpNetwork configuration option, to choose between a underlying Ipv4 or Ipv6 network.
The network parameter are used for:

a) granting addresses either from a 192.168.0.0/16 address space, or from fe80:::/64
b) binding sockets to associated unspecified addresses 0.0.0.0 / :::

The default configuration stays an Ipv4 network with 192.168.0.0/16.

@mcches
Copy link
Contributor

mcches commented May 10, 2023

Thanks for submitting the PR, and sorry for the delayed response. I'm curious to hear a bit more about why you need this feature for your simulation needs.

@PetrichorIT
Copy link
Contributor Author

No problem. We were trying to develop some units tests for Axum-based APIs in a system, that for the most part does only support Ipv6 addressing. Changing the addressing either to Ipv4Addr or to IpAddr would be a lot of work and may result in changes in the systems behavior. In short, the codebase is quite large, so we would like to use the least intrusive method to simulate it, which would be Ipv6 support on sockets.

Copy link
Contributor

@mcches mcches left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making this change. The iterator for Ip is a nice idea.

src/builder.rs Outdated Show resolved Hide resolved
src/builder.rs Outdated Show resolved Hide resolved
src/config.rs Outdated Show resolved Hide resolved
src/config.rs Outdated Show resolved Hide resolved
src/dns.rs Outdated Show resolved Hide resolved
src/net/tcp/listener.rs Outdated Show resolved Hide resolved
src/net/udp.rs Outdated Show resolved Hide resolved
src/net/udp.rs Outdated Show resolved Hide resolved
src/net/udp.rs Outdated Show resolved Hide resolved
tests/ipv6.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@mcches mcches left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

src/ip.rs Outdated Show resolved Hide resolved
@mcches mcches merged commit a71fb12 into tokio-rs:main May 14, 2023
@mh32 mh32 mentioned this pull request May 23, 2023
@PetrichorIT PetrichorIT deleted the ipv6support branch July 27, 2023 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants