Advertisement
Guest User

tls wryyyyy

a guest
Jun 30th, 2013
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.48 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.     "log"
  5.     "net/http"
  6.     "runtime"
  7. )
  8.  
  9. func handler(w http.ResponseWriter, req *http.Request) {
  10.     w.Header().Set("Content-Type", "text/plain")
  11.     w.Write([]byte("This is an example server.\n"))
  12. }
  13.  
  14. func main() {
  15.     runtime.GOMAXPROCS(runtime.NumCPU())
  16.     http.HandleFunc("/", handler)
  17.     log.Printf("About to listen on 8082. Go to https://127.0.0.1:8082/")
  18.     err := http.ListenAndServeTLS(":8082", "cert.pem", "key.pem", nil)
  19.     if err != nil {
  20.         log.Fatal(err)
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement