Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move components in separate packages #1371

Closed
uhthomas opened this issue Apr 21, 2023 · 4 comments
Closed

chore: move components in separate packages #1371

uhthomas opened this issue Apr 21, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@uhthomas
Copy link

Hey!

I'd like to a discussion on whether it would be desirable to refactor some of the code located at the root of the project into packages. The upstream tailscale repository makes extensive use of packages and it might be nice to do the same here.

Why

  • Moving these files from the root of the repository could make make the project a little be "cleaner" and allow for more obvious separation of concerns (i.e what is/isn't related to the API?).
  • It might also be nice to move some of the html templates from static Go strings to HTML files embedded with //go:embed, as they would be more discoverable and easier to edit.
  • There are currently 78 files, 48 of which are Go files, at the root of the repository. Reducing this number may make the repository easier to quickly view.

Just quickly, some ideas on what could move where:

  • noise.go could move into a package noise. It has a single dependency on the Headscale struct but should be otherwise safe to move around.

  • machine.go could move into its own package.

  • integration tests could move into their own package as not to pollute the main API package.

  • swagger.go has no dependency on headscale at all and should be fine to live in its own package.

  • utils.go could be split into multiple packages as it seems to cover quite a wide surface area.

... etc.


What are your thoughts? Happy to lead this if you're interested, or we can close this an forget about it if not.

@uhthomas uhthomas added the bug Something isn't working label Apr 21, 2023
@juanfont
Copy link
Owner

@uhthomas hey, first and foremost, thanks for offering to help :)

@kradalby and I have talked about this exact same topic already a couple of times, and we are planning an in-person meeting in the next few weeks to iterate faster in some stuff - including this.

We can have a talk on other topics that need help, if you would like to :)

@uhthomas
Copy link
Author

uhthomas commented May 2, 2023

Cool! Glad we're aligned with the direction of this project! Let me know what I can do to help :)

@almereyda
Copy link

Is this superseded by #1473, or will it pick up from there?

@kradalby
Copy link
Collaborator

Superseded, I'm going to close this, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants