[PR #1390] [CLOSED] Send peer deltas in MapResponse #2078

Closed
opened 2025-12-29 03:19:40 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/1390
Author: @kev-the-dev
Created: 4/28/2023
Status: Closed

Base: mainHead: kev-the-dev/peer-delta


📝 Commits (1)

📊 Changes

8 files changed (+282 additions, -36 deletions)

View changed files

📝 CHANGELOG.md (+3 -0)
📝 hscontrol/api_common.go (+90 -22)
hscontrol/api_common_test.go (+146 -0)
📝 hscontrol/machine.go (+14 -0)
📝 hscontrol/protocol_common_poll.go (+5 -2)
📝 hscontrol/protocol_common_utils.go (+7 -1)
📝 integration/general_test.go (+15 -10)
📝 integration/tsic/tsic.go (+2 -1)

📄 Description

Summary

Implement the sending of peer list deltas in MapResponse, rather then sending the full list each time. Newer versions of tailscale support this, but it had not yet been implemented in Headscale and was left as a TODO. Sending peer list deltas reduces data usage of the control protocol, especially for larger tailnets.

This also fixes a known bug described in #1383, where a peer would not be removed from the network if it is deleted and there are only 2 peers in the network.

This is implemented in a way intended to later be expanded to other deltas being sent in MapResponse. It introduces a new struct mapResponseStreamState that is forwarded to sequential calls to generate a MapResponse. Over time, this struct can evolve to track more state to move more of the MapResponse to supporting the deltas.

Closes #1383

Testing

This was tested locally by creating a small tailnet with 2 peers, and deleting one to verify that the other peer is notified of the deleted peer.

CI unit and integration tests should give reasonable assurance of no other regressions with this change.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/juanfont/headscale/pull/1390 **Author:** [@kev-the-dev](https://github.com/kev-the-dev) **Created:** 4/28/2023 **Status:** ❌ Closed **Base:** `main` ← **Head:** `kev-the-dev/peer-delta` --- ### 📝 Commits (1) - [`bb6969d`](https://github.com/juanfont/headscale/commit/bb6969d8150abf688d61885de2294373612390a3) Send peer deltas ### 📊 Changes **8 files changed** (+282 additions, -36 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+3 -0) 📝 `hscontrol/api_common.go` (+90 -22) ➕ `hscontrol/api_common_test.go` (+146 -0) 📝 `hscontrol/machine.go` (+14 -0) 📝 `hscontrol/protocol_common_poll.go` (+5 -2) 📝 `hscontrol/protocol_common_utils.go` (+7 -1) 📝 `integration/general_test.go` (+15 -10) 📝 `integration/tsic/tsic.go` (+2 -1) </details> ### 📄 Description # Summary Implement the sending of peer list deltas in MapResponse, rather then sending the full list each time. Newer versions of tailscale support this, but it had not yet been implemented in Headscale and was left as a TODO. Sending peer list deltas reduces data usage of the control protocol, especially for larger tailnets. This also fixes a known bug described in #1383, where a peer would not be removed from the network if it is deleted and there are only 2 peers in the network. This is implemented in a way intended to later be expanded to other deltas being sent in MapResponse. It introduces a new struct `mapResponseStreamState` that is forwarded to sequential calls to generate a MapResponse. Over time, this struct can evolve to track more state to move more of the MapResponse to supporting the deltas. Closes #1383 # Testing This was tested locally by creating a small tailnet with 2 peers, and deleting one to verify that the other peer is notified of the deleted peer. CI unit and integration tests should give reasonable assurance of no other regressions with this change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 03:19:40 +01:00
adam closed this issue 2025-12-29 03:19:40 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#2078