tcpClientForward starts a new connection via wireguard and forward traffic from `conn`
(vt *VirtualTun, raddr *addressPort, conn net.Conn)
| 221 | |
| 222 | // tcpClientForward starts a new connection via wireguard and forward traffic from `conn` |
| 223 | func tcpClientForward(vt *VirtualTun, raddr *addressPort, conn net.Conn) { |
| 224 | target, err := vt.resolveToAddrPort(raddr) |
| 225 | if err != nil { |
| 226 | errorLogger.Printf("TCP Server Tunnel to %s: %s\n", target, err.Error()) |
| 227 | return |
| 228 | } |
| 229 | |
| 230 | tcpAddr := net.TCPAddrFromAddrPort(*target) |
| 231 | |
| 232 | sconn, err := vt.Tnet.DialTCP(tcpAddr) |
| 233 | if err != nil { |
| 234 | errorLogger.Printf("TCP Client Tunnel to %s: %s\n", target, err.Error()) |
| 235 | return |
| 236 | } |
| 237 | |
| 238 | go connForward(sconn, conn) |
| 239 | go connForward(conn, sconn) |
| 240 | } |
| 241 | |
| 242 | // STDIOTcpForward starts a new connection via wireguard and forward traffic from `conn` |
| 243 | func STDIOTcpForward(vt *VirtualTun, raddr *addressPort, input *os.File, output *os.File) { |
no test coverage detected