30 lines
1000 B
Diff
30 lines
1000 B
Diff
From 5c995d97f43e8e97ee0cb3d1aa12450d3968c8d2 Mon Sep 17 00:00:00 2001
|
|
From: AkinoKaede <i@akinokae.de>
|
|
Date: Sun, 2 Jul 2023 09:47:33 +0800
|
|
Subject: [PATCH] fix: panic in dns over quic when address is a ip
|
|
|
|
---
|
|
app/dns/nameserver_quic.go | 11 ++++++++++-
|
|
1 file changed, 10 insertions(+), 1 deletion(-)
|
|
|
|
--- a/app/dns/nameserver_quic.go
|
|
+++ b/app/dns/nameserver_quic.go
|
|
@@ -378,7 +378,16 @@ func (s *QUICNameServer) getConnection(c
|
|
|
|
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,
|