Fix DNS fallback

This commit is contained in:
世界 2025-02-26 07:13:18 +08:00
parent 331edbacff
commit c19c6afc76
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
2 changed files with 8 additions and 1 deletions

View file

@ -139,6 +139,9 @@ func (t *Transport) tryOneName(ctx context.Context, config *dnsConfig, fqdn stri
}
func (t *Transport) exchangeOne(ctx context.Context, server M.Socksaddr, question mDNS.Question, timeout time.Duration, useTCP, ad bool) (*mDNS.Msg, error) {
if server.Port == 0 {
server.Port = 53
}
var networks []string
if useTCP {
networks = []string{N.NetworkTCP}

View file

@ -58,8 +58,12 @@ func (f *FallbackTransport) Start(stage adapter.StartStage) error {
return nil
}
func (f *FallbackTransport) Close() error {
return nil
}
func (f *FallbackTransport) Exchange(ctx context.Context, message *mDNS.Msg) (*mDNS.Msg, error) {
if f.fallback {
if !f.fallback {
return f.DNSTransport.Exchange(ctx, message)
}
question := message.Question[0]