pr review fixes

This commit is contained in:
Quentin McGaw
2026-06-05 15:25:44 +00:00
parent b48ba8cb0a
commit 2d2c371303
4 changed files with 16 additions and 11 deletions
+10 -6
View File
@@ -2,6 +2,7 @@ package restrictednet
import (
"context"
"errors"
"fmt"
"net/http"
@@ -48,12 +49,15 @@ func (c *Client) OpenHTTPSByDomain(ctx context.Context, domain string) (
return nil, nil, fmt.Errorf("no IP address found for name %q", domain)
}
selectedIP := resolvedIPs[0]
httpClient, cleanup, err = c.OpenHTTPS(ctx, domain, selectedIP)
if err != nil {
return nil, nil, fmt.Errorf("opening HTTPS: %w", err)
errs := make([]error, 0, len(resolvedIPs))
for _, ip := range resolvedIPs {
httpClient, cleanup, err := c.OpenHTTPS(ctx, domain, ip)
if err != nil {
errs = append(errs, fmt.Errorf("for %s: %w", ip, err))
continue
}
return httpClient, cleanup, nil
}
return httpClient, cleanup, nil
return nil, nil, fmt.Errorf("opening HTTPS to %s: %w", domain, errors.Join(errs...))
}