mirror of
https://github.com/tailscale/tailscale.git
synced 2025-07-12 00:28:42 +00:00
control/controlclient: send optional ConnectionHandleForTest with map requests (#15904)
This handle can be used in tests and debugging to identify the specific client connection. Updates tailscale/corp#28368 Change-Id: I48cc573fc0bcf018c66a18e67ad6c4f248fb760c Signed-off-by: Brian Palmer <brianp@tailscale.com>
This commit is contained in:
parent
fd263adc1b
commit
f5cc657e13
@ -104,6 +104,7 @@ type Direct struct {
|
|||||||
endpoints []tailcfg.Endpoint
|
endpoints []tailcfg.Endpoint
|
||||||
tkaHead string
|
tkaHead string
|
||||||
lastPingURL string // last PingRequest.URL received, for dup suppression
|
lastPingURL string // last PingRequest.URL received, for dup suppression
|
||||||
|
connectionHandleForTest string // sent in MapRequest.ConnectionHandleForTest
|
||||||
}
|
}
|
||||||
|
|
||||||
// Observer is implemented by users of the control client (such as LocalBackend)
|
// Observer is implemented by users of the control client (such as LocalBackend)
|
||||||
@ -403,6 +404,14 @@ func (c *Direct) SetTKAHead(tkaHead string) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetConnectionHandleForTest stores a new MapRequest.ConnectionHandleForTest
|
||||||
|
// value for the next update.
|
||||||
|
func (c *Direct) SetConnectionHandleForTest(handle string) {
|
||||||
|
c.mu.Lock()
|
||||||
|
defer c.mu.Unlock()
|
||||||
|
c.connectionHandleForTest = handle
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Direct) GetPersist() persist.PersistView {
|
func (c *Direct) GetPersist() persist.PersistView {
|
||||||
c.mu.Lock()
|
c.mu.Lock()
|
||||||
defer c.mu.Unlock()
|
defer c.mu.Unlock()
|
||||||
@ -851,6 +860,7 @@ func (c *Direct) sendMapRequest(ctx context.Context, isStreaming bool, nu Netmap
|
|||||||
serverNoiseKey := c.serverNoiseKey
|
serverNoiseKey := c.serverNoiseKey
|
||||||
hi := c.hostInfoLocked()
|
hi := c.hostInfoLocked()
|
||||||
backendLogID := hi.BackendLogID
|
backendLogID := hi.BackendLogID
|
||||||
|
connectionHandleForTest := c.connectionHandleForTest
|
||||||
var epStrs []string
|
var epStrs []string
|
||||||
var eps []netip.AddrPort
|
var eps []netip.AddrPort
|
||||||
var epTypes []tailcfg.EndpointType
|
var epTypes []tailcfg.EndpointType
|
||||||
@ -902,6 +912,7 @@ func (c *Direct) sendMapRequest(ctx context.Context, isStreaming bool, nu Netmap
|
|||||||
DebugFlags: c.debugFlags,
|
DebugFlags: c.debugFlags,
|
||||||
OmitPeers: nu == nil,
|
OmitPeers: nu == nil,
|
||||||
TKAHead: c.tkaHead,
|
TKAHead: c.tkaHead,
|
||||||
|
ConnectionHandleForTest: connectionHandleForTest,
|
||||||
}
|
}
|
||||||
var extraDebugFlags []string
|
var extraDebugFlags []string
|
||||||
if hi != nil && c.netMon != nil && !c.skipIPForwardingCheck &&
|
if hi != nil && c.netMon != nil && !c.skipIPForwardingCheck &&
|
||||||
|
@ -1413,6 +1413,12 @@ type MapRequest struct {
|
|||||||
// * "warn-router-unhealthy": client's Router implementation is
|
// * "warn-router-unhealthy": client's Router implementation is
|
||||||
// having problems.
|
// having problems.
|
||||||
DebugFlags []string `json:",omitempty"`
|
DebugFlags []string `json:",omitempty"`
|
||||||
|
|
||||||
|
// ConnectionHandleForTest, if non-empty, is an opaque string sent by the client that
|
||||||
|
// identifies this specific connection to the server. The server may choose to
|
||||||
|
// use this handle to identify the connection for debugging or testing
|
||||||
|
// purposes. It has no semantic meaning.
|
||||||
|
ConnectionHandleForTest string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PortRange represents a range of UDP or TCP port numbers.
|
// PortRange represents a range of UDP or TCP port numbers.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user