MCPcopy
hub / github.com/nirui/sshwifty / buildWSFetcher

Method buildWSFetcher

application/controller/socket.go:212–230  ·  view source on GitHub ↗
(c *websocket.Conn)

Source from the content-addressed store, hash-verified

210}
211
212func (s socket) buildWSFetcher(c *websocket.Conn) rw.FetchReaderFetcher {
213 return func() ([]byte, error) {
214 for {
215 mt, message, err := c.ReadMessage()
216
217 if err != nil {
218 return nil, err
219 }
220
221 if mt != websocket.BinaryMessage {
222 return nil, NewError(
223 http.StatusBadRequest,
224 fmt.Sprintf("Received unknown type of data: %d", message))
225 }
226
227 return message, nil
228 }
229 }
230}
231
232func (s socket) generateNonce(nonce []byte) error {
233 _, rErr := io.ReadFull(rand.Reader, nonce[:socketGCMStandardNonceSize])

Callers 1

GetMethod · 0.95

Calls 1

NewErrorFunction · 0.85

Tested by

no test coverage detected