feat: add candidate-bound domain qualification and planning
Co-authored-by: GPT-6 <gpt-6@openai.com>
This commit is contained in:
1 parent
2242643000
commit
573da3f797
15 files changed
+2486
-10
No files matched your search
@@ -326,10 +326,13 @@ func approvedResourceIP(r resourceCheckSpec, ip net.IP) bool {
|
||||
}
|
||||
|
||||
type resourceCheckDeps struct {
|
||||
lookup func(string) (string, bool)
|
||||
guard func() error
|
||||
resolve func(context.Context, string, string) ([]net.IP, error)
|
||||
runner subprocessRunner
|
||||
// Qualification must distinguish infrastructure from verified peer negatives.
|
||||
// Monitoring retains its existing coarse outcome behavior.
|
||||
qualification bool
|
||||
lookup func(string) (string, bool)
|
||||
guard func() error
|
||||
resolve func(context.Context, string, string) ([]net.IP, error)
|
||||
runner subprocessRunner
|
||||
}
|
||||
|
||||
func resolveResourceIPs(ctx context.Context, server, host string) ([]net.IP, error) {
|
||||
@@ -376,6 +379,16 @@ func runResourceProtocol(ctx context.Context, service string, r resourceCheckSpe
|
||||
probeCtx, cancel := context.WithTimeout(ctx, time.Duration(r.TimeoutMS)*time.Millisecond)
|
||||
defer cancel()
|
||||
ips, err := d.resolve(probeCtx, server, r.host)
|
||||
if d.qualification && err != nil {
|
||||
var dns *net.DNSError
|
||||
knownTimeout := probeCtx.Err() != nil && managedRecoveryTimeoutSafe(err)
|
||||
if !knownTimeout && (!errors.As(err, &dns) || !dns.IsNotFound) {
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
if d.qualification && err == nil && (len(ips) == 0 || len(ips) > 64) {
|
||||
return result, errResourceConfig
|
||||
}
|
||||
if err == nil && len(ips) > 0 && len(ips) <= 64 {
|
||||
approved := true
|
||||
for _, ip := range ips {
|
||||
@@ -391,6 +404,12 @@ func runResourceProtocol(ctx context.Context, service string, r resourceCheckSpe
|
||||
pin := r.host + ":443:" + net.JoinHostPort(ips[0].String(), "443")
|
||||
options := resourceTransferOptions{generic: true, method: r.Method, limit: r.Expect.MaxBytes, timeout: time.Duration(r.TimeoutMS) * time.Millisecond, config: r.privateConfig + "connect-to = " + privateCurlValue(pin) + "\n"}
|
||||
transfer, _, err := collectResourceTransferOptions(probeCtx, proxy, r.URL, r.host, protocol, false, d.runner, options)
|
||||
if d.qualification && err != nil {
|
||||
knownTimeout := probeCtx.Err() != nil && managedRecoveryTimeoutSafe(err)
|
||||
if !knownTimeout && !resourceRejectionOnly(err) && !managedAssetTransferNonpass(err) {
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
result.Outcome = "transfer_failed"
|
||||
if err == nil {
|
||||
result.Bytes, result.TimeMS, result.Status = len(transfer.Body), transfer.LatencyMS, transfer.Status
|
||||
|
||||
Reference in new issue
Block a user