Skip to content

Conversation

asmit27rai
Copy link

@asmit27rai asmit27rai commented Sep 1, 2025

Overview

This PR adds IPv6 coverage to all existing transport integration tests in transport_test.go. Each transport configuration now has two test cases: one for IPv4 (127.0.0.1) and one for IPv6 (::1). This ensures libp2p’s transports are tested on both IP versions and prevents regressions in IPv6 environments.

Changes

  • File Modified: p2p/test/transport/transport_test.go
  • New Test Cases:
    • TCP / Noise / Yamux (IPv6)
    • TCP / TLS / Yamux (IPv6)
    • TCP-Shared / TLS / Yamux (IPv6)
    • TCP-Shared-WithMetrics / TLS / Yamux (IPv6)
    • TCP-WithMetrics / TLS / Yamux (IPv6)
    • WebSocket-Shared (IPv6)
    • WebSocket-Secured-Shared (IPv6)
    • WebSocket (IPv6)
    • WebSocket-Secured (IPv6)
    • QUIC (IPv6)
    • QUIC-CustomReuse (IPv6)
    • WebTransport (IPv6)
    • WebTransport-CustomReuse (IPv6)
    • WebRTC (IPv6)

Test

go test ./p2p/test/transport -v | grep IPv6

Output:

    --- PASS: TestReadWriteDeadlines/TCP_/_Noise_/_Yamux_(IPv6) (0.05s)
        --- PASS: TestReadWriteDeadlines/TCP_/_Noise_/_Yamux_(IPv6)/ReadDeadline (0.01s)
        --- PASS: TestReadWriteDeadlines/TCP_/_Noise_/_Yamux_(IPv6)/WriteDeadline (0.01s)
        --- PASS: TestReadWriteDeadlines/TCP_/_Noise_/_Yamux_(IPv6)/SetDeadline (0.02s)
            --- PASS: TestReadWriteDeadlines/TCP_/_Noise_/_Yamux_(IPv6)/SetDeadline/Read (0.01s)
            --- PASS: TestReadWriteDeadlines/TCP_/_Noise_/_Yamux_(IPv6)/SetDeadline/Write (0.01s)
    --- PASS: TestReadWriteDeadlines/TCP_/_TLS_/_Yamux_(IPv6) (0.05s)
        --- PASS: TestReadWriteDeadlines/TCP_/_TLS_/_Yamux_(IPv6)/ReadDeadline (0.01s)
        --- PASS: TestReadWriteDeadlines/TCP_/_TLS_/_Yamux_(IPv6)/WriteDeadline (0.01s)

Fixes: #2510

@asmit27rai
Copy link
Author

@MarcoPolo Please Review This Pull Request.

@aspiringsecurity
Copy link

@asmit27rai : Wish to ask if the PR has been tested locally.

Please attend the upcoming libp2p calls. We will work out a clear plan on ensuring we are meeting the requisite needs in reference to go-libp2p. CCing @dhuseby.

@asmit27rai
Copy link
Author

@asmit27rai : Wish to ask if the PR has been tested locally.

Please attend the upcoming libp2p calls. We will work out a clear plan on ensuring we are meeting the requisite needs in reference to go-libp2p. CCing @dhuseby.

Yes. I Tested It Locally.
I Got This:

go test ./p2p/test/transport -v | grep IPv6

Output:

    --- PASS: TestReadWriteDeadlines/TCP_/_Noise_/_Yamux_(IPv6) (0.05s)
        --- PASS: TestReadWriteDeadlines/TCP_/_Noise_/_Yamux_(IPv6)/ReadDeadline (0.01s)
        --- PASS: TestReadWriteDeadlines/TCP_/_Noise_/_Yamux_(IPv6)/WriteDeadline (0.01s)
        --- PASS: TestReadWriteDeadlines/TCP_/_Noise_/_Yamux_(IPv6)/SetDeadline (0.02s)
            --- PASS: TestReadWriteDeadlines/TCP_/_Noise_/_Yamux_(IPv6)/SetDeadline/Read (0.01s)
            --- PASS: TestReadWriteDeadlines/TCP_/_Noise_/_Yamux_(IPv6)/SetDeadline/Write (0.01s)
    --- PASS: TestReadWriteDeadlines/TCP_/_TLS_/_Yamux_(IPv6) (0.05s)
        --- PASS: TestReadWriteDeadlines/TCP_/_TLS_/_Yamux_(IPv6)/ReadDeadline (0.01s)
        --- PASS: TestReadWriteDeadlines/TCP_/_TLS_/_Yamux_(IPv6)/WriteDeadline (0.01s)

@aspiringsecurity

@asmit27rai
Copy link
Author

@aspiringsecurity I didn't able to join previous community call of libp2p. So, I just want you to please review this PR.
Please provide the google calender link for all the community calls of libp2p.

@MarcoPolo
Copy link
Collaborator

Can you debug why the CI is failing?

- Duplicate each existing transport test case with IPv6 localhost (::1) addresses
- Append (IPv6) to the test case name for clarity
- Ensure IPv6 ListenAddrStrings match the IPv4 equivalents
- Maintain existing security, muxer, and transport options for IPv6 variants
@asmit27rai asmit27rai force-pushed the add-ipv6-transport-tests branch from 6bf31c8 to 62818ea Compare September 9, 2025 12:30
@asmit27rai
Copy link
Author

@MarcoPolo Can you please test it again ?

@MarcoPolo
Copy link
Collaborator

Looks like you just skipped the test? Why does it fail in the first place? You can run these tests on your forked branch as well.

@asmit27rai
Copy link
Author

Looks like you just skipped the test? Why does it fail in the first place? You can run these tests on your forked branch as well.

You're totally correct.
The WebRTC IPv6 test failures are due to the fact that WebRTC Direct transport needs full IPv6 network stack support for ICE candidate generation. CI environments usually have incomplete IPv6 support, resulting in ICE timeouts.

I just pushed some changes please have a look.
@MarcoPolo

@MarcoPolo
Copy link
Collaborator

Please run the workflows on your branch and mark this ready for review when you have a clear understanding of the issue. Thanks!

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.

Feature request: Add IPv6 tests to transport integration tests
3 participants