Skip to content

Commit a551aa5

Browse files
authored
fix: respect --disable-direct-connections on coder speedtest (#13377)
1 parent ec78f54 commit a551aa5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

cli/speedtest.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ func (r *RootCmd) speedtest() *serpent.Command {
3939
ctx, cancel := context.WithCancel(inv.Context())
4040
defer cancel()
4141

42+
if direct && r.disableDirect {
43+
return xerrors.Errorf("--direct (-d) is incompatible with --%s", varDisableDirect)
44+
}
45+
4246
_, workspaceAgent, err := getWorkspaceAndAgent(ctx, inv, client, false, inv.Args[0])
4347
if err != nil {
4448
return err
@@ -57,12 +61,13 @@ func (r *RootCmd) speedtest() *serpent.Command {
5761
logger = logger.Leveled(slog.LevelDebug)
5862
}
5963

60-
if r.disableDirect {
61-
_, _ = fmt.Fprintln(inv.Stderr, "Direct connections disabled.")
62-
}
6364
opts := &workspacesdk.DialAgentOptions{
6465
Logger: logger,
6566
}
67+
if r.disableDirect {
68+
_, _ = fmt.Fprintln(inv.Stderr, "Direct connections disabled.")
69+
opts.BlockEndpoints = true
70+
}
6671
if pcapFile != "" {
6772
s := capture.New()
6873
opts.CaptureHook = s.LogPacket

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy