05ac21ebe4
It was moved in f57fa3cbc3.
Updates tailscale/corp#22748
Change-Id: I19f965e6bded1d4c919310aa5b864f2de0cd6220
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
30 lines
640 B
Go
30 lines
640 B
Go
// Copyright (c) Tailscale Inc & AUTHORS
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
// The servetls program shows how to run an HTTPS server
|
|
// using a Tailscale cert via LetsEncrypt.
|
|
package main
|
|
|
|
import (
|
|
"crypto/tls"
|
|
"io"
|
|
"log"
|
|
"net/http"
|
|
|
|
"tailscale.com/client/local"
|
|
)
|
|
|
|
func main() {
|
|
var lc local.Client
|
|
s := &http.Server{
|
|
TLSConfig: &tls.Config{
|
|
GetCertificate: lc.GetCertificate,
|
|
},
|
|
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
io.WriteString(w, "<h1>Hello from Tailscale!</h1> It works.")
|
|
}),
|
|
}
|
|
log.Printf("Running TLS server on :443 ...")
|
|
log.Fatal(s.ListenAndServeTLS("", ""))
|
|
}
|