support server TLS in gopher and finger

fixes #8
This commit is contained in:
tjpcc 2023-10-10 16:53:51 -06:00
parent 38a195c6e6
commit 365b6bd531
4 changed files with 27 additions and 3 deletions

View File

@ -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(),
"",

2
go.mod
View File

@ -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
)

4
go.sum
View File

@ -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=

View File

@ -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],