Skip to content

feat: build quic addresses - #177

Merged
abergasov merged 3 commits into
mainfrom
_build_quic_addr
Jul 30, 2026
Merged

feat: build quic addresses#177
abergasov merged 3 commits into
mainfrom
_build_quic_addr

Conversation

@abergasov

@abergasov abergasov commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Added QUIC advertised-address construction for IPv4 and optional IPv6, including support for interface IPs and automatic de-duplication.
    • Introduced strict “must” behavior for QUIC address building with clear logging on invalid inputs.
  • Tests
    • Added tests covering IPv4+IPv6 generation, invalid IPv4/ports handling, acceptance of boundary ports, and resilience to malformed IPv6 while still returning IPv4 results.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: getoptimum/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5591c3fb-a9eb-4a68-854d-91f827124d83

📥 Commits

Reviewing files that changed from the base of the PR and between 8787469 and ab27092.

📒 Files selected for processing (1)
  • pkg/net/addr_advertise.go

📝 Walkthrough

Walkthrough

Adds QUIC advertised-address builders using UDP and quic-v1, with listen-port validation, optional public IPv6 handling, interface IPv4 discovery, filtering, and deduplication. Tests cover valid addresses, invalid inputs, optional IPv6 behavior, and port boundaries.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant BuildAdvertisedQUICAddresses
  participant GetInterfaceIPs
  participant slices.UniqueSlice
  Caller->>BuildAdvertisedQUICAddresses: provide public IPs and listen port
  BuildAdvertisedQUICAddresses->>GetInterfaceIPs: enumerate interface IPv4 addresses
  GetInterfaceIPs-->>BuildAdvertisedQUICAddresses: return interface addresses
  BuildAdvertisedQUICAddresses->>slices.UniqueSlice: deduplicate QUIC multiaddresses
  slices.UniqueSlice-->>BuildAdvertisedQUICAddresses: return unique addresses
  BuildAdvertisedQUICAddresses-->>Caller: return addresses or error
Loading

Suggested reviewers: hpsing, swarna1101

🚥 Pre-merge checks | ✅ 7 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title is related to the change, but it does not follow the required type(domain/pkg): summary format. Change it to the required format, for example feat(net): build QUIC addresses, with no trailing punctuation.
Over-Engineering ❓ Inconclusive placeholder pending
✅ Passed checks (7 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Scope Discipline ✅ Passed main...HEAD changes only pkg/net/addr_advertise.go and a new QUIC test; no unrelated files, deps, or drive-by refactors.
Behavior Safety ✅ Passed New QUIC helper is additive, mirrors existing TCP logic, and has focused tests for valid, invalid, and boundary cases; no existing path semantics changed.
Security ✅ Passed QUIC addresses validate ports and IPv4 via multiaddr; logs only public IP fields in structured JSON, with no secrets, creds, or weak crypto added.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch _build_quic_addr

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/net/addr_advertise_quic_test.go`:
- Around line 3-9: Update the import block in the test file to match the
repository’s gci grouping and ordering rules, keeping standard-library imports
separated from third-party imports and preserving all existing dependencies.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: getoptimum/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 200da61f-d8da-467d-aeff-0e656e5c7b13

📥 Commits

Reviewing files that changed from the base of the PR and between 9c72fb6 and 891e381.

📒 Files selected for processing (2)
  • pkg/net/addr_advertise.go
  • pkg/net/addr_advertise_quic_test.go

Comment on lines +3 to +9
import (
"testing"

"github.com/getoptimum/optimum-common/pkg/logger"
"github.com/getoptimum/optimum-common/pkg/net"
"github.com/stretchr/testify/require"
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Apply the repository’s gci import grouping.

The lint job fails on this import block, blocking CI.

Proposed fix
 import (
 	"testing"
 
 	"github.com/getoptimum/optimum-common/pkg/logger"
 	"github.com/getoptimum/optimum-common/pkg/net"
+
 	"github.com/stretchr/testify/require"
 )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import (
"testing"
"github.com/getoptimum/optimum-common/pkg/logger"
"github.com/getoptimum/optimum-common/pkg/net"
"github.com/stretchr/testify/require"
)
import (
"testing"
"github.com/getoptimum/optimum-common/pkg/logger"
"github.com/getoptimum/optimum-common/pkg/net"
"github.com/stretchr/testify/require"
)
🧰 Tools
🪛 GitHub Actions: Lint / golangci _ golangci-lint

[error] 5-5: golangci-lint reported formatting issue (gci): File is not properly formatted (gci).

🪛 GitHub Check: golangci / golangci-lint

[failure] 5-5:
File is not properly formatted (gci)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/net/addr_advertise_quic_test.go` around lines 3 - 9, Update the import
block in the test file to match the repository’s gci grouping and ordering
rules, keeping standard-library imports separated from third-party imports and
preserving all existing dependencies.

Sources: Linters/SAST tools, Pipeline failures

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds helpers in pkg/net to construct advertised QUIC-v1 multiaddrs (IPv4 required, IPv6 optional) alongside existing TCP advertised address builders, with unit tests mirroring the TCP coverage.

Changes:

  • Introduces BuildAdvertisedQUICAddresses and MustBuildAdvertisedQUICAddresses to generate /ip{4,6}/.../udp/<port>/quic-v1 multiaddrs.
  • Extends address collection to include the configured public IPs plus interface IPv4 addresses, with de-duplication.
  • Adds a dedicated test file validating valid inputs, invalid IPs, and port bounds.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/net/addr_advertise.go Adds QUIC advertised address builders (including a Must* wrapper) mirroring the existing TCP builder behavior.
pkg/net/addr_advertise_quic_test.go Adds unit tests for QUIC advertised address building, paralleling existing TCP tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/net/addr_advertise.go Outdated
Comment thread pkg/net/addr_advertise.go
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@abergasov
abergasov merged commit 0502eed into main Jul 30, 2026
7 checks passed
@abergasov
abergasov deleted the _build_quic_addr branch July 30, 2026 08:32
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.

3 participants