mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 11:42:43 +08:00
fix: doq maybe crash when use adapter
This commit is contained in:
parent
e995003c27
commit
8343c3597e
|
@ -7,13 +7,13 @@ import (
|
|||
"fmt"
|
||||
"github.com/Dreamacro/clash/component/dialer"
|
||||
"github.com/Dreamacro/clash/component/resolver"
|
||||
"github.com/lucas-clemente/quic-go"
|
||||
"net"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/Dreamacro/clash/log"
|
||||
"github.com/lucas-clemente/quic-go"
|
||||
D "github.com/miekg/dns"
|
||||
)
|
||||
|
||||
|
@ -174,7 +174,7 @@ func (dc *quicClient) openSession() (quic.Connection, error) {
|
|||
|
||||
wrapConn, ok := conn.(*wrapPacketConn)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("quio create packet failed")
|
||||
return nil, fmt.Errorf("quic create packet failed")
|
||||
}
|
||||
|
||||
udp = wrapConn
|
||||
|
|
|
@ -143,6 +143,14 @@ func (wpc *wrapPacketConn) RemoteAddr() net.Addr {
|
|||
return wpc.rAddr
|
||||
}
|
||||
|
||||
func (wpc *wrapPacketConn) LocalAddr() net.Addr {
|
||||
if wpc.PacketConn.LocalAddr() == nil {
|
||||
return &net.UDPAddr{IP: net.IPv4zero, Port: 0}
|
||||
} else {
|
||||
return wpc.PacketConn.LocalAddr()
|
||||
}
|
||||
}
|
||||
|
||||
func dialContextExtra(ctx context.Context, adapterName string, network string, dstIP netip.Addr, port string, opts ...dialer.Option) (net.Conn, error) {
|
||||
adapter, ok := tunnel.Proxies()[adapterName]
|
||||
if !ok {
|
||||
|
|
Loading…
Reference in New Issue
Block a user