Fix create packet conn

This commit is contained in:
世界 2022-06-27 17:24:50 +08:00
parent f6144cded5
commit 605697c1ae
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -305,7 +305,7 @@ func NewPacketConn(conn net.PacketConn) N.NetPacketConn {
} else if udpConn, ok := conn.(*net.UDPConn); ok {
return &ExtendedUDPConn{udpConn}
} else {
return &ExtendedPacketConn{udpConn}
return &ExtendedPacketConn{conn}
}
}
@ -343,7 +343,7 @@ type ExtendedPacketConn struct {
}
func (w *ExtendedPacketConn) ReadPacket(buffer *buf.Buffer) (M.Socksaddr, error) {
_, addr, err := ReadFrom(w, buffer)
_, addr, err := buffer.ReadPacketFrom(w)
if err != nil {
return M.Socksaddr{}, err
}