[Code Freeze] Restructuring the code #514

Closed
opened 2025-12-29 02:19:24 +01:00 by adam · 3 comments
Owner

Originally created by @kradalby on GitHub (May 23, 2023).

Juan and I are currently undertaking a large code refactor to make the code more maintainable.

Currently the goal is to split a lot of the code into modules, which forces us to have separate concerns and make sure that more of the code does one thing, and does it well. We had a lot of cycling dependencies (allowed by one large package) and it made everything very tightly knitted, and testing very hard as you had to set up a massive dependency chain.

Rough plan for how we want to do it:

  1. Move control go code to package hscontrol (#1444)
  2. Split "core" code into packages (types, db, policy) (#1458)
  • This is mainly a reorg change, where the code change is only to be able to move code
  • types contains all our datatypes, and functions attached to them without dependencies
  • db contains all functions that manipulate and changes the database
  • policy contains all functions related to ACLs, a big change is that it does no longer depend on db
  1. Split and potentially rewrite hscontrol into packages (this might change) (#1477)
  • mapper, all code related to generating MapResponses (the map clients need to find their peers)
  • api, the code that implements our gRPC interface (For now, leave grpc in root)
  • derp, derp related code
  • dns, related code
  1. Rewrite policy package (#1487)
  • Generate filter and ssh rules per node
  1. Rewrite polling and global state (#1492)
  2. Rename Machine to Node (#1553)
Originally created by @kradalby on GitHub (May 23, 2023). Juan and I are currently undertaking a large code refactor to make the code more maintainable. Currently the goal is to split a lot of the code into modules, which forces us to have separate concerns and make sure that more of the code does one thing, and does it well. We had a lot of cycling dependencies (allowed by one large package) and it made everything very tightly knitted, and testing very hard as you had to set up a massive dependency chain. Rough plan for how we want to do it: 1. Move control go code to package `hscontrol` (#1444) 2. Split "core" code into packages (types, db, policy) (#1458) - This is _mainly_ a reorg change, where the code change is only to be able to move code - `types` contains all our datatypes, and functions attached to them without dependencies - `db` contains all functions that manipulate and changes the database - `policy` contains all functions related to ACLs, a big change is that it does no longer depend on `db` 3. Split and potentially rewrite hscontrol into packages (this might change) (#1477) - `mapper`, all code related to generating MapResponses (the map clients need to find their peers) - ~`api`, the code that implements our gRPC interface~ (For now, leave grpc in root) - `derp`, derp related code - `dns`, related code 4. Rewrite policy package (#1487) - Generate filter and ssh rules per node 5. Rewrite polling and global state (#1492) 6. Rename Machine to Node (#1553)
adam added the enhancement label 2025-12-29 02:19:24 +01:00
adam closed this issue 2025-12-29 02:19:24 +01:00
Author
Owner

@kev-the-dev commented on GitHub (May 26, 2023):

For clarity, this issue is tagged [Code Freeze] as the maintainers will wait to merge any non-reorg changes until after the re-org? Makes sense to me but wanted to clarify

@kev-the-dev commented on GitHub (May 26, 2023): For clarity, this issue is tagged [Code Freeze] as the maintainers will wait to merge any non-reorg changes until after the re-org? Makes sense to me but wanted to clarify
Author
Owner

@kradalby commented on GitHub (May 26, 2023):

@kev-the-dev, I realise that I have not actually written that out. Thanks for asking.

Yes, we are not taking contributions at the moment.

@kradalby commented on GitHub (May 26, 2023): @kev-the-dev, I realise that I have not actually written that out. Thanks for asking. Yes, we are not taking contributions at the moment.
Author
Owner

@kradalby commented on GitHub (Sep 24, 2023):

This has been implemented, and we are preparing to get these changes out as alpha soon, closing.

@kradalby commented on GitHub (Sep 24, 2023): This has been implemented, and we are preparing to get these changes out as alpha soon, closing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#514