Skip to content

Commit

Permalink
cmd/hello: avoid deprecated apis (tailscale#10957)
Browse files Browse the repository at this point in the history
Updates #cleanup

Signed-off-by: Chris Palmer <cpalmer@tailscale.com>
  • Loading branch information
noncombatant committed Jan 29, 2024
1 parent 13f8a66 commit 9744ad4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmd/hello/hello.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ var (
//go:embed hello.tmpl.html
var embeddedTemplate string

var localClient tailscale.LocalClient

func main() {
flag.Parse()
if *testIP != "" {
res, err := tailscale.WhoIs(context.Background(), *testIP)
res, err := localClient.WhoIs(context.Background(), *testIP)
if err != nil {
log.Fatal(err)
}
Expand Down Expand Up @@ -76,7 +78,7 @@ func main() {
GetCertificate: func(hi *tls.ClientHelloInfo) (*tls.Certificate, error) {
switch hi.ServerName {
case "hello.ts.net":
return tailscale.GetCertificate(hi)
return localClient.GetCertificate(hi)
case "hello.ipn.dev":
c, err := tls.LoadX509KeyPair(
"/etc/hello/hello.ipn.dev.crt",
Expand Down Expand Up @@ -170,7 +172,7 @@ func root(w http.ResponseWriter, r *http.Request) {
return
}

who, err := tailscale.WhoIs(r.Context(), r.RemoteAddr)
who, err := localClient.WhoIs(r.Context(), r.RemoteAddr)
var data tmplData
if err != nil {
if devMode() {
Expand Down

0 comments on commit 9744ad4

Please sign in to comment.