MCPcopy Create free account
hub / github.com/SapphicCode/protoplex / proxy

Function proxy

protoplex/proxy.go:7–22  ·  view source on GitHub ↗
(from net.Conn, to net.Conn, closed chan bool)

Source from the content-addressed store, hash-verified

5)
6
7func proxy(from net.Conn, to net.Conn, closed chan bool) {
8 data := make([]byte, 4096) // 4KiB buffer
9
10 for {
11 n, err := from.Read(data)
12 if err != nil {
13 closed <- true
14 return
15 }
16 _, err = to.Write(data[:n])
17 if err != nil {
18 closed <- true
19 return
20 }
21 }
22}

Callers 1

ConnectionHandlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected