Revert "Update udpant usages"

This commit is contained in:
世界 2024-11-27 18:04:39 +08:00
parent 59a6bdc1fa
commit 091b5da950
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
5 changed files with 8 additions and 22 deletions

View file

@ -34,7 +34,6 @@ type GVisor struct {
logger logger.Logger
stack *stack.Stack
endpoint stack.LinkEndpoint
udpForwarder *UDPForwarder
}
type GVisorTun interface {
@ -72,11 +71,9 @@ func (t *GVisor) Start() error {
return err
}
ipStack.SetTransportProtocolHandler(tcp.ProtocolNumber, NewTCPForwarder(t.ctx, ipStack, t.handler).HandlePacket)
udpForwarder := NewUDPForwarder(t.ctx, ipStack, t.handler, t.udpTimeout)
ipStack.SetTransportProtocolHandler(udp.ProtocolNumber, udpForwarder.HandlePacket)
ipStack.SetTransportProtocolHandler(udp.ProtocolNumber, NewUDPForwarder(t.ctx, ipStack, t.handler, t.udpTimeout).HandlePacket)
t.stack = ipStack
t.endpoint = linkEndpoint
t.udpForwarder = udpForwarder
return nil
}
@ -89,7 +86,6 @@ func (t *GVisor) Close() error {
for _, endpoint := range t.stack.CleanupEndpoints() {
endpoint.Abort()
}
t.udpForwarder.Close()
return nil
}