[PR #656] [MERGED] Drop Gin as web framework for TS2019 API #1556

Closed
opened 2025-12-29 02:30:34 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/656
Author: @juanfont
Created: 6/20/2022
Status: Merged
Merged: 6/26/2022
Merged by: @juanfont

Base: mainHead: abandon-gin


📝 Commits (10+)

  • 367da0f Remove Gin from simple endpoints for TS2019
  • d5e331a Remove Gin from OIDC callback
  • d89fb68 Switch to use gorilla's mux as muxer
  • 6c9c9a4 Remove gin from DERP server
  • e611063 Migrate platform config out of Gin
  • dedeb4c Remove Gin from the Registration handler
  • 53e5c05 Remove gin from the poll handlers
  • 396c3ec Remove Gin from the OIDC handlers
  • b0b919e Added more logging to derp server
  • dec5134 Minor status change

📊 Changes

17 files changed (+965 additions, -409 deletions)

View changed files

📝 CHANGELOG.md (+3 -0)
📝 acls.go (+1 -1)
📝 api.go (+217 -76)
📝 app.go (+104 -60)
📝 db.go (+2 -3)
📝 derp_server.go (+70 -23)
📝 flake.nix (+1 -1)
📝 go.mod (+1 -0)
📝 go.sum (+1 -0)
📝 machine.go (+2 -1)
📝 machine_test.go (+4 -1)
📝 oidc.go (+198 -58)
📝 platform_config.go (+152 -63)
📝 poll.go (+168 -106)
📝 routes_test.go (+2 -2)
📝 swagger.go (+35 -10)
📝 utils.go (+4 -4)

📄 Description

Until now, and since the very beginning of Headscale, we have used Gin (https://github.com/gin-gonic/gin) as the web framework to serve the original Tailscale API (TS2019, as opposed to Tailscale API v2 aka. TS2021).

It served (no pun intended) us well. And for many other use cases Gin is great. But while implementing TS2021 I found some weird situations where Gin was flushing or closing connections that where meant to be kept.

This PR moves all the TS2019 endpoints to plain net/http handler functions. It also switches Gin's router to gorilla/mux.


🔄 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/656 **Author:** [@juanfont](https://github.com/juanfont) **Created:** 6/20/2022 **Status:** ✅ Merged **Merged:** 6/26/2022 **Merged by:** [@juanfont](https://github.com/juanfont) **Base:** `main` ← **Head:** `abandon-gin` --- ### 📝 Commits (10+) - [`367da0f`](https://github.com/juanfont/headscale/commit/367da0fcc2a0a5a271c1509d04602516f9b92086) Remove Gin from simple endpoints for TS2019 - [`d5e331a`](https://github.com/juanfont/headscale/commit/d5e331a2fb65c62b693cd10186f469282db8a873) Remove Gin from OIDC callback - [`d89fb68`](https://github.com/juanfont/headscale/commit/d89fb68a7a717483d03ab18a90f1233a36775176) Switch to use gorilla's mux as muxer - [`6c9c9a4`](https://github.com/juanfont/headscale/commit/6c9c9a401ff5112103160868cbae0526c65e34d5) Remove gin from DERP server - [`e611063`](https://github.com/juanfont/headscale/commit/e611063669e1bd3e5085957894a95b2d55fc3cf7) Migrate platform config out of Gin - [`dedeb4c`](https://github.com/juanfont/headscale/commit/dedeb4c181c0b5661b6aba9caf4dfa7b67969ad6) Remove Gin from the Registration handler - [`53e5c05`](https://github.com/juanfont/headscale/commit/53e5c05b0a60a9cca9e5805e4c16325e45a6ee8d) Remove gin from the poll handlers - [`396c3ec`](https://github.com/juanfont/headscale/commit/396c3ecdf7085fecee1077d65dea388f34fe2b44) Remove Gin from the OIDC handlers - [`b0b919e`](https://github.com/juanfont/headscale/commit/b0b919efb02870b6644124a711666c05e466b457) Added more logging to derp server - [`dec5134`](https://github.com/juanfont/headscale/commit/dec51348e630c1567e98b44ee913051be50e1ed9) Minor status change ### 📊 Changes **17 files changed** (+965 additions, -409 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+3 -0) 📝 `acls.go` (+1 -1) 📝 `api.go` (+217 -76) 📝 `app.go` (+104 -60) 📝 `db.go` (+2 -3) 📝 `derp_server.go` (+70 -23) 📝 `flake.nix` (+1 -1) 📝 `go.mod` (+1 -0) 📝 `go.sum` (+1 -0) 📝 `machine.go` (+2 -1) 📝 `machine_test.go` (+4 -1) 📝 `oidc.go` (+198 -58) 📝 `platform_config.go` (+152 -63) 📝 `poll.go` (+168 -106) 📝 `routes_test.go` (+2 -2) 📝 `swagger.go` (+35 -10) 📝 `utils.go` (+4 -4) </details> ### 📄 Description Until now, and since the very beginning of Headscale, we have used Gin (https://github.com/gin-gonic/gin) as the web framework to serve the original Tailscale API (TS2019, as opposed to Tailscale API v2 aka. TS2021). It served (no pun intended) us well. And for many other use cases Gin is great. But while implementing TS2021 I found some weird situations where Gin was flushing or closing connections that where meant to be kept. This PR moves all the TS2019 endpoints to plain `net/http` handler functions. It also switches Gin's router to `gorilla/mux`. --- <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 02:30:34 +01:00
adam closed this issue 2025-12-29 02:30:34 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#1556