Created
September 14, 2020 18:57
-
-
Save mchirico/9573cfd0b30b3318167461a99f2b42c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"io" | |
"log" | |
"net/http" | |
"os" | |
) | |
func main() { | |
name, err := os.Hostname() | |
if err != nil { | |
panic(err) | |
} | |
http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) { | |
io.WriteString(w, "Hello, TLS!\n") | |
}) | |
log.Printf("About to listen on 8443. Go to https://%s:8443/", name) | |
err = http.ListenAndServeTLS(":8443", "./certs/server_certificate.pem", "./certs/server_key.pem", nil) | |
log.Fatal(err) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment