MCPcopy Index your code
hub / github.com/windtf/wireproxy / tcpClientForward

Function tcpClientForward

routine.go:223–240  ·  view source on GitHub ↗

tcpClientForward starts a new connection via wireguard and forward traffic from `conn`

(vt *VirtualTun, raddr *addressPort, conn net.Conn)

Source from the content-addressed store, hash-verified

221
222// tcpClientForward starts a new connection via wireguard and forward traffic from `conn`
223func 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`
243func STDIOTcpForward(vt *VirtualTun, raddr *addressPort, input *os.File, output *os.File) {

Callers 1

SpawnRoutineMethod · 0.85

Calls 2

connForwardFunction · 0.85
resolveToAddrPortMethod · 0.80

Tested by

no test coverage detected