Skip to content

#1 add ip_bytes to Property for raw-byte IPv4 encoding - #33

Closed
VasilevNStas wants to merge 1 commit into
APN-Network:masterfrom
VasilevNStas:1
Closed

#1 add ip_bytes to Property for raw-byte IPv4 encoding#33
VasilevNStas wants to merge 1 commit into
APN-Network:masterfrom
VasilevNStas:1

Conversation

@VasilevNStas

Copy link
Copy Markdown
Contributor

Description

Property.ip (field 4) encodes the backing Node's address as a dotted string, the only IPv4 field in the four proto files that does not use raw bytes. Peer.ip, Welcome.ip, and Welcome.home all use four raw bytes in network byte order. The inconsistency forces clients to switch between two representations when correlating Property entries with Peer entries and Ping.canaries keys.

Changes

  • Adds bytes ip_bytes = 9 to the Property message, carrying the address in the same raw-byte encoding as Peer.ip.
  • Marks the existing string ip (field 4) as deprecated in its comment; it stays on the wire until all consumers — iOS, Android, Huawei, and Node — have migrated. At that point a follow-up commit can reserve field 4.
  • Updates Ping.canaries docs to reference Peer.ip or Property.ip_bytes as the address source.

Field number note

Field 9 is used instead of 8 because field 8 was assigned to sni (commit a67706a, Jun 15) after the original PR #22 was opened. Wire compatibility with PR #22's approach is preserved; only the field number changed.

Validation

No build or test infrastructure is present in the repository (see issue #3), so wire-format correctness was verified by reading all four proto files and confirming that ip_bytes = 9 does not collide with any existing or reserved field number in the Property message.

Closes #1

Property.ip (field 4) encodes the backing Node's address as a dotted
string, inconsistent with Peer.ip and Welcome.ip which use four raw
bytes in network byte order. Adds bytes ip_bytes = 9 carrying the
same encoding as Peer.ip, marks string ip as deprecated pending
migration by all consumers.

Field 9 is safe: after the addition of sni = 8 (a67706a), the next
available field in Property is 9, and no reserved ranges block it.

Closes APN-Network#1
@VasilevNStas

Copy link
Copy Markdown
Contributor Author

@yegor256 plz review

@VasilevNStas

VasilevNStas commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

@davvd

Closing as superseded. Since this PR was opened, upstream/master has evolved significantly:

  1. rtt = 3 was added to Ping — this PR deleted it (conflict)
  2. subnet/subnet6/geo were added to Welcome — this PR predates them
  3. All valuable changes from this PR are now covered by individual PRs (docs(pong): document zero-value contract for Property.ends, Peer.expires, Pong.expires #40-fix(auth)!: change timestamp to ms since Unix epoch for effective replay protection #58):
  4. The ip_bytes field is no longer needed since upstream resolved the IP representation differently via subnet/CIDR

Rebasing would revert upstream improvements. Closing in favor of the targeted PRs above.

@VasilevNStas
VasilevNStas deleted the 1 branch July 24, 2026 15:09
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.

Property.ip uses dotted string while all other IPv4 fields use raw bytes

1 participant