mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-21 14:11:56 +00:00
cmd/hello: avoid deprecated apis (#10957)
Updates #cleanup Signed-off-by: Chris Palmer <cpalmer@tailscale.com>
This commit is contained in:
parent
13f8a669d5
commit
9744ad47e3
@ -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…
x
Reference in New Issue
Block a user