Fix tproxy inbound

This commit is contained in:
世界 2023-02-19 18:56:38 +08:00
parent 73c068b96f
commit 86e55c5c1c
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -100,9 +100,10 @@ type tproxyPacketWriter struct {
func (w *tproxyPacketWriter) WritePacket(buffer *buf.Buffer, destination M.Socksaddr) error {
defer buffer.Release()
if w.destination == destination && w.conn != nil {
_, err := w.conn.WriteToUDPAddrPort(buffer.Bytes(), M.AddrPortFromNet(w.source.LocalAddr()))
if err == nil {
conn := w.conn
if w.destination == destination && conn != nil {
_, err := conn.WriteToUDPAddrPort(buffer.Bytes(), M.AddrPortFromNet(w.source.LocalAddr()))
if err != nil {
w.conn = nil
}
return err