diff options
| author | tjpcc <tjp@ctrl-c.club> | 2023-10-10 16:53:51 -0600 |
|---|---|---|
| committer | tjpcc <tjp@ctrl-c.club> | 2023-10-10 16:53:51 -0600 |
| commit | 365b6bd5319cde40b5cf34b73d01e0fe5755d92e (patch) | |
| tree | ccf0b05ef06baa70902db3c680b2a269d4b202ae | |
| parent | 38a195c6e62dfebed3c0c642ec9e3fcc89516097 (diff) | |
support server TLS in gopher and finger
fixes #8
| -rw-r--r-- | finger.go | 12 | ||||
| -rw-r--r-- | go.mod | 2 | ||||
| -rw-r--r-- | go.sum | 4 | ||||
| -rw-r--r-- | gopher.go | 12 |
4 files changed, 27 insertions, 3 deletions
@@ -24,6 +24,18 @@ func buildFingerServer(server Server, config *Configuration) (sr.Server, error) return nil, fmt.Errorf("finger server must have 1 route directive, found %d", len(server.Routes)) } + if server.TLS != nil { + return finger.NewTLSServer( + context.Background(), + "", + "tcp", + addr, + logging.LogRequests(info)(fingerHandler(server.Routes[0])), + errlog, + server.TLS, + ) + } + return finger.NewServer( context.Background(), "", @@ -4,7 +4,7 @@ go 1.21.0 require ( github.com/go-kit/log v0.2.1 - tildegit.org/tjp/sliderule v1.4.2-0.20231010204754-04449ed66e42 + tildegit.org/tjp/sliderule v1.4.2-0.20231010225006-0a7e966d5a09 tildegit.org/tjp/syw v0.9.2 ) @@ -10,7 +10,7 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -tildegit.org/tjp/sliderule v1.4.2-0.20231010204754-04449ed66e42 h1:KkbiQO/kIxwABGqhocShHvehchDuGyQzvhV61SKfhO8= -tildegit.org/tjp/sliderule v1.4.2-0.20231010204754-04449ed66e42/go.mod h1:opdo8E25iS9X9pNismM8U7pCH8XO0PdRIIhdADn8Uik= +tildegit.org/tjp/sliderule v1.4.2-0.20231010225006-0a7e966d5a09 h1:dHtliQ1QrIDDO4T2Z6cQSih69p8M2SKCi5b4q9SzrTE= +tildegit.org/tjp/sliderule v1.4.2-0.20231010225006-0a7e966d5a09/go.mod h1:opdo8E25iS9X9pNismM8U7pCH8XO0PdRIIhdADn8Uik= tildegit.org/tjp/syw v0.9.2 h1:bwLRXJqC5RHes2dfntgePHYnh6iIQC9FZpFBTReemQ0= tildegit.org/tjp/syw v0.9.2/go.mod h1:Oo05KA7QibiXxoPh5jzpKUq/RG4U3nz7qs6QVitZw8I= @@ -20,6 +20,18 @@ func buildGopherServer(server Server, config *Configuration) (sr.Server, error) _, info, _, errlog := Loggers(config) _ = info.Log("msg", "starting gopher server", "addr", addr) + if server.TLS != nil { + return gopher.NewTLSServer( + context.Background(), + server.Hostnames[0], + "tcp", + addr, + logging.LogRequests(info)(routes(server)), + errlog, + server.TLS, + ) + } + return gopher.NewServer( context.Background(), server.Hostnames[0], |
