mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-12 05:37:32 +00:00
cmd/{tta,vnet}: proxy to gokrazy UI
Updates #13038 Change-Id: I1cacb1b0f8c3d0e4c36b7890155f7b1ad0d23575 Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
@@ -10,11 +10,15 @@ import (
|
||||
"flag"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"net/url"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"tailscale.com/tstest/natlab/vnet"
|
||||
"tailscale.com/types/logger"
|
||||
"tailscale.com/util/must"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -70,6 +74,16 @@ func main() {
|
||||
|
||||
s.WriteStartingBanner(os.Stdout)
|
||||
nc := s.NodeAgentClient(node1)
|
||||
go func() {
|
||||
rp := httputil.NewSingleHostReverseProxy(must.Get(url.Parse("http://gokrazy")))
|
||||
d := rp.Director
|
||||
rp.Director = func(r *http.Request) {
|
||||
d(r)
|
||||
r.Header.Set("X-TTA-GoKrazy", "1")
|
||||
}
|
||||
rp.Transport = nc.HTTPClient.Transport
|
||||
http.ListenAndServe(":8080", rp)
|
||||
}()
|
||||
go func() {
|
||||
getStatus := func() {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
|
||||
|
Reference in New Issue
Block a user