commit 9f4ad3f08d8170f4c688645ce90f93408bae7af2 Author: stephen mcquay Date: Fri Feb 6 10:23:39 2015 -0800 init diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ee7d6a5 --- /dev/null +++ b/LICENSE @@ -0,0 +1,14 @@ + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. + diff --git a/main.go b/main.go new file mode 100644 index 0000000..6e26b7e --- /dev/null +++ b/main.go @@ -0,0 +1,32 @@ +package main + +import ( + "fmt" + "net/http" + "os" +) + +const usage = "servetls " +const port = 8443 + +func main() { + if len(os.Args) != 3 { + fmt.Fprintf(os.Stderr, "%s\n", usage) + os.Exit(1) + } + cert, key := os.Args[1], os.Args[2] + + http.HandleFunc("/", handler) + + addr := fmt.Sprintf(":%d", port) + fmt.Printf("serving on %s", addr) + err := http.ListenAndServeTLS(addr, cert, key, nil) + if err != nil { + fmt.Fprintf(os.Stderr, "%v\n", err) + os.Exit(1) + } +} + +func handler(w http.ResponseWriter, req *http.Request) { + fmt.Fprintf(w, "if you see this without complaints things are likely set up correctly\n") +}