Files
waf-platform/EdgeHttpDNS/sdk/ios
2026-02-28 18:55:33 +08:00
..
2026-02-28 18:55:33 +08:00
2026-02-20 17:56:24 +08:00
2026-02-20 17:56:24 +08:00
2026-02-20 17:56:24 +08:00
2026-02-20 17:56:24 +08:00
2026-02-20 17:56:24 +08:00
2026-02-20 17:56:24 +08:00
2026-02-28 18:55:33 +08:00

HTTPDNS iOS SDK (SNI Hidden v1.0.0)

1. Init

#import <TrustHTTPDNS/TrustHTTPDNS.h>

HttpdnsEdgeService *service = [[HttpdnsEdgeService alloc]
    initWithAppId:@"app1f1ndpo9"
primaryServiceHost:@"httpdns-a.example.com"
 backupServiceHost:@"httpdns-b.example.com"
        servicePort:443
         signSecret:@"your-sign-secret"]; // optional if sign is enabled

2. Resolve

[service resolveHost:@"api.business.com" queryType:@"A" completion:^(HttpdnsEdgeResolveResult * _Nullable result, NSError * _Nullable error) {
    if (error != nil) {
        return;
    }
    NSLog(@"requestId=%@ ipv4=%@ ipv6=%@ ttl=%ld", result.requestId, result.ipv4s, result.ipv6s, (long)result.ttl);
}];

3. Official Request Adapter (IP + Host)

NSURL *url = [NSURL URLWithString:@"https://api.business.com/v1/ping"];
[service requestURL:url method:@"GET" headers:@{@"Accept": @"application/json"} body:nil completion:^(NSData * _Nullable data, NSHTTPURLResponse * _Nullable response, NSError * _Nullable error) {
    if (error != nil) {
        return;
    }
    NSLog(@"status=%ld", (long)response.statusCode);
}];

Behavior is fixed:

  • Resolve by /resolve.
  • Connect to resolved IP over HTTPS.
  • Keep Host header as business domain.
  • No fallback to domain direct request.

4. Public Errors

  • NO_IP_AVAILABLE
  • TLS_EMPTY_SNI_FAILED
  • HOST_ROUTE_REJECTED
  • RESOLVE_SIGN_INVALID

5. Removed Public Params

Do not expose legacy public parameters:

  • accountId
  • serviceDomain
  • endpoint
  • aesSecretKey