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

Add an embedded DERP server to Headscale #388

Merged
merged 35 commits into from
Mar 8, 2022
Merged

Add an embedded DERP server to Headscale #388

merged 35 commits into from
Mar 8, 2022

Conversation

juanfont
Copy link
Owner

@juanfont juanfont commented Mar 3, 2022

This series of commits will be adding an embedded DERP server (and STUN) to Headscale,
thus making it completely self-contained and not dependent in other infrastructure.

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

juanfont added 6 commits March 4, 2022 00:01
This series of commit will be adding an embedded DERP server (and STUN) to Headscale,
thus making it completely self-contained and not dependant in other infrastructure.
Copy link
Collaborator

@kradalby kradalby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having embedded in the names everywhere is quite a cognitive load, we only have one DERP implementation, and it is the embedded one, so might as well just call it DERP everywhere?

h.DERPHandler

h.DERPProbeHandler

h.DERPBootstrapDNSHandler

app.go Outdated Show resolved Hide resolved
app.go Outdated Show resolved Hide resolved
cmd/headscale/cli/utils.go Outdated Show resolved Hide resolved
derp_embedded.go Outdated Show resolved Hide resolved
derp_embedded.go Outdated Show resolved Hide resolved
cmd/headscale/cli/utils.go Outdated Show resolved Hide resolved
app.go Outdated Show resolved Hide resolved
app.go Outdated Show resolved Hide resolved
Dockerfile.tailscale Outdated Show resolved Hide resolved
Comment on lines +123 to +128
ServerEnabled bool
ServerRegionID int
ServerRegionCode string
ServerRegionName string
STUNEnabled bool
STUNAddr string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we split this into DERPServerConfig and DERPSTUNConfig ?

At some point I want to have a go at getting rid of all the manual reading of options from viper, I think it can do that...

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe look into using HCL struct based parsing?


# If enabled, also listens in the configured address for STUN connections to help on NAT traversal
# For more details on how this works, check this great article: https://tailscale.com/blog/how-tailscale-works/
stun:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could possible call out that this is UDP, so people know what to open in firewall.

integration_common_test.go Outdated Show resolved Hide resolved
@@ -0,0 +1,18 @@
-----BEGIN CERTIFICATE-----
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we need to know the expiry of this

)
assert.Nil(t, err)
log.Printf("Result for %s: %s\n", hostname, result)
assert.Contains(t, result, "via DERP")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we verify the correct derp?

@kradalby
Copy link
Collaborator

kradalby commented Mar 8, 2022

This seems finished, but needs some linting and a changelog entry.

@juanfont juanfont marked this pull request as ready for review March 8, 2022 11:21
@juanfont juanfont changed the title [WIP] Add an embedded DERP server to Headscale Add an embedded DERP server to Headscale Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants