Skip to content

Commit c6901c4

Browse files
committed
chore: switch to github.com/coder/websocket
1 parent 21942af commit c6901c4

32 files changed

+36
-33
lines changed

coderd/healthcheck/websocket.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99
"strconv"
1010
"time"
1111

12+
"github.com/coder/websocket"
1213
"golang.org/x/xerrors"
13-
"nhooyr.io/websocket"
1414

1515
"github.com/coder/coder/v2/coderd/healthcheck/health"
1616
"github.com/coder/coder/v2/codersdk/healthsdk"

coderd/httpapi/websocket.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"time"
66

7-
"nhooyr.io/websocket"
7+
"github.com/coder/websocket"
88

99
"cdr.dev/slog"
1010
)

coderd/provisionerjobs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010
"sort"
1111
"strconv"
1212

13+
"github.com/coder/websocket"
1314
"github.com/google/uuid"
1415
"golang.org/x/xerrors"
15-
"nhooyr.io/websocket"
1616

1717
"cdr.dev/slog"
1818

coderd/provisionerjobs_internal_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import (
1010
"testing"
1111
"time"
1212

13+
"github.com/coder/websocket"
1314
"github.com/google/uuid"
1415
"github.com/stretchr/testify/assert"
1516
"github.com/stretchr/testify/require"
1617
"go.uber.org/mock/gomock"
17-
"nhooyr.io/websocket"
1818

1919
"cdr.dev/slog/sloggers/slogtest"
2020

coderd/workspaceagents.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ import (
1414
"strings"
1515
"time"
1616

17+
"github.com/coder/websocket"
1718
"github.com/google/uuid"
1819
"github.com/sqlc-dev/pqtype"
1920
"golang.org/x/exp/maps"
2021
"golang.org/x/exp/slices"
2122
"golang.org/x/sync/errgroup"
2223
"golang.org/x/xerrors"
23-
"nhooyr.io/websocket"
2424
"tailscale.com/tailcfg"
2525

2626
"cdr.dev/slog"

coderd/workspaceagentsrpc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import (
1111
"sync/atomic"
1212
"time"
1313

14+
"github.com/coder/websocket"
1415
"github.com/google/uuid"
1516
"github.com/hashicorp/yamux"
1617
"golang.org/x/xerrors"
17-
"nhooyr.io/websocket"
1818

1919
"cdr.dev/slog"
2020
"github.com/coder/coder/v2/agent/proto"

coderd/workspaceagentsrpc_internal_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import (
1010

1111
"github.com/coder/coder/v2/coderd/util/ptr"
1212

13+
"github.com/coder/websocket"
1314
"github.com/google/uuid"
1415
"github.com/stretchr/testify/require"
1516
"go.uber.org/mock/gomock"
16-
"nhooyr.io/websocket"
1717

1818
"cdr.dev/slog"
1919
"cdr.dev/slog/sloggers/slogtest"

coderd/workspaceapps/proxy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ import (
1212
"strings"
1313
"sync"
1414

15+
"github.com/coder/websocket"
1516
"github.com/go-chi/chi/v5"
1617
"github.com/google/uuid"
1718
"go.opentelemetry.io/otel/trace"
18-
"nhooyr.io/websocket"
1919

2020
"cdr.dev/slog"
2121
"github.com/coder/coder/v2/agent/agentssh"

codersdk/agentsdk/agentsdk.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ import (
1212
"time"
1313

1414
"cloud.google.com/go/compute/metadata"
15+
"github.com/coder/websocket"
1516
"github.com/google/uuid"
1617
"github.com/hashicorp/yamux"
1718
"golang.org/x/xerrors"
18-
"nhooyr.io/websocket"
1919
"storj.io/drpc"
2020
"tailscale.com/tailcfg"
2121

codersdk/provisionerdaemons.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import (
99
"net/http/cookiejar"
1010
"time"
1111

12+
"github.com/coder/websocket"
1213
"github.com/google/uuid"
1314
"github.com/hashicorp/yamux"
1415
"golang.org/x/xerrors"
15-
"nhooyr.io/websocket"
1616

1717
"github.com/coder/coder/v2/buildinfo"
1818
"github.com/coder/coder/v2/codersdk/drpc"

codersdk/websocket.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"net"
66

7-
"nhooyr.io/websocket"
7+
"github.com/coder/websocket"
88
)
99

1010
// wsNetConn wraps net.Conn created by websocket.NetConn(). Cancel func

codersdk/websocket_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import (
66
"net/http/httptest"
77
"testing"
88

9+
"github.com/coder/websocket"
910
"github.com/stretchr/testify/assert"
1011
"github.com/stretchr/testify/require"
11-
"nhooyr.io/websocket"
1212

1313
"github.com/coder/coder/v2/codersdk"
1414
"github.com/coder/coder/v2/testutil"

codersdk/workspaceagents.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010
"strings"
1111
"time"
1212

13+
"github.com/coder/websocket"
1314
"github.com/google/uuid"
1415
"golang.org/x/xerrors"
15-
"nhooyr.io/websocket"
1616

1717
"github.com/coder/coder/v2/coderd/tracing"
1818
)

codersdk/workspacesdk/connector.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import (
1212
"sync/atomic"
1313
"time"
1414

15+
"github.com/coder/websocket"
1516
"github.com/google/uuid"
1617
"golang.org/x/xerrors"
17-
"nhooyr.io/websocket"
1818
"storj.io/drpc"
1919
"storj.io/drpc/drpcerr"
2020
"tailscale.com/tailcfg"

codersdk/workspacesdk/connector_internal_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import (
99
"testing"
1010
"time"
1111

12+
"github.com/coder/websocket"
1213
"github.com/google/uuid"
1314
"github.com/hashicorp/yamux"
1415
"github.com/stretchr/testify/assert"
1516
"github.com/stretchr/testify/require"
1617
"golang.org/x/xerrors"
17-
"nhooyr.io/websocket"
1818
"storj.io/drpc"
1919
"storj.io/drpc/drpcerr"
2020
"tailscale.com/tailcfg"

codersdk/workspacesdk/workspacesdk.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import (
1212
"strconv"
1313
"strings"
1414

15+
"github.com/coder/websocket"
1516
"github.com/google/uuid"
1617
"golang.org/x/xerrors"
17-
"nhooyr.io/websocket"
1818
"tailscale.com/tailcfg"
1919
"tailscale.com/wgengine/capture"
2020

enterprise/coderd/provisionerdaemons.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import (
99
"strings"
1010
"time"
1111

12+
"github.com/coder/websocket"
1213
"github.com/google/uuid"
1314
"github.com/hashicorp/yamux"
1415
"github.com/moby/moby/pkg/namesgenerator"
1516
"go.opentelemetry.io/otel/trace"
1617
"golang.org/x/exp/maps"
1718
"golang.org/x/xerrors"
18-
"nhooyr.io/websocket"
1919
"storj.io/drpc/drpcmux"
2020
"storj.io/drpc/drpcserver"
2121

enterprise/coderd/workspaceproxycoordinate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package coderd
33
import (
44
"net/http"
55

6+
"github.com/coder/websocket"
67
"github.com/google/uuid"
7-
"nhooyr.io/websocket"
88

99
"github.com/coder/coder/v2/apiversion"
1010
"github.com/coder/coder/v2/coderd/httpapi"

enterprise/tailnet/workspaceproxy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ func forwardNodesToWorkspaceProxy(ctx context.Context, conn net.Conn, ma agpl.Mu
146146
return err
147147
}
148148

149-
// nhooyr.io/websocket has a bugged implementation of deadlines on a websocket net.Conn. What they are
149+
// github.com/coder/websocket has a bugged implementation of deadlines on a websocket net.Conn. What they are
150150
// *supposed* to do is set a deadline for any subsequent writes to complete, otherwise the call to Write()
151-
// fails. What nhooyr.io/websocket does is set a timer, after which it expires the websocket write context.
151+
// fails. What github.com/coder/websocket does is set a timer, after which it expires the websocket write context.
152152
// If this timer fires, then the next write will fail *even if we set a new write deadline*. So, after
153153
// our successful write, it is important that we reset the deadline before it fires.
154154
err = conn.SetWriteDeadline(time.Time{})

enterprise/wsproxy/wsproxysdk/wsproxysdk.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import (
88
"net/url"
99
"time"
1010

11+
"github.com/coder/websocket"
1112
"github.com/google/uuid"
1213
"golang.org/x/xerrors"
13-
"nhooyr.io/websocket"
1414
"tailscale.com/tailcfg"
1515

1616
"cdr.dev/slog"

enterprise/wsproxy/wsproxysdk/wsproxysdk_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ import (
1313
"testing"
1414
"time"
1515

16+
"github.com/coder/websocket"
1617
"github.com/go-chi/chi/v5"
1718
"github.com/google/uuid"
1819
"github.com/stretchr/testify/assert"
1920
"github.com/stretchr/testify/require"
2021
"go.uber.org/mock/gomock"
2122
"google.golang.org/protobuf/types/known/timestamppb"
22-
"nhooyr.io/websocket"
2323
"tailscale.com/tailcfg"
2424
"tailscale.com/types/key"
2525

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ require (
8787
github.com/coder/quartz v0.1.0
8888
github.com/coder/retry v1.5.1
8989
github.com/coder/terraform-provider-coder v0.23.0
90+
github.com/coder/websocket v1.8.12
9091
github.com/coder/wgtunnel v0.1.13-0.20240522110300-ade90dfb2da0
9192
github.com/coreos/go-oidc/v3 v3.11.0
9293
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
@@ -188,7 +189,6 @@ require (
188189
gopkg.in/natefinch/lumberjack.v2 v2.2.1
189190
gopkg.in/yaml.v3 v3.0.1
190191
gvisor.dev/gvisor v0.0.0-20240509041132-65b30f7869dc
191-
nhooyr.io/websocket v1.8.7
192192
storj.io/drpc v0.0.33
193193
tailscale.com v1.46.1
194194
)
@@ -219,6 +219,7 @@ require (
219219
github.com/pion/transport/v2 v2.0.0 // indirect
220220
github.com/tdewolff/test v1.0.11-0.20240106005702-7de5f7df4739 // indirect
221221
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect
222+
nhooyr.io/websocket v1.8.7 // indirect
222223
)
223224

224225
require (

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ github.com/coder/tailscale v1.1.1-0.20240702054557-aa558fbe5374 h1:a5Eg7D5e2oAc0
223223
github.com/coder/tailscale v1.1.1-0.20240702054557-aa558fbe5374/go.mod h1:rp6BIJxCp127/hvvDWNkHC9MxAlKvQfoOtBr8s5sCqo=
224224
github.com/coder/terraform-provider-coder v0.23.0 h1:DuNLWxhnGlXyG0g+OCAZRI6xd8+bJjIEnE4F3hYgA4E=
225225
github.com/coder/terraform-provider-coder v0.23.0/go.mod h1:wMun9UZ9HT2CzF6qPPBup1odzBpVUc0/xSFoXgdI3tk=
226+
github.com/coder/websocket v1.8.12 h1:5bUXkEPPIbewrnkU8LTCLVaxi4N4J8ahufH2vlo4NAo=
227+
github.com/coder/websocket v1.8.12/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs=
226228
github.com/coder/wgtunnel v0.1.13-0.20240522110300-ade90dfb2da0 h1:C2/eCr+r0a5Auuw3YOiSyLNHkdMtyCZHPFBx7syN4rk=
227229
github.com/coder/wgtunnel v0.1.13-0.20240522110300-ade90dfb2da0/go.mod h1:qANbdpqyAGlo2bg+4gQKPj24H1ZWa3bQU2Q5/bV5B3Y=
228230
github.com/coder/wireguard-go v0.0.0-20240522052547-769cdd7f7818 h1:bNhUTaKl3q0bFn78bBRq7iIwo72kNTvUD9Ll5TTzDDk=

scaletest/workspacetraffic/conn.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"sync"
1111
"time"
1212

13-
"nhooyr.io/websocket"
13+
"github.com/coder/websocket"
1414

1515
"github.com/coder/coder/v2/codersdk"
1616
"github.com/coder/coder/v2/codersdk/workspacesdk"

scaletest/workspacetraffic/countreadwriter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
"golang.org/x/xerrors"
1010

11-
"nhooyr.io/websocket"
11+
"github.com/coder/websocket"
1212
)
1313

1414
// countReadWriteCloser wraps an io.ReadWriteCloser and counts the number of bytes read and written.

scaletest/workspacetraffic/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import (
99
"sync"
1010
"time"
1111

12+
"github.com/coder/websocket"
1213
"github.com/google/uuid"
1314
"golang.org/x/xerrors"
14-
"nhooyr.io/websocket"
1515

1616
"cdr.dev/slog"
1717
"cdr.dev/slog/sloggers/sloghuman"

scaletest/workspacetraffic/run_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
"testing"
1313
"time"
1414

15+
"github.com/coder/websocket"
1516
"golang.org/x/exp/slices"
16-
"nhooyr.io/websocket"
1717

1818
"github.com/coder/coder/v2/agent/agenttest"
1919
"github.com/coder/coder/v2/coderd/coderdtest"

tailnet/coordinator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import (
1212
"sync"
1313
"time"
1414

15+
"github.com/coder/websocket"
1516
"github.com/google/uuid"
1617
"golang.org/x/xerrors"
17-
"nhooyr.io/websocket"
1818
"tailscale.com/tailcfg"
1919
"tailscale.com/types/key"
2020

tailnet/coordinator_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import (
1212
"testing"
1313
"time"
1414

15+
"github.com/coder/websocket"
1516
"github.com/google/uuid"
1617
"github.com/stretchr/testify/assert"
1718
"github.com/stretchr/testify/require"
1819
"go.uber.org/mock/gomock"
19-
"nhooyr.io/websocket"
2020
"tailscale.com/tailcfg"
2121
"tailscale.com/types/key"
2222

tailnet/derp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"strings"
99
"sync"
1010

11-
"nhooyr.io/websocket"
11+
"github.com/coder/websocket"
1212
"tailscale.com/derp"
1313
"tailscale.com/net/wsconn"
1414
)

tailnet/test/integration/integration.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ import (
2222
"testing"
2323
"time"
2424

25+
"github.com/coder/websocket"
2526
"github.com/go-chi/chi/v5"
2627
"github.com/google/uuid"
2728
"github.com/stretchr/testify/require"
2829
"golang.org/x/xerrors"
29-
"nhooyr.io/websocket"
3030
"tailscale.com/derp"
3131
"tailscale.com/derp/derphttp"
3232
"tailscale.com/tailcfg"

tailnet/trackedconn.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ func (t *TrackedConn) SendUpdates() {
164164
}
165165
t.logger.Debug(t.ctx, "wrote nodes", slog.F("nodes", string(data)))
166166

167-
// nhooyr.io/websocket has a bugged implementation of deadlines on a websocket net.Conn. What they are
167+
// github.com/coder/websocket has a bugged implementation of deadlines on a websocket net.Conn. What they are
168168
// *supposed* to do is set a deadline for any subsequent writes to complete, otherwise the call to Write()
169-
// fails. What nhooyr.io/websocket does is set a timer, after which it expires the websocket write context.
169+
// fails. What github.com/coder/websocket does is set a timer, after which it expires the websocket write context.
170170
// If this timer fires, then the next write will fail *even if we set a new write deadline*. So, after
171171
// our successful write, it is important that we reset the deadline before it fires.
172172
err = t.conn.SetWriteDeadline(time.Time{})

0 commit comments

Comments
 (0)