diff options
author | Alan Pearce | 2024-06-24 17:18:27 +0200 |
---|---|---|
committer | Alan Pearce | 2024-06-24 17:18:27 +0200 |
commit | 50456c578497e9921558941eae59fa01bcf269bf (patch) | |
tree | c2520d354a789c50bffbf3bf961dc2a6e6b47659 /internal/server/tcp.go | |
parent | e6dd1b5f719ea483f5e77f78c045224607707d0a (diff) | |
download | website-50456c578497e9921558941eae59fa01bcf269bf.tar.lz website-50456c578497e9921558941eae59fa01bcf269bf.tar.zst website-50456c578497e9921558941eae59fa01bcf269bf.zip |
handle TLS in server with ACME
Diffstat (limited to 'internal/server/tcp.go')
-rw-r--r-- | internal/server/tcp.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/internal/server/tcp.go b/internal/server/tcp.go new file mode 100644 index 0000000..4dc3314 --- /dev/null +++ b/internal/server/tcp.go @@ -0,0 +1,27 @@ +package server + +import ( + "net" + + "website/internal/listenfd" + "website/internal/log" + + "github.com/pkg/errors" +) + +func (s *Server) serveTCP() error { + l, err := listenfd.GetListener(0) + if err != nil { + log.Warn("could not create listener from listenfd", "error", err) + } + + log.Debug("listener from listenfd?", "passed", l != nil) + if l == nil { + l, err = net.Listen("tcp", s.Addr) + if err != nil { + return errors.Wrap(err, "could not create listener") + } + } + + return s.Serve(l) +} |