feat: implement dual ipv[4-6] stack and allow newt to ipv6 hole punch - #130
Closed
kevin-gillet wants to merge 4 commits into
Closed
kevin-gillet wants to merge 4 commits into
kevin-gillet wants to merge 4 commits into
Conversation
Member
|
@kevin-gillet I am sorry I had not got to this but I was planning on taking a look and merging. Any reason you closed? |
Author
I was cleaning up all my opened PR without activity, i will reopen it then |
Member
|
Unfortunately this is now out of date with all of the new changes we are working on for 1.13 so I am going to close but I am using this as reference to work on v6 support in the new release. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Community Contribution License Agreement
By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.
Description
see newt issue #126 (base problem)
Refactored the Networking Layer for Dual-Stack Support
Problem: The core network package was the primary source of crashes. It was built exclusively for IPv4, using low-level raw sockets, manual packet building with gopacket, and IPv4-specific BPF filters. This design was fundamentally incompatible with IPv6.
Solution: The entire network/network.go file was rewritten to use standard, high-level UDP sockets (net.ListenPacket). This modern approach allows the operating system's kernel to handle the complexities of both IPv4 and IPv6 packet creation. This change simplified the code by removing the gopacket dependency and all the complex raw socket management logic.
This is a big change and i tested all my common uses-cases, but I am not sure it will not break edge cases.
Corrected Hole Punching Address Parsing
Problem: The initial hole punching logic failed because it used a simple strings.Split on colons (:) to find the port, which does not work for IPv6 addresses. It also attempted to perform DNS lookups on literal IP addresses.
Solution: Replaced the brittle string manipulation with net.SplitHostPort and added a check to correctly parse literal IP addresses without sending them to a DNS resolver.
Please see fosrl/olm#28 also, i made the same fix to prevent Olm from trying to nameresolve a litteral ipv6.
How to test?
Built with
GOOS=linux GOARCH=amd64 go build .Successfully established a full ipv6 connection from Olm to Newt