mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-26 17:03:06 +00:00
Merge pull request #831 from kradalby/fix-https-listen
This commit is contained in:
commit
5fe6538c02
1 changed files with 15 additions and 9 deletions
24
app.go
24
app.go
|
@ -53,8 +53,10 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
ErrFailedPrivateKey = Error("failed to read or create private key")
|
ErrFailedPrivateKey = Error("failed to read or create private key")
|
||||||
ErrFailedNoisePrivateKey = Error("failed to read or create Noise protocol private key")
|
ErrFailedNoisePrivateKey = Error(
|
||||||
ErrSamePrivateKeys = Error("private key and noise private key are the same")
|
"failed to read or create Noise protocol private key",
|
||||||
|
)
|
||||||
|
ErrSamePrivateKeys = Error("private key and noise private key are the same")
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -450,16 +452,20 @@ func (h *Headscale) createRouter(grpcMux *runtime.ServeMux) *mux.Router {
|
||||||
router.HandleFunc("/health", h.HealthHandler).Methods(http.MethodGet)
|
router.HandleFunc("/health", h.HealthHandler).Methods(http.MethodGet)
|
||||||
router.HandleFunc("/key", h.KeyHandler).Methods(http.MethodGet)
|
router.HandleFunc("/key", h.KeyHandler).Methods(http.MethodGet)
|
||||||
router.HandleFunc("/register/{nkey}", h.RegisterWebAPI).Methods(http.MethodGet)
|
router.HandleFunc("/register/{nkey}", h.RegisterWebAPI).Methods(http.MethodGet)
|
||||||
router.HandleFunc("/machine/{mkey}/map", h.PollNetMapHandler).Methods(http.MethodPost)
|
router.HandleFunc("/machine/{mkey}/map", h.PollNetMapHandler).
|
||||||
|
Methods(http.MethodPost)
|
||||||
router.HandleFunc("/machine/{mkey}", h.RegistrationHandler).Methods(http.MethodPost)
|
router.HandleFunc("/machine/{mkey}", h.RegistrationHandler).Methods(http.MethodPost)
|
||||||
router.HandleFunc("/oidc/register/{nkey}", h.RegisterOIDC).Methods(http.MethodGet)
|
router.HandleFunc("/oidc/register/{nkey}", h.RegisterOIDC).Methods(http.MethodGet)
|
||||||
router.HandleFunc("/oidc/callback", h.OIDCCallback).Methods(http.MethodGet)
|
router.HandleFunc("/oidc/callback", h.OIDCCallback).Methods(http.MethodGet)
|
||||||
router.HandleFunc("/apple", h.AppleConfigMessage).Methods(http.MethodGet)
|
router.HandleFunc("/apple", h.AppleConfigMessage).Methods(http.MethodGet)
|
||||||
router.HandleFunc("/apple/{platform}", h.ApplePlatformConfig).Methods(http.MethodGet)
|
router.HandleFunc("/apple/{platform}", h.ApplePlatformConfig).
|
||||||
|
Methods(http.MethodGet)
|
||||||
router.HandleFunc("/windows", h.WindowsConfigMessage).Methods(http.MethodGet)
|
router.HandleFunc("/windows", h.WindowsConfigMessage).Methods(http.MethodGet)
|
||||||
router.HandleFunc("/windows/tailscale.reg", h.WindowsRegConfig).Methods(http.MethodGet)
|
router.HandleFunc("/windows/tailscale.reg", h.WindowsRegConfig).
|
||||||
|
Methods(http.MethodGet)
|
||||||
router.HandleFunc("/swagger", SwaggerUI).Methods(http.MethodGet)
|
router.HandleFunc("/swagger", SwaggerUI).Methods(http.MethodGet)
|
||||||
router.HandleFunc("/swagger/v1/openapiv2.json", SwaggerAPIv1).Methods(http.MethodGet)
|
router.HandleFunc("/swagger/v1/openapiv2.json", SwaggerAPIv1).
|
||||||
|
Methods(http.MethodGet)
|
||||||
|
|
||||||
if h.cfg.DERP.ServerEnabled {
|
if h.cfg.DERP.ServerEnabled {
|
||||||
router.HandleFunc("/derp", h.DERPHandler)
|
router.HandleFunc("/derp", h.DERPHandler)
|
||||||
|
@ -479,7 +485,8 @@ func (h *Headscale) createRouter(grpcMux *runtime.ServeMux) *mux.Router {
|
||||||
func (h *Headscale) createNoiseMux() *mux.Router {
|
func (h *Headscale) createNoiseMux() *mux.Router {
|
||||||
router := mux.NewRouter()
|
router := mux.NewRouter()
|
||||||
|
|
||||||
router.HandleFunc("/machine/register", h.NoiseRegistrationHandler).Methods(http.MethodPost)
|
router.HandleFunc("/machine/register", h.NoiseRegistrationHandler).
|
||||||
|
Methods(http.MethodPost)
|
||||||
router.HandleFunc("/machine/map", h.NoisePollNetMapHandler)
|
router.HandleFunc("/machine/map", h.NoisePollNetMapHandler)
|
||||||
|
|
||||||
return router
|
return router
|
||||||
|
@ -829,9 +836,8 @@ func (h *Headscale) getTLSSettings() (*tls.Config, error) {
|
||||||
ReadTimeout: HTTPReadTimeout,
|
ReadTimeout: HTTPReadTimeout,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := server.ListenAndServe()
|
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
err := server.ListenAndServe()
|
||||||
log.Fatal().
|
log.Fatal().
|
||||||
Caller().
|
Caller().
|
||||||
Err(err).
|
Err(err).
|
||||||
|
|
Loading…
Reference in a new issue