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

Function validWireCloseCode

close.go:279–293  ·  view source on GitHub ↗

See http://www.iana.org/assignments/websocket/websocket.xhtml#close-code-number and https://tools.ietf.org/html/rfc6455#section-7.4.1

(code StatusCode)

Source from the content-addressed store, hash-verified

277// See http://www.iana.org/assignments/websocket/websocket.xhtml#close-code-number
278// and https://tools.ietf.org/html/rfc6455#section-7.4.1
279func validWireCloseCode(code StatusCode) bool {
280 switch code {
281 case statusReserved, StatusNoStatusRcvd, StatusAbnormalClosure, StatusTLSHandshake:
282 return false
283 }
284
285 if code >= StatusNormalClosure && code <= StatusBadGateway {
286 return true
287 }
288 if code >= 3000 && code <= 4999 {
289 return true
290 }
291
292 return false
293}
294
295func (ce CloseError) bytes() ([]byte, error) {
296 p, err := ce.bytesErr()

Callers 3

parseClosePayloadFunction · 0.85
bytesErrMethod · 0.85
Test_validWireCloseCodeFunction · 0.85

Calls

no outgoing calls

Tested by 1

Test_validWireCloseCodeFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…