Add dial parallel for outbound dialer

This commit is contained in:
世界
2022-07-08 12:58:43 +08:00
parent d45007b501
commit 3699a57847
17 changed files with 253 additions and 39 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"net"
"net/netip"
"strings"
"time"
"github.com/sagernet/sing/common"
@@ -71,11 +72,14 @@ func (c *Client) Exchange(ctx context.Context, transport adapter.DNSTransport, m
if !c.disableCache {
c.storeCache(question, response)
}
return message, err
return response, err
}
func (c *Client) Lookup(ctx context.Context, transport adapter.DNSTransport, domain string, strategy C.DomainStrategy) ([]netip.Addr, error) {
dnsName, err := dnsmessage.NewName(domain)
if strings.HasPrefix(domain, ".") {
domain = domain[:len(domain)-1]
}
dnsName, err := dnsmessage.NewName(domain + ".")
if err != nil {
return nil, wrapError(err)
}