connForward copy data from `from` to `to`
(from io.ReadWriteCloser, to io.ReadWriteCloser)
| 210 | |
| 211 | // connForward copy data from `from` to `to` |
| 212 | func connForward(from io.ReadWriteCloser, to io.ReadWriteCloser) { |
| 213 | defer func() { _ = from.Close() }() |
| 214 | defer func() { _ = to.Close() }() |
| 215 | |
| 216 | _, err := io.Copy(to, from) |
| 217 | if err != nil { |
| 218 | errorLogger.Printf("Cannot forward traffic: %s\n", err.Error()) |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | // tcpClientForward starts a new connection via wireguard and forward traffic from `conn` |
| 223 | func tcpClientForward(vt *VirtualTun, raddr *addressPort, conn net.Conn) { |
no outgoing calls
no test coverage detected