From 000c0a70f676814496d6adecf54cfcd23fe0c121 Mon Sep 17 00:00:00 2001 From: Marwan Sulaiman Date: Tue, 22 Aug 2023 17:57:43 +0100 Subject: [PATCH] ipn, ipn/ipnlocal: clean up documentation and use clock instead of time This PR addresses a number of the follow ups from PR #8491 that were written after getting merged. Updates #8489 Signed-off-by: Marwan Sulaiman --- ipn/ipnlocal/serve.go | 3 +-- ipn/serve.go | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ipn/ipnlocal/serve.go b/ipn/ipnlocal/serve.go index 9d713388a..de9de77ce 100644 --- a/ipn/ipnlocal/serve.go +++ b/ipn/ipnlocal/serve.go @@ -320,7 +320,6 @@ func (b *LocalBackend) StreamServe(ctx context.Context, w io.Writer, req ipn.Ser // Clean up streamer when done. defer func() { b.mu.Lock() - mak.NonNilMapForJSON(&b.serveStreamers) delete(b.serveStreamers[port], id) b.mu.Unlock() }() @@ -400,7 +399,7 @@ func (b *LocalBackend) maybeLogServeConnection(destPort uint16, srcAddr netip.Ad var log ipn.FunnelRequestLog log.SrcAddr = srcAddr - log.Time = time.Now() // TODO: use a different clock somewhere? + log.Time = b.clock.Now() if node, user, ok := b.WhoIs(srcAddr); ok { log.NodeName = node.ComputedName() diff --git a/ipn/serve.go b/ipn/serve.go index 5d6f7129e..3b6034fa9 100644 --- a/ipn/serve.go +++ b/ipn/serve.go @@ -78,15 +78,16 @@ type FunnelConn struct { Src netip.AddrPort } -// ServeStreamRequest defines the json request body +// ServeStreamRequest defines the JSON request body // for the serve stream endpoint type ServeStreamRequest struct { // HostPort is the DNS and port of the tailscale // URL. HostPort HostPort `json:",omitempty"` - // Source is the user's serve destination - // such as their localhost server. + // Source is the user's serve source + // as defined in the `tailscale serve` + // command such as http://127.0.0.1:3000 Source string `json:",omitempty"` // MountPoint is the path prefix for