[PR #1513] [CLOSED] [ASSIGN CUSTOM IP] optionally assign a custom ip when registering a m… #2158

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

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/1513
Author: @lembq
Created: 7/24/2023
Status: Closed

Base: mainHead: assign-custom-ip


📝 Commits (1)

  • 0db30e1 [ASSIGN CUSTOM IP] optionally assign a custom ip when registering a machine

📊 Changes

8 files changed (+70 additions, -5 deletions)

View changed files

📝 cmd/headscale/cli/nodes.go (+16 -1)
📝 gen/go/headscale/v1/machine.pb.go (+11 -2)
📝 gen/openapiv2/headscale/v1/headscale.swagger.json (+6 -0)
📝 hscontrol/db/machine.go (+32 -2)
📝 hscontrol/grpcv1.go (+2 -0)
📝 hscontrol/oidc.go (+1 -0)
📝 hscontrol/types/machine.go (+1 -0)
📝 proto/headscale/v1/machine.proto (+1 -0)

📄 Description

We are using headscale on a daily basis and wanted to see if we can register machines with custom ip addresses in our tailscale network. After a quick google search we found the request for custom ips (#1455 enhancement). I implemented a possible solution for this request, where we can optionally assign a static IPv4 address to a machine when it is being registered in headscale. Without specifiying the ip flag in the registration command headscales works like previously. If one uses the ip flag the IPv4 address is custom but the IPv6 address will be generated like before (sequentially). No OIDC support yet.

I tested this locally with docker and 2 peers but I did not add integration/unit tests.

I did not create a separate commit for the gen stuff, i hope it is still readable and easy to review. There is only a pretty small change in the gen files (added ip attr).

I would be really happy to receive any feedback. I am open to any suggestions on how i could improve this feature.

  • 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/1513 **Author:** [@lembq](https://github.com/lembq) **Created:** 7/24/2023 **Status:** ❌ Closed **Base:** `main` ← **Head:** `assign-custom-ip` --- ### 📝 Commits (1) - [`0db30e1`](https://github.com/juanfont/headscale/commit/0db30e14724ae13d7037dff561a01b00b681bbb4) [ASSIGN CUSTOM IP] optionally assign a custom ip when registering a machine ### 📊 Changes **8 files changed** (+70 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `cmd/headscale/cli/nodes.go` (+16 -1) 📝 `gen/go/headscale/v1/machine.pb.go` (+11 -2) 📝 `gen/openapiv2/headscale/v1/headscale.swagger.json` (+6 -0) 📝 `hscontrol/db/machine.go` (+32 -2) 📝 `hscontrol/grpcv1.go` (+2 -0) 📝 `hscontrol/oidc.go` (+1 -0) 📝 `hscontrol/types/machine.go` (+1 -0) 📝 `proto/headscale/v1/machine.proto` (+1 -0) </details> ### 📄 Description We are using headscale on a daily basis and wanted to see if we can register machines with custom ip addresses in our tailscale network. After a quick google search we found the request for custom ips (#1455 enhancement). I implemented a possible solution for this request, where we can optionally assign a static IPv4 address to a machine when it is being registered in headscale. Without specifiying the ip flag in the registration command headscales works like previously. If one uses the ip flag the IPv4 address is custom but the IPv6 address will be generated like before (sequentially). No OIDC support yet. I tested this locally with docker and 2 peers but I did not add integration/unit tests. I did not create a separate commit for the gen stuff, i hope it is still readable and easy to review. There is only a pretty small change in the gen files (added ip attr). I would be really happy to receive any feedback. I am open to any suggestions on how i could improve this feature. <!-- 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. --> <!-- 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 - [ ] updated documentation if needed - [ ] 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:01 +01:00
adam closed this issue 2025-12-29 03:20:01 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#2158