HappyDns alternatives and similar libraries
Based on the "Networking" category.
Alternatively, view HappyDns alternatives based on common mentions on social networks and blogs.
-
RealReachability
We need to observe the REAL reachability of network. That's what RealReachability do. -
Networking
DISCONTINUED. Easy HTTP Networking in Swift a NSURLSession wrapper with image caching support -
XMNetworking
A lightweight but powerful network library with simplified and expressive syntax based on AFNetworking. -
Digger
Digger is a lightweight download framework that requires only one line of code to complete the file download task -
SOAPEngine
This generic SOAP client allows you to access web services using a your iOS app, Mac OS X app and AppleTV app. -
TWRDownloadManager
A modern download manager based on NSURLSession to deal with asynchronous downloading, management and persistence of multiple files. -
ws ☁️
⚠️ Deprecated - (in favour of Networking) :cloud: Elegantly connect to a JSON api. (Alamofire + Promises + JSON Parsing) -
MultiPeer
📱📲 A wrapper for the MultipeerConnectivity framework for automatic offline data transmission between devices -
AFNetworking+RetryPolicy
Nice category that adds the ability to set the retry interval, retry count and progressiveness.
InfluxDB - Power Real-Time Data Analytics at Scale
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of HappyDns or a related project?
README
Happy DNS for Objective-C
用途
调用系统底层Dns解析库,可以使用114 等第三方dns解析,也可以集成dnspod等httpdns。另外也有丰富的hosts 域名配置。
安装
通过CocoaPods
pod "HappyDNS"
运行环境
使用方法
* 返回IP列表
NSMutableArray *array = [[NSMutableArray alloc] init];
[array addObject:[QNResolver systemResolver]];
[array addObject:[[QNResolver alloc] initWithAddress:@"119.29.29.29"]];
QNDnsManager *dns = [[QNDnsManager alloc] init:array networkInfo:[QNNetworkInfo normal]];
NSArray *ips = [dns query:@"www.qiniu.com"];
* url 请求,返回一个IP 替换URL 里的domain
NSMutableArray *array = [[NSMutableArray alloc] init];
[array addObject:[QNResolver systemResolver]];
[array addObject:[[QNResolver alloc] initWithAddress:@"119.29.29.29"]];
QNDnsManager *dns = [[QNDnsManager alloc] init:array networkInfo:[QNNetworkInfo normal]];
NSURL *u = [[NSURL alloc] initWithString:@"rtmp://www.qiniu.com/abc?q=1"];
NSURL *u2 = [dns queryAndReplaceWithIP:u];
- 兼容 getaddrinfo, 方便底层C代码接入
static QNDnsManager *dns = nil; dns = [[QNDnsManager alloc] init:@[ [QNResolver systemResolver] ] networkInfo:nil]; [QNDnsManager setGetAddrInfoBlock:^NSArray *(NSString *host) { return [dns query:host]; }]; struct addrinfo hints = {0}; struct addrinfo *ai = NULL; int x = qn_getaddrinfo(host, "http", &hints, &ai); qn_freeaddrinfo(ai); // 也可以用系统的freeaddrinfo, 代码一致,不过最好用这个
### 运行测试
$ xctool -workspace HappyDNS.xcworkspace -scheme "HappyDNS_Mac" -sdk macosx -configuration Release test -test-sdk macosx
指定测试
可以在单元测试上修改,熟悉使用
常见问题
- 如果碰到其他编译错误,请参考 CocoaPods 的 troubleshooting
- httpdns 在ios8 时不支持 nat64 模式下 IP 直接访问url,原因是 NSUrlConnection 不支持。无论是用http://119.29.29.29/d 还是http://[64:ff9b::771d:1d1d]/d 都不行,此时可以使用localdns方式。
- 如果软件有国外的使用情况时,建议初始化程序采取这样的方式
Objective-C QNDnsManager *dns; if([QNDnsManager needHttpDns]){ NSMutableArray *array = [[NSMutableArray alloc] init]; [array addObject:[[QNResolver alloc] initWithAddress:@"119.29.29.29"]]; [array addObject:[QNResolver systemResolver]]; dns = [[QNDnsManager alloc] init:array networkInfo:[QNNetworkInfo normal]]; }else{ NSMutableArray *array = [[NSMutableArray alloc] init]; [array addObject:[QNResolver systemResolver]]; [array addObject:[[QNResolver alloc] initWithAddress:@"8.8.8.8"]]; dns = [[QNDnsManager alloc] init:array networkInfo:[QNNetworkInfo normal]]; }
代码贡献
详情参考代码提交指南。
贡献记录
联系我们
- 如果有什么问题,可以到问答社区提问,问答社区
- 如果发现了bug, 欢迎提交 issue
- 如果有功能需求,欢迎提交 issue
- 如果要提交代码,欢迎提交 pull request
- 欢迎关注我们的微信 微博,及时获取动态信息。
代码许可
The MIT License (MIT).详情见 License文件.
*Note that all licence references and agreements mentioned in the HappyDns README section above
are relevant to that project's source code only.