MCPcopy
hub / github.com/cbeuw/Cloak / Read

Method Read

internal/multiplex/stream.go:85–97  ·  view source on GitHub ↗

Read implements io.Read

(buf []byte)

Source from the content-addressed store, hash-verified

83
84// Read implements io.Read
85func (s *Stream) Read(buf []byte) (n int, err error) {
86 //log.Tracef("attempting to read from stream %v", s.id)
87 if len(buf) == 0 {
88 return 0, nil
89 }
90
91 n, err = s.recvBuf.Read(buf)
92 log.Tracef("%v read from stream %v with err %v", n, s.id, err)
93 if err == io.EOF {
94 return n, ErrBrokenStream
95 }
96 return
97}
98
99func (s *Stream) obfuscateAndSend(buf []byte, payloadOffsetInBuf int) error {
100 cipherTextLen, err := s.session.obfuscate(&s.writingFrame, buf, payloadOffsetInBuf)

Callers 15

deplexMethod · 0.45
TestSwitchboard_SendFunction · 0.45
TestSwitchboard_TxCreditFunction · 0.45
TestGenerateObfsFunction · 0.45
TestObfuscateFunction · 0.45
BenchmarkObfsFunction · 0.45
BenchmarkDeobfsFunction · 0.45
runEchoTestFunction · 0.45
TestMultiplexFunction · 0.45
ReadFromMethod · 0.45

Calls

no outgoing calls

Tested by 15

TestSwitchboard_SendFunction · 0.36
TestSwitchboard_TxCreditFunction · 0.36
TestGenerateObfsFunction · 0.36
TestObfuscateFunction · 0.36
BenchmarkObfsFunction · 0.36
BenchmarkDeobfsFunction · 0.36
runEchoTestFunction · 0.36
TestMultiplexFunction · 0.36
TestRecvDataFromRemoteFunction · 0.36