mirror of
https://github.com/coder/coder.git
synced 2026-09-22 05:05:20 +08:00
fix: start packet capture immediately on speedtest (#13128)
I initially made this change when hacking wgengine to also capture wireguard packets going into the magicsock, so that we could capture the initial wireguard handshake. I don't think we should ship that additional capture logic, but... it seems generally useful to capture packets from the get go on speedtest, so that you can see disco and pings before the TCP speedtest session starts.
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
"nhooyr.io/websocket"
|
||||
"tailscale.com/tailcfg"
|
||||
"tailscale.com/wgengine/capture"
|
||||
|
||||
"cdr.dev/slog"
|
||||
"github.com/coder/coder/v2/codersdk"
|
||||
@@ -176,6 +177,9 @@ type DialAgentOptions struct {
|
||||
// BlockEndpoints forced a direct connection through DERP. The Client may
|
||||
// have DisableDirect set which will override this value.
|
||||
BlockEndpoints bool
|
||||
// CaptureHook is a callback that captures Disco packets and packets sent
|
||||
// into the tailnet tunnel.
|
||||
CaptureHook capture.Callback
|
||||
}
|
||||
|
||||
func (c *Client) DialAgent(dialCtx context.Context, agentID uuid.UUID, options *DialAgentOptions) (agentConn *AgentConn, err error) {
|
||||
@@ -203,6 +207,7 @@ func (c *Client) DialAgent(dialCtx context.Context, agentID uuid.UUID, options *
|
||||
DERPForceWebSockets: connInfo.DERPForceWebSockets,
|
||||
Logger: options.Logger,
|
||||
BlockEndpoints: c.client.DisableDirectConnections || options.BlockEndpoints,
|
||||
CaptureHook: options.CaptureHook,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("create tailnet: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user