Skip to content

Commit

Permalink
fix: use diff dialer
Browse files Browse the repository at this point in the history
  • Loading branch information
wencaiwulue committed Feb 19, 2024
1 parent 72ddbbe commit 4590824
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions pkg/client/udphandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,7 @@ import (
)

func UDPHandler(s *stack.Stack, device *net.Interface, udpAddr string) func(id stack.TransportEndpointID, pkt *stack.PacketBuffer) bool {
node, err := core.ParseNode(udpAddr)
if err != nil {
log.Debugf("[TUN-UDP] Error: parse gviosr udp forward addr %s: %v", udpAddr, err)
log.Fatal(err)
}
node.Client = &core.Client{
Connector: core.GvisorUDPOverTCPTunnelConnector(stack.TransportEndpointID{}),
Transporter: core.TCPTransporter(),
}
forwardChain := core.NewChain(5, node)

var r routing.Router
r, err = netroute.New()
r, err := netroute.New()
if err != nil {
log.Fatal(err)
}
Expand All @@ -51,7 +39,19 @@ func UDPHandler(s *stack.Stack, device *net.Interface, udpAddr string) func(id s
return
}
ctx := context.Background()
c, err := forwardChain.Node().Client.Dial(ctx, forwardChain.Node().Addr)
var node *core.Node
node, err = core.ParseNode(udpAddr)
if err != nil {
log.Debugf("[TUN-UDP] Error: parse gviosr udp forward addr %s: %v", udpAddr, err)
log.Fatal(err)
}
node.Client = &core.Client{
Connector: core.GvisorUDPOverTCPTunnelConnector(stack.TransportEndpointID{}),
Transporter: core.TCPTransporter(),
}
forwardChain := core.NewChain(5, node)
var c net.Conn
c, err = forwardChain.Node().Client.Dial(ctx, forwardChain.Node().Addr)
if err != nil {
log.Debugf("[TUN-TCP] Error: failed to dial remote conn: %v", err)
return
Expand Down

0 comments on commit 4590824

Please sign in to comment.