mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +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:
@@ -93,6 +93,9 @@ type Options struct {
|
||||
BlockEndpoints bool
|
||||
Logger slog.Logger
|
||||
ListenPort uint16
|
||||
// CaptureHook is a callback that captures Disco packets and packets sent
|
||||
// into the tailnet tunnel.
|
||||
CaptureHook capture.Callback
|
||||
}
|
||||
|
||||
// NodeID creates a Tailscale NodeID from the last 8 bytes of a UUID. It ensures
|
||||
@@ -158,6 +161,7 @@ func NewConn(options *Options) (conn *Conn, err error) {
|
||||
wireguardEngine.Close()
|
||||
}
|
||||
}()
|
||||
wireguardEngine.InstallCaptureHook(options.CaptureHook)
|
||||
dialer.UseNetstackForIP = func(ip netip.Addr) bool {
|
||||
_, ok := wireguardEngine.PeerForIP(ip)
|
||||
return ok
|
||||
|
||||
Reference in New Issue
Block a user