Skip to content

Commit

Permalink
Add case check
Browse files Browse the repository at this point in the history
  • Loading branch information
fortuna committed Dec 5, 2023
1 parent 704a8eb commit 337d50e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions x/examples/find-strategy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,26 +368,28 @@ func (f *StrategyFinder) testDNSClient(clientId string, client *dnsClient, testD
f.log("client=%v", clientId)
ctx, cancel := context.WithTimeout(context.Background(), f.TestTimeout)
defer cancel()

var request dns.Msg
request.SetQuestion(testDomain, dns.TypeA)
requestDomain := mixCase(testDomain)
request.SetQuestion(requestDomain, dns.TypeA)
response, err := client.ExchangeContext(ctx, &request)
if err != nil {
f.log("; status=error: %v ❌\n", err)
return err
}
ips, err := evaluateResponse(response, testDomain)
ips, err := evaluateResponse(response, requestDomain)
if err != nil {
f.log("; status=%v ❌\n", err)
return err
}
f.log("; status=ok (%v) ✅\n", ips)
for _, ip := range ips {
f.FindTLSStrategy(testDomain, ip, &transport.TCPStreamDialer{}, client)
f.findTLSStrategy(testDomain, ip, &transport.TCPStreamDialer{}, client)
}
return nil
}

func (f *StrategyFinder) FindTLSStrategy(domain string, ip net.IP, dialer transport.StreamDialer, dnsClient DNSClient) error {
func (f *StrategyFinder) findTLSStrategy(domain string, ip net.IP, dialer transport.StreamDialer, dnsClient DNSClient) error {
address := net.JoinHostPort(domain, "443")
for _, strategy := range []string{"direct", "split:1", "split:2", "split:5", "omitsni", "tlsfrag:1"} {
ctx, cancel := context.WithTimeout(context.Background(), f.TestTimeout)
Expand Down

0 comments on commit 337d50e

Please sign in to comment.