mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-27 12:05:26 +00:00
Change the http listener
This commit is contained in:
parent
bfc6f6e0eb
commit
59e48993f2
9
app.go
9
app.go
@ -608,15 +608,22 @@ func (h *Headscale) Serve() error {
|
|||||||
WriteTimeout: 0,
|
WriteTimeout: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var httpListener net.Listener
|
||||||
if tlsConfig != nil {
|
if tlsConfig != nil {
|
||||||
httpServer.TLSConfig = tlsConfig
|
httpServer.TLSConfig = tlsConfig
|
||||||
|
httpListener, err = tls.Listen("tcp", h.cfg.Addr, tlsConfig)
|
||||||
|
} else {
|
||||||
|
httpListener, err = net.Listen("tcp", h.cfg.Addr)
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to bind to TCP address: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
errorGroup := new(errgroup.Group)
|
errorGroup := new(errgroup.Group)
|
||||||
|
|
||||||
errorGroup.Go(func() error { return grpcSocket.Serve(socketListener) })
|
errorGroup.Go(func() error { return grpcSocket.Serve(socketListener) })
|
||||||
errorGroup.Go(func() error { return grpcServer.Serve(grpcListener) })
|
errorGroup.Go(func() error { return grpcServer.Serve(grpcListener) })
|
||||||
errorGroup.Go(func() error { return httpServer.ListenAndServe() })
|
errorGroup.Go(func() error { return httpServer.Serve(httpListener) })
|
||||||
|
|
||||||
log.Info().
|
log.Info().
|
||||||
Msgf("listening and serving (multiplexed HTTP and gRPC) on: %s", h.cfg.Addr)
|
Msgf("listening and serving (multiplexed HTTP and gRPC) on: %s", h.cfg.Addr)
|
||||||
|
Loading…
Reference in New Issue
Block a user