github.com/Asutorufa/yuhaiin@v0.3.6-0.20240502055049-7984da7023a0/pkg/net/proxy/redir/server/handle_linux.go (about) 1 package server 2 3 import ( 4 "net" 5 6 "github.com/Asutorufa/yuhaiin/pkg/net/netapi" 7 "github.com/Asutorufa/yuhaiin/pkg/net/proxy/redir/nfutil" 8 ) 9 10 func (r *redir) handle(req net.Conn) error { 11 target, err := nfutil.GetOrigDst(req.(*net.TCPConn), false) 12 if err != nil { 13 return err 14 } 15 16 return r.SendStream(&netapi.StreamMeta{ 17 Inbound: r.lis.Addr(), 18 Source: req.RemoteAddr(), 19 Destination: target, 20 Src: req, 21 Address: netapi.ParseTCPAddress(target), 22 }) 23 }