STDIOTcpForward starts a new connection via wireguard and forward traffic from `conn`
(vt *VirtualTun, raddr *addressPort, input *os.File, output *os.File)
| 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) { |
| 244 | target, err := vt.resolveToAddrPort(raddr) |
| 245 | if err != nil { |
| 246 | errorLogger.Printf("Name resolution error for %s: %s\n", raddr.address, err.Error()) |
| 247 | return |
| 248 | } |
| 249 | |
| 250 | tcpAddr := net.TCPAddrFromAddrPort(*target) |
| 251 | sconn, err := vt.Tnet.DialTCP(tcpAddr) |
| 252 | if err != nil { |
| 253 | errorLogger.Printf("TCP Client Tunnel to %s (%s): %s\n", target, tcpAddr, err.Error()) |
| 254 | return |
| 255 | } |
| 256 | |
| 257 | go connForward(input, sconn) |
| 258 | go connForward(sconn, output) |
| 259 | } |
| 260 | |
| 261 | // SpawnRoutine spawns a local TCP server which acts as a proxy to the specified target |
| 262 | func (conf *TCPClientTunnelConfig) SpawnRoutine(vt *VirtualTun) { |
no test coverage detected