about summary refs log tree commit diff stats
path: root/internal/server/tls.go
diff options
context:
space:
mode:
authorAlan Pearce2024-06-28 16:54:42 +0200
committerAlan Pearce2024-06-28 16:54:42 +0200
commite29149ae9b0cd31f38beb38b0f4ea4e1599f4d93 (patch)
tree40f9f63157ad14d953a900f0971791c874c0a1ce /internal/server/tls.go
parent5dcf04d83605f5cfe1bf83c0a4c296bae47c3365 (diff)
downloadwebsite-e29149ae9b0cd31f38beb38b0f4ea4e1599f4d93.tar.lz
website-e29149ae9b0cd31f38beb38b0f4ea4e1599f4d93.tar.zst
website-e29149ae9b0cd31f38beb38b0f4ea4e1599f4d93.zip
use socket passing also for TLS
Diffstat (limited to 'internal/server/tls.go')
-rw-r--r--internal/server/tls.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/server/tls.go b/internal/server/tls.go
index f538f88..565958f 100644
--- a/internal/server/tls.go
+++ b/internal/server/tls.go
@@ -2,11 +2,11 @@ package server
 
 import (
 	"context"
-	"crypto/tls"
 	"crypto/x509"
 	"net"
 	"net/http"
 	"strconv"
+	"website/internal/listenfd"
 	"website/internal/log"
 
 	"github.com/ardanlabs/conf/v3"
@@ -95,8 +95,8 @@ func (s *Server) serveTLS() (err error) {
 	tlsConfig := cfg.TLSConfig()
 	tlsConfig.NextProtos = append([]string{"h2", "http/1.1"}, tlsConfig.NextProtos...)
 
-	sln, err := tls.Listen(
-		"tcp",
+	sln, err := listenfd.GetListenerTLS(
+		0,
 		net.JoinHostPort(s.runtimeConfig.ListenAddress, strconv.Itoa(s.runtimeConfig.TLSPort)),
 		tlsConfig,
 	)
@@ -104,8 +104,8 @@ func (s *Server) serveTLS() (err error) {
 		return errors.Wrap(err, "could not bind tls socket")
 	}
 
-	ln, err := net.Listen(
-		"tcp",
+	ln, err := listenfd.GetListener(
+		1,
 		net.JoinHostPort(s.runtimeConfig.ListenAddress, strconv.Itoa(s.runtimeConfig.Port)),
 	)
 	if err != nil {