Skip to content

Conversation

@adrianosela
Copy link
Contributor

@adrianosela adrianosela commented Jul 15, 2025

[ME-4826] Propagate Peer Private IP Addresses

Allows passing private ip addresses.

Summary by CodeRabbit

  • New Features
    • Enhanced peer endpoint representation with support for multiple IP addresses and ports, including IP version and interface details.
  • Refactor
    • Deprecated previous single-string endpoint fields in favor of a new structured and extensible address format.
  • Chores
    • Updated base Docker image and Go module to the latest versions.

@adrianosela adrianosela requested a review from btoonk July 15, 2025 20:21
@coderabbitai
Copy link

coderabbitai bot commented Jul 15, 2025

Walkthrough

The protobuf schema was updated to add a new repeated WireGuardEndpointAddr message with detailed endpoint information, deprecating older UDP endpoint string fields. The Go module version was updated from 1.22 to 1.23, and the Docker base image was upgraded from golang:1.23-alpine3.20 to golang:1.24-alpine3.22.

Changes

File(s) Change Summary
common/messages.proto Added WireGuardEndpointAddr message; added repeated wg_ep_addrs fields to DiscoveryDetailsMessage and WireGuardPeer; deprecated allowed_ips, public_udp4_endpoint, and public_udp6_endpoint fields with explanatory comments.
docker/go.Dockerfile, go.mod Updated Docker base image from golang:1.23-alpine3.20 to golang:1.24-alpine3.22; updated Go module version from 1.22 to 1.23.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Server

    Client->>Server: Send DiscoveryDetailsMessage (with repeated WireGuardEndpointAddr)
    Note right of Client: Each address includes iface, IP, port, STUN info
    Server-->>Client: Respond with WireGuardPeer (with repeated WireGuardEndpointAddr)
    Note left of Server: Peers use detailed endpoint addresses for traffic
Loading

Possibly related PRs

Suggested reviewers

  • pedroandrade
  • waltzofpearls
  • btoonk

Poem

🐇 From endpoints old, a new path springs,
Addresses bloom with detailed wings.
IP, port, and iface named,
Deprecated strings now tamed.
Go and Docker rise in tune,
This rabbit hops beneath the moon! 🌙✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dbc5980 and eb93c68.

⛔ Files ignored due to path filters (12)
  • common/messages.pb.go is excluded by !**/*.pb.go
  • connector/connector.pb.go is excluded by !**/*.pb.go
  • connector/connector_grpc.pb.go is excluded by !**/*.pb.go
  • device/device.pb.go is excluded by !**/*.pb.go
  • device/device_grpc.pb.go is excluded by !**/*.pb.go
  • gen/kotlin/border0/common/v1/DiscoveryDetailsMessageKt.kt is excluded by !**/gen/**
  • gen/kotlin/border0/common/v1/IPAddrPortKt.kt is excluded by !**/gen/**
  • gen/kotlin/border0/common/v1/WireGuardEndpointAddrKt.kt is excluded by !**/gen/**
  • gen/kotlin/border0/common/v1/WireGuardPeerKt.kt is excluded by !**/gen/**
  • gen/swift/connector.pb.swift is excluded by !**/gen/**
  • gen/swift/device.pb.swift is excluded by !**/gen/**
  • gen/swift/messages.pb.swift is excluded by !**/gen/**
📒 Files selected for processing (3)
  • common/messages.proto (3 hunks)
  • docker/go.Dockerfile (1 hunks)
  • go.mod (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • go.mod
  • docker/go.Dockerfile
  • common/messages.proto

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (3)
common/messages.proto (2)

79-85: Inconsistent naming style between enum values and comment block

The newly added addresses field is great, but the comment right above (// endpoint for UDP …) is now misleading because the field itself is deprecated – the comment makes it look current.

-  string public_udp4_endpoint = 6 [deprecated = true]; // endpoint for UDP peer-to-peer communication over IPv4 (public IPv4 + port as seen from the Internet)
+  string public_udp4_endpoint = 6 [deprecated = true]; // DEPRECATED – superseded by addresses

Same for public_udp6_endpoint.

Minor, but avoiding stale comments will save future confusion.


108-113: Rename ip_version or change its type to avoid ambiguity

Field ip_version is of type IPAddressType, which already encodes the version. Having both the word “version” and an enum named Type is confusing:

-  IPAddressType ip_version = 2;
+  IPAddressType ip_type = 2;

If you keep the current name, at least clarify it in a leading comment.

(Also consider bytes for ip_address; leaving as string is OK if you never need raw binary.)

docker/go.Dockerfile (1)

1-1: Pin the base image to a patch version for reproducible builds

golang:1.24-alpine3.22 floats on future 1.24.x patch releases.
Pinning to the exact patch (e.g. golang:1.24.1-alpine3.22) guarantees the same tool-chain and CVE set for every build.

-FROM golang:1.24-alpine3.22
+FROM golang:1.24.1-alpine3.22
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between af5034e and 4fc14d5.

⛔ Files ignored due to path filters (11)
  • common/messages.pb.go is excluded by !**/*.pb.go
  • connector/connector.pb.go is excluded by !**/*.pb.go
  • connector/connector_grpc.pb.go is excluded by !**/*.pb.go
  • device/device.pb.go is excluded by !**/*.pb.go
  • device/device_grpc.pb.go is excluded by !**/*.pb.go
  • gen/kotlin/border0/common/v1/DiscoveryDetailsMessageKt.kt is excluded by !**/gen/**
  • gen/kotlin/border0/common/v1/IPAddrPortKt.kt is excluded by !**/gen/**
  • gen/kotlin/border0/common/v1/WireGuardPeerKt.kt is excluded by !**/gen/**
  • gen/swift/connector.pb.swift is excluded by !**/gen/**
  • gen/swift/device.pb.swift is excluded by !**/gen/**
  • gen/swift/messages.pb.swift is excluded by !**/gen/**
📒 Files selected for processing (3)
  • common/messages.proto (3 hunks)
  • docker/go.Dockerfile (1 hunks)
  • go.mod (1 hunks)
🔇 Additional comments (1)
common/messages.proto (1)

14-19: Confirm wire-compatibility & consider reserving removed field numbers

Adding the new addresses field at tag 5 is fine, but the two deprecated fields (2, 3) are still present.
Once you actually remove them in a future revision, remember to reserved 2, 3; to avoid accidental reuse that would break binary compatibility.

No action needed now – just a heads-up for the follow-up migration.

@adrianosela adrianosela force-pushed the ME-4826_propagate_private_ip_addresses_in_discovery_msg branch 2 times, most recently from 6d768ca to ea9e51b Compare July 15, 2025 20:26
@adrianosela adrianosela requested a review from Copilot July 15, 2025 20:26

This comment was marked as outdated.

@adrianosela adrianosela force-pushed the ME-4826_propagate_private_ip_addresses_in_discovery_msg branch 2 times, most recently from efaf33b to dbc5980 Compare July 18, 2025 18:45
@adrianosela adrianosela force-pushed the ME-4826_propagate_private_ip_addresses_in_discovery_msg branch from dbc5980 to eb93c68 Compare July 19, 2025 16:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances peer endpoint representation with support for multiple IP addresses and ports, including IP version and interface details, while maintaining backward compatibility by deprecating previous single-string endpoint fields in favor of a new structured and extensible address format.

  • Introduces WireGuardEndpointAddr struct with support for STUN discovery, interface metadata, and structured endpoint information
  • Deprecates existing single endpoint fields in favor of a more comprehensive addressing system
  • Updates generated code across multiple languages (Swift, Kotlin) and toolchain versions

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
go.mod Updates Go version from 1.22 to 1.23
common/messages.proto Adds WireGuardEndpointAddr message and updates field comments for clarity
gen/swift/messages.pb.swift Updates Swift bindings with new endpoint structure and deprecation markers
gen/kotlin/border0/common/v1/WireGuardPeerKt.kt Refactors Kotlin DSL to support new endpoint addressing
gen/kotlin/border0/common/v1/WireGuardEndpointAddrKt.kt New Kotlin bindings for the endpoint address structure
docker/go.Dockerfile Updates base Docker image from golang:1.23-alpine3.20 to golang:1.24-alpine3.22
Various generated files Updates protoc version references and generated code patterns

@adrianosela adrianosela merged commit 929e96a into main Jul 19, 2025
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