mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-22 00:21:30 +00:00
Update WriteToUDPAddrPort usage since fixed by go1.18.5
This commit is contained in:
parent
d4cce1b5b9
commit
f6f3390490
|
@ -43,9 +43,9 @@ func (w *ResolveUDPConn) WritePacket(buffer *buf.Buffer, destination M.Socksaddr
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return common.Error(w.UDPConn.WriteTo(buffer.Bytes(), M.SocksaddrFrom(addresses[0], destination.Port).UDPAddr()))
|
||||
return common.Error(w.UDPConn.WriteToUDPAddrPort(buffer.Bytes(), M.SocksaddrFrom(addresses[0], destination.Port).AddrPort()))
|
||||
}
|
||||
return common.Error(w.UDPConn.WriteToUDP(buffer.Bytes(), destination.UDPAddr()))
|
||||
return common.Error(w.UDPConn.WriteToUDPAddrPort(buffer.Bytes(), destination.AddrPort()))
|
||||
}
|
||||
|
||||
func (w *ResolveUDPConn) Upstream() any {
|
||||
|
|
|
@ -46,7 +46,6 @@ type myInboundAdapter struct {
|
|||
|
||||
tcpListener *net.TCPListener
|
||||
udpConn *net.UDPConn
|
||||
packetForce6 bool
|
||||
packetAccess sync.RWMutex
|
||||
packetOutboundClosed chan struct{}
|
||||
packetOutbound chan *myInboundPacket
|
||||
|
@ -83,7 +82,6 @@ func (a *myInboundAdapter) Start() error {
|
|||
return err
|
||||
}
|
||||
a.udpConn = udpConn
|
||||
a.packetForce6 = M.SocksaddrFromNet(udpConn.LocalAddr()).Addr.Is6()
|
||||
a.packetOutboundClosed = make(chan struct{})
|
||||
a.packetOutbound = make(chan *myInboundPacket)
|
||||
if a.oobPacketHandler != nil {
|
||||
|
@ -340,9 +338,6 @@ func (a *myInboundAdapter) writePacket(buffer *buf.Buffer, destination M.Socksad
|
|||
}
|
||||
return common.Error(a.udpConn.WriteTo(buffer.Bytes(), udpAddr))
|
||||
}
|
||||
if a.packetForce6 && destination.Addr.Is4() {
|
||||
destination.Addr = netip.AddrFrom16(destination.Addr.As16())
|
||||
}
|
||||
return common.Error(a.udpConn.WriteToUDPAddrPort(buffer.Bytes(), destination.AddrPort()))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue