cmd/hello: avoid deprecated apis (#10957)

Updates #cleanup

Signed-off-by: Chris Palmer <cpalmer@tailscale.com>
pull/10980/head
Chris Palmer 4 months ago committed by GitHub
parent 13f8a669d5
commit 9744ad47e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -31,10 +31,12 @@ var (
//go:embed hello.tmpl.html //go:embed hello.tmpl.html
var embeddedTemplate string var embeddedTemplate string
var localClient tailscale.LocalClient
func main() { func main() {
flag.Parse() flag.Parse()
if *testIP != "" { if *testIP != "" {
res, err := tailscale.WhoIs(context.Background(), *testIP) res, err := localClient.WhoIs(context.Background(), *testIP)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
@ -76,7 +78,7 @@ func main() {
GetCertificate: func(hi *tls.ClientHelloInfo) (*tls.Certificate, error) { GetCertificate: func(hi *tls.ClientHelloInfo) (*tls.Certificate, error) {
switch hi.ServerName { switch hi.ServerName {
case "hello.ts.net": case "hello.ts.net":
return tailscale.GetCertificate(hi) return localClient.GetCertificate(hi)
case "hello.ipn.dev": case "hello.ipn.dev":
c, err := tls.LoadX509KeyPair( c, err := tls.LoadX509KeyPair(
"/etc/hello/hello.ipn.dev.crt", "/etc/hello/hello.ipn.dev.crt",
@ -170,7 +172,7 @@ func root(w http.ResponseWriter, r *http.Request) {
return return
} }
who, err := tailscale.WhoIs(r.Context(), r.RemoteAddr) who, err := localClient.WhoIs(r.Context(), r.RemoteAddr)
var data tmplData var data tmplData
if err != nil { if err != nil {
if devMode() { if devMode() {

Loading…
Cancel
Save