MCPcopy
hub / github.com/tailscale/tailscale / StreamDebugCapture

Method StreamDebugCapture

client/local/local.go:1341–1355  ·  view source on GitHub ↗

StreamDebugCapture streams a pcap-formatted packet capture. The provided context does not determine the lifetime of the returned [io.ReadCloser].

(ctx context.Context)

Source from the content-addressed store, hash-verified

1339// The provided context does not determine the lifetime of the
1340// returned [io.ReadCloser].
1341func (lc *Client) StreamDebugCapture(ctx context.Context) (io.ReadCloser, error) {
1342 req, err := http.NewRequestWithContext(ctx, "POST", "http://"+apitype.LocalAPIHost+"/localapi/v0/debug-capture", nil)
1343 if err != nil {
1344 return nil, err
1345 }
1346 res, err := lc.doLocalRequestNiceError(req)
1347 if err != nil {
1348 return nil, err
1349 }
1350 if res.StatusCode != 200 {
1351 res.Body.Close()
1352 return nil, errors.New(res.Status)
1353 }
1354 return res.Body, nil
1355}
1356
1357// WatchIPNBus subscribes to the IPN notification bus. It returns a watcher
1358// once the bus is connected successfully.

Callers 2

CapturePcapMethod · 0.80
runCaptureFunction · 0.80

Calls 3

CloseMethod · 0.65
NewMethod · 0.45

Tested by

no test coverage detected