MCPcopy
hub / github.com/coder/websocket / secWebSocketKey

Function secWebSocketKey

dial.go:230–240  ·  view source on GitHub ↗
(rr io.Reader)

Source from the content-addressed store, hash-verified

228}
229
230func secWebSocketKey(rr io.Reader) (string, error) {
231 if rr == nil {
232 rr = rand.Reader
233 }
234 b := make([]byte, 16)
235 _, err := io.ReadFull(rr, b)
236 if err != nil {
237 return "", fmt.Errorf("failed to read random data from rand.Reader: %w", err)
238 }
239 return base64.StdEncoding.EncodeToString(b), nil
240}
241
242func verifyServerResponse(opts *DialOptions, copts *compressionOptions, secWebSocketKey string, resp *http.Response) (*compressionOptions, error) {
243 if resp.StatusCode != http.StatusSwitchingProtocols {

Callers 1

dialFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…