Skip to content

Commit

Permalink
Use TLS port from config (#155)
Browse files Browse the repository at this point in the history
* Move first call into for

* Use TLS port from config

Instead of hardcoded 443

* Update credits
  • Loading branch information
maxcanna authored Nov 28, 2021
1 parent 451c0d4 commit 3ac2fa3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -508,3 +508,4 @@ Thanks to these users for contributing or helping this project in any way
* [Brennan Kinney](https://github.com/polarathene)
* [Agneev](https://github.com/agneevX)
* [Eidenschink](https://github.com/eidenschink/)
* [Massimiliano Cannarozzo](https://github.com/maxcanna/)
9 changes: 4 additions & 5 deletions plugins/souin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ func souinPluginInitializerFromConfiguration(c *configuration.Configuration) *so
return retriever
}

func startServer(config *tls.Config) (net.Listener, *http.Server) {
func startServer(config *tls.Config, port string) (net.Listener, *http.Server) {
server := http.Server{
Addr: ":443",
Addr: ":"+port,
Handler: nil,
TLSConfig: config,
}
listener, err := tls.Listen("tcp", ":443", config)
listener, err := tls.Listen("tcp", ":"+port, config)
if err != nil {
fmt.Println(err)
}
Expand Down Expand Up @@ -96,11 +96,10 @@ func main() {
})
})
go func() {
listener, _ := startServer(tlsConfig)
for {
listener, _ := startServer(tlsConfig, c.DefaultCache.Port.TLS)
<-configChannel
_ = listener.Close()
listener, _ = startServer(tlsConfig)
}
}()

Expand Down

0 comments on commit 3ac2fa3

Please sign in to comment.