管理端全部功能跑通
This commit is contained in:
31
EdgeAdmin/web/views/@default/httpdns/apps/docs/ios.md
Normal file
31
EdgeAdmin/web/views/@default/httpdns/apps/docs/ios.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# iOS SDK
|
||||
|
||||
## 初始化
|
||||
|
||||
```objc
|
||||
HttpdnsEdgeService *service = [[HttpdnsEdgeService alloc]
|
||||
initWithAppId:@"app1f1ndpo9"
|
||||
primaryServiceHost:@"httpdns-a.example.com"
|
||||
backupServiceHost:@"httpdns-b.example.com"
|
||||
servicePort:443
|
||||
signSecret:@"your-sign-secret"];
|
||||
```
|
||||
|
||||
## 解析
|
||||
|
||||
```objc
|
||||
[service resolveHost:@"api.business.com" queryType:@"A" completion:^(HttpdnsEdgeResolveResult * _Nullable result, NSError * _Nullable error) {
|
||||
// result.ipv4s / result.ipv6s
|
||||
}];
|
||||
```
|
||||
|
||||
## 官方业务适配器
|
||||
|
||||
```objc
|
||||
NSURL *url = [NSURL URLWithString:@"https://api.business.com/v1/ping"];
|
||||
[service requestURL:url method:@"GET" headers:nil body:nil completion:^(NSData * _Nullable data, NSHTTPURLResponse * _Nullable response, NSError * _Nullable error) {
|
||||
// handle
|
||||
}];
|
||||
```
|
||||
|
||||
固定策略:IP 直连 + 空 SNI + Host=真实域名,不回退到带 SNI。
|
||||
Reference in New Issue
Block a user