listen on all, not just localhost

This commit is contained in:
David 2020-09-16 16:11:51 -04:00
parent 1555f89305
commit 9d731726e9

View File

@ -33,7 +33,7 @@ func main() {
mime.AddExtensionType(".gemini", "text/gemini")
mime.AddExtensionType(".gmi", "text/gemini")
err := certificates.TestCertificateExists("./cert.pem", "./key.pem")
err := certificates.TestCertificateExists("./certs/cert.pem", "./certs/key.pem")
var cer tls.Certificate
if err != nil {
log.Info("Generating new certificate...")
@ -42,14 +42,14 @@ func main() {
log.Info("error generating certificates", err)
return
}
err = certificates.WriteCertsToFile("./cert.pem", "./key.pem", cert, key)
err = certificates.WriteCertsToFile("./certs/cert.pem", "./certs/key.pem", cert, key)
if err != nil {
log.Info("error saving certificates", err)
return
}
}
cer, err = tls.LoadX509KeyPair("./cert.pem", "./key.pem")
cer, err = tls.LoadX509KeyPair("./certs/cert.pem", "./certs/key.pem")
if err != nil {
log.Info("error loading certificates", err)
return
@ -60,7 +60,7 @@ func main() {
MinVersion: tls.VersionTLS12,
}
listener, err := tls.Listen("tcp", "localhost:1965", &tlsc)
listener, err := tls.Listen("tcp", ":1965", &tlsc)
if err != nil {
log.Info(err)
return