mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: respect --disable-direct-connections on coder speedtest (#13377)
This commit is contained in:
+8
-3
@@ -39,6 +39,10 @@ func (r *RootCmd) speedtest() *serpent.Command {
|
||||
ctx, cancel := context.WithCancel(inv.Context())
|
||||
defer cancel()
|
||||
|
||||
if direct && r.disableDirect {
|
||||
return xerrors.Errorf("--direct (-d) is incompatible with --%s", varDisableDirect)
|
||||
}
|
||||
|
||||
_, workspaceAgent, err := getWorkspaceAndAgent(ctx, inv, client, false, inv.Args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -57,12 +61,13 @@ func (r *RootCmd) speedtest() *serpent.Command {
|
||||
logger = logger.Leveled(slog.LevelDebug)
|
||||
}
|
||||
|
||||
if r.disableDirect {
|
||||
_, _ = fmt.Fprintln(inv.Stderr, "Direct connections disabled.")
|
||||
}
|
||||
opts := &workspacesdk.DialAgentOptions{
|
||||
Logger: logger,
|
||||
}
|
||||
if r.disableDirect {
|
||||
_, _ = fmt.Fprintln(inv.Stderr, "Direct connections disabled.")
|
||||
opts.BlockEndpoints = true
|
||||
}
|
||||
if pcapFile != "" {
|
||||
s := capture.New()
|
||||
opts.CaptureHook = s.LogPacket
|
||||
|
||||
Reference in New Issue
Block a user