HTTPDNS iOS SDK (SNI Hidden v1.0.0)
1. Init
#import <AlicloudHTTPDNS/AlicloudHTTPDNS.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
Hostheader as business domain. - No fallback to domain direct request.
4. Public Errors
NO_IP_AVAILABLETLS_EMPTY_SNI_FAILEDHOST_ROUTE_REJECTEDRESOLVE_SIGN_INVALID
5. Removed Public Params
Do not expose legacy public parameters:
accountIdserviceDomainendpointaesSecretKey