1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-14 16:25:57 -05:00

fix: panic in dns over quic when address is a ip

This commit is contained in:
AkinoKaede 2023-07-02 09:47:33 +08:00
parent e102d52e7c
commit 5c995d97f4
No known key found for this signature in database
GPG Key ID: D2192CF5FF4AC1C7

View File

@ -378,7 +378,16 @@ func (s *QUICNameServer) getConnection(ctx context.Context) (quic.Connection, er
func (s *QUICNameServer) openConnection(ctx context.Context) (quic.Connection, error) {
tlsConfig := tls.Config{
ServerName: s.destination.Address.Domain(),
ServerName: func() string {
switch s.destination.Address.Family() {
case net.AddressFamilyIPv4, net.AddressFamilyIPv6:
return s.destination.Address.IP().String()
case net.AddressFamilyDomain:
return s.destination.Address.Domain()
default:
panic("unknown address family")
}
}(),
}
quicConfig := &quic.Config{
HandshakeIdleTimeout: handshakeIdleTimeout,