Merge remote-tracking branch 'upstream/main' into issue115

This commit is contained in:
6543 2023-02-14 04:01:02 +01:00
commit 12d9fb26cd
No known key found for this signature in database
GPG key ID: B8BE6D610E61C862
6 changed files with 50 additions and 9 deletions

View file

@ -49,7 +49,8 @@ func Serve(ctx *cli.Context) error {
mainDomainSuffix := ctx.String("pages-domain")
rawInfoPage := ctx.String("raw-info-page")
listeningHost := ctx.String("host")
listeningSSLAddress := fmt.Sprintf("%s:%d", listeningHost, ctx.Uint("port"))
listeningSSLPort := ctx.Uint("port")
listeningSSLAddress := fmt.Sprintf("%s:%d", listeningHost, listeningSSLPort)
listeningHTTPAddress := fmt.Sprintf("%s:%d", listeningHost, ctx.Uint("http-port"))
enableHTTPServer := ctx.Bool("enable-http-server")
@ -98,7 +99,7 @@ func Serve(ctx *cli.Context) error {
}
// Create listener for SSL connections
log.Info().Msgf("Listening on https://%s", listeningSSLAddress)
log.Info().Msgf("Create TCP listener for SSL on %s", listeningSSLAddress)
listener, err := net.Listen("tcp", listeningSSLAddress)
if err != nil {
return fmt.Errorf("couldn't create listener: %v", err)
@ -119,7 +120,7 @@ func Serve(ctx *cli.Context) error {
if enableHTTPServer {
// Create handler for http->https redirect and http acme challenges
httpHandler := certificates.SetupHTTPACMEChallengeServer(challengeCache)
httpHandler := certificates.SetupHTTPACMEChallengeServer(challengeCache, listeningSSLPort)
// Create listener for http and start listening
go func() {
@ -140,7 +141,7 @@ func Serve(ctx *cli.Context) error {
dnsLookupCache, canonicalDomainCache)
// Start the ssl listener
log.Info().Msgf("Start listening on %s", listener.Addr())
log.Info().Msgf("Start SSL server using TCP listener on %s", listener.Addr())
if err := http.Serve(listener, sslHandler); err != nil {
log.Panic().Err(err).Msg("Couldn't start fastServer")
}