@@ -15,11 +15,10 @@ import (
1515 "github.com/pion/webrtc/v3"
1616 "golang.org/x/net/proxy"
1717 "golang.org/x/xerrors"
18- "k8s.io/utils/pointer"
1918 "nhooyr.io/websocket"
2019
20+ "cdr.dev/coder-cli/coder-sdk"
2121 "cdr.dev/slog"
22- "coder.com/m/product/coder/pkg/codersdk/legacy"
2322)
2423
2524// DialOptions are configurable options for a wsnet connection.
@@ -61,7 +60,7 @@ func DialWebsocket(ctx context.Context, broker string, netOpts *DialOptions, wsO
6160 defer func () {
6261 _ = resp .Body .Close ()
6362 }()
64- return nil , legacy .NewHTTPError (resp )
63+ return nil , coder .NewHTTPError (resp )
6564 }
6665 return nil , fmt .Errorf ("dial websocket: %w" , err )
6766 }
@@ -129,8 +128,8 @@ func Dial(ctx context.Context, conn net.Conn, options *DialOptions) (*Dialer, er
129128
130129 log .Debug (ctx , "creating control channel" , slog .F ("proto" , controlChannel ))
131130 ctrl , err := rtc .CreateDataChannel (controlChannel , & webrtc.DataChannelInit {
132- Protocol : pointer . String (controlChannel ),
133- Ordered : pointer . Bool (true ),
131+ Protocol : strptr (controlChannel ),
132+ Ordered : boolptr (true ),
134133 })
135134 if err != nil {
136135 return nil , fmt .Errorf ("create control channel: %w" , err )
@@ -386,7 +385,7 @@ func (d *Dialer) DialContext(ctx context.Context, network, address string) (net.
386385
387386 d .log .Debug (ctx , "opening data channel" )
388387 dc , err := d .rtc .CreateDataChannel ("proxy" , & webrtc.DataChannelInit {
389- Ordered : pointer . Bool (network != "udp" ),
388+ Ordered : boolptr (network != "udp" ),
390389 Protocol : & proto ,
391390 })
392391 if err != nil {
@@ -463,3 +462,11 @@ func (d *Dialer) DialContext(ctx context.Context, network, address string) (net.
463462 d .log .Debug (ctx , "dial channel ready" )
464463 return c , nil
465464}
465+
466+ func boolptr (b bool ) * bool {
467+ return & b
468+ }
469+
470+ func strptr (s string ) * string {
471+ return & s
472+ }
0 commit comments