MCPcopy
hub / github.com/txthinking/brook / Write

Method Write

streamclient.go:179–189  ·  view source on GitHub ↗
(l int)

Source from the content-addressed store, hash-verified

177}
178
179func (c *StreamClient) Write(l int) error {
180 binary.BigEndian.PutUint16(c.WB[:2], uint16(l))
181 c.ca.Seal(c.WB[:0], c.cn, c.WB[:2], nil)
182 NextNonce(c.cn)
183 c.ca.Seal(c.WB[:2+16], c.cn, c.WB[2+16:2+16+l], nil)
184 if _, err := c.Server.Write(c.WB[:2+16+l+16]); err != nil {
185 return err
186 }
187 NextNonce(c.cn)
188 return nil
189}
190
191func (c *StreamClient) Read() (int, error) {
192 if _, err := io.ReadFull(c.Server, c.RB[:2+16]); err != nil {

Callers 2

NewStreamClientFunction · 0.95
ExchangeMethod · 0.95

Calls 1

NextNonceFunction · 0.85

Tested by

no test coverage detected