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

@ -16,9 +16,8 @@ import (
type Mixed struct {
*System
stack *stack.Stack
endpoint *channel.Endpoint
udpForwarder *UDPForwarder
stack *stack.Stack
endpoint *channel.Endpoint
}
func NewMixed(
@ -43,11 +42,9 @@ func (m *Mixed) Start() error {
if err != nil {
return err
}
udpForwarder := NewUDPForwarder(m.ctx, ipStack, m.handler, m.udpTimeout)
ipStack.SetTransportProtocolHandler(udp.ProtocolNumber, udpForwarder.HandlePacket)
ipStack.SetTransportProtocolHandler(udp.ProtocolNumber, NewUDPForwarder(m.ctx, ipStack, m.handler, m.udpTimeout).HandlePacket)
m.stack = ipStack
m.endpoint = endpoint
m.udpForwarder = udpForwarder
go m.tunLoop()
go m.packetLoop()
return nil
@ -62,7 +59,6 @@ func (m *Mixed) Close() error {
for _, endpoint := range m.stack.CleanupEndpoints() {
endpoint.Abort()
}
m.udpNat.Close()
return m.System.Close()
}