[PR #1565] [MERGED] Add Customization Options to DERP Map entry of integrated DERP server #2185

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

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/1565
Author: @alexhalbi
Created: 9/28/2023
Status: Merged
Merged: 1/16/2024
Merged by: @kradalby

Base: mainHead: derpmap-ip-addr


📝 Commits (10+)

  • f4d2a61 Try to get derp_server IP-Address into Derpmap
  • 8b3c610 Add Derp-IP to Config and to Log Output
  • 6e734bc Added the possibility to disable the automatic creation of the integrated DERP server DERP map entry
  • 46d2890 Rename variables for custom DERP entry
  • dbbb17b Added the possibility to disable the automatic creation of the integrated DERP server DERP map entry and options to manually specify the entry content.
  • 042a049 Merge commit '46d28909893ef18f1be38d99baec4a5ecfdae617' into derpmap-ip-addr
  • 20a8dd0 Fix duplication after Merge
  • 9419fa9 Fix another duplication after Merge
  • 6093c0a Linted
  • 0155a03 executed gofumpt to preserve code formatting

📊 Changes

8 files changed (+61 additions, -27 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 config-example.yaml (+10 -0)
📝 hscontrol/app.go (+4 -2)
📝 hscontrol/db/routes.go (+1 -1)
📝 hscontrol/derp/server/derp_server.go (+4 -0)
📝 hscontrol/types/config.go (+40 -22)
📝 hscontrol/types/node.go (+1 -1)
📝 integration/general_test.go (+0 -1)

📄 Description

This Pull request adds a draft for the possibility to add the IPv4 and IPv6 address to the DERP map for the integrated DERP server.
This enables the DERP server to be reachable by clients, if they are using an Exit-Node via the DERP server and loose DNS connection.

This happens for example when restarting Headscale and the Exit-Node on the same time. It is also possible that this happens if Headscale is restarted and one of the nodes, does not reconnect successfully to the integrated DERP server and tries to communicate DNS through it.

If you take a look into the default derp map, all of them have their IPs in the list, the integrated DERP server does never have it's IP in the list.
See https://pkg.go.dev/tailscale.com/tailcfg#DERPNode for reference.

Furthermore this request adds the possibility to disable the automatic creation of the integrated DERP map entry completely and adds the possibility to use the integrated DERP server with a completely custom etry in the derp.paths.

This enables even more customization, by fully leveraging the official DERPRegion and DERPNode configuration file, which is currently overwriten.
This should also implement #1514.

https://tailscale.com/kb/1118/custom-derp-servers/#step-2-adding-derp-servers-to-your-tailnet

  • read the CONTRIBUTING guidelines
  • raised a GitHub issue or discussed it on the projects chat beforehand
  • added unit tests
  • added integration tests
  • updated documentation if needed
  • updated CHANGELOG.md

🔄 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/1565 **Author:** [@alexhalbi](https://github.com/alexhalbi) **Created:** 9/28/2023 **Status:** ✅ Merged **Merged:** 1/16/2024 **Merged by:** [@kradalby](https://github.com/kradalby) **Base:** `main` ← **Head:** `derpmap-ip-addr` --- ### 📝 Commits (10+) - [`f4d2a61`](https://github.com/juanfont/headscale/commit/f4d2a61ccb8191537959839cee4dbe2ac4df0444) Try to get derp_server IP-Address into Derpmap - [`8b3c610`](https://github.com/juanfont/headscale/commit/8b3c610661c81cddfadae20af5f56427911fd906) Add Derp-IP to Config and to Log Output - [`6e734bc`](https://github.com/juanfont/headscale/commit/6e734bc864abc13f8d608cb7e566611bf9593b2f) Added the possibility to disable the automatic creation of the integrated DERP server DERP map entry - [`46d2890`](https://github.com/juanfont/headscale/commit/46d28909893ef18f1be38d99baec4a5ecfdae617) Rename variables for custom DERP entry - [`dbbb17b`](https://github.com/juanfont/headscale/commit/dbbb17b81e1e0db8cc9e5fffe225cdfce8f326f3) Added the possibility to disable the automatic creation of the integrated DERP server DERP map entry and options to manually specify the entry content. - [`042a049`](https://github.com/juanfont/headscale/commit/042a04929c116a4b2e1d0263e025057dba15e800) Merge commit '46d28909893ef18f1be38d99baec4a5ecfdae617' into derpmap-ip-addr - [`20a8dd0`](https://github.com/juanfont/headscale/commit/20a8dd0f986ac34236596f332ba9d4bbf857b4bb) Fix duplication after Merge - [`9419fa9`](https://github.com/juanfont/headscale/commit/9419fa99cd1ea2909ee4d2cf3753acaf9365c717) Fix another duplication after Merge - [`6093c0a`](https://github.com/juanfont/headscale/commit/6093c0a3f0e50708353b8e25660f3fc88486516f) Linted - [`0155a03`](https://github.com/juanfont/headscale/commit/0155a03490ba7b41e7ae90ba28fba68acb5e7cc9) executed gofumpt to preserve code formatting ### 📊 Changes **8 files changed** (+61 additions, -27 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `config-example.yaml` (+10 -0) 📝 `hscontrol/app.go` (+4 -2) 📝 `hscontrol/db/routes.go` (+1 -1) 📝 `hscontrol/derp/server/derp_server.go` (+4 -0) 📝 `hscontrol/types/config.go` (+40 -22) 📝 `hscontrol/types/node.go` (+1 -1) 📝 `integration/general_test.go` (+0 -1) </details> ### 📄 Description <!-- Headscale is "Open Source, acknowledged contribution", this means that any contribution will have to be discussed with the Maintainers before being submitted. This model has been chosen to reduce the risk of burnout by limiting the maintenance overhead of reviewing and validating third-party code. Headscale is open to code contributions for bug fixes without discussion. If you find mistakes in the documentation, please submit a fix to the documentation. --> This Pull request adds a draft for the possibility to add the IPv4 and IPv6 address to the DERP map for the integrated DERP server. This enables the DERP server to be reachable by clients, if they are using an Exit-Node via the DERP server and loose DNS connection. This happens for example when restarting Headscale and the Exit-Node on the same time. It is also possible that this happens if Headscale is restarted and one of the nodes, does not reconnect successfully to the integrated DERP server and tries to communicate DNS through it. If you take a look into the [default derp map](https://login.tailscale.com/derpmap/default), all of them have their IPs in the list, the integrated DERP server does never have it's IP in the list. See https://pkg.go.dev/tailscale.com/tailcfg#DERPNode for reference. Furthermore this request adds the possibility to disable the automatic creation of the integrated DERP map entry completely and adds the possibility to use the integrated DERP server with a completely custom etry in the `derp.paths`. This enables even more customization, by fully leveraging the official [DERPRegion](https://pkg.go.dev/tailscale.com/tailcfg#DERPRegion) and [DERPNode](https://pkg.go.dev/tailscale.com/tailcfg#DERPNode) configuration file, which is currently overwriten. This should also implement #1514. https://tailscale.com/kb/1118/custom-derp-servers/#step-2-adding-derp-servers-to-your-tailnet <!-- Please tick if the following things apply. You… --> - [X] read the [CONTRIBUTING guidelines](README.md#contributing) - [X] raised a GitHub issue or discussed it on the projects chat beforehand - [ ] added unit tests - [ ] added integration tests - [X] updated documentation if needed - [x] updated CHANGELOG.md <!-- If applicable, please reference the issue using `Fixes #XXX` and add tests to cover your new code. --> --- <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:20:08 +01:00
adam closed this issue 2025-12-29 03:20:08 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#2185