Skip to content

Commit

Permalink
Merge pull request #75 from YangSen-qn/master
Browse files Browse the repository at this point in the history
share udp dns queue
  • Loading branch information
Mei-Zhao authored Jun 2, 2022
2 parents 45f2d81 + 8a60ef5 commit 4cabed4
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#Changelog
## 1.0.2 (2022-06-02)
* 优化 udp dns reslover 的线程队列使用


## 1.0.1 (2021-11-25)
* 支持 Swift Package Manager
* Dnspod 默认 server ip 切至 119.29.29.98

## 1.0.0 (2021-09-02)

* 新增 dns udp 解析 api
* 新增 doh 解析 api
* 调整 QNRecord api
Expand Down
2 changes: 1 addition & 1 deletion HappyDNS.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'HappyDNS'
s.version = '1.0.1'
s.version = '1.0.2'
s.summary = 'DNS library for iOS and Mac'
s.homepage = 'https://github.com/qiniu/happy-dns-objc'
s.social_media_url = 'http://weibo.com/qiniutek'
Expand Down
4 changes: 0 additions & 4 deletions HappyDNS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@
3159B7DD26B019A400380B4F /* QNDohResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = 3159B7D826B019A400380B4F /* QNDohResolver.h */; settings = {ATTRIBUTES = (Public, ); }; };
3159B7F326B0F7B400380B4F /* DnsServerResolverTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 3159B7F126B0F7B400380B4F /* DnsServerResolverTest.m */; };
3159B7F426B0F7B400380B4F /* DnsServerResolverTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 3159B7F126B0F7B400380B4F /* DnsServerResolverTest.m */; };
3159B7F526B0F7B400380B4F /* DnsServerResolverTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 3159B7F126B0F7B400380B4F /* DnsServerResolverTest.m */; };
3159B80526B1051200380B4F /* DohResolverTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 3159B80326B1051200380B4F /* DohResolverTest.m */; };
3159B80626B1051200380B4F /* DohResolverTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 3159B80326B1051200380B4F /* DohResolverTest.m */; };
3159B80726B1051200380B4F /* DohResolverTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 3159B80326B1051200380B4F /* DohResolverTest.m */; };
3159B81626B10CBC00380B4F /* QNDnsResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = 3159B81426B10CBC00380B4F /* QNDnsResolver.h */; };
3159B81726B10CBC00380B4F /* QNDnsResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = 3159B81426B10CBC00380B4F /* QNDnsResolver.h */; };
3159B81826B10CBC00380B4F /* QNDnsResolver.m in Sources */ = {isa = PBXBuildFile; fileRef = 3159B81526B10CBC00380B4F /* QNDnsResolver.m */; };
Expand Down Expand Up @@ -871,8 +869,6 @@
B0E79D992105DB13000F6903 /* QNHijackingDetectWrapper.m in Sources */,
B0E79D9A2105DB13000F6903 /* QNTxtResolver.m in Sources */,
3159B77726B00B6000380B4F /* QNDnsMessage.m in Sources */,
3159B7F526B0F7B400380B4F /* DnsServerResolverTest.m in Sources */,
3159B80726B1051200380B4F /* DohResolverTest.m in Sources */,
B0E79D9C2105DB13000F6903 /* QNDnspodEnterprise.m in Sources */,
3159B7BB26B00C4400380B4F /* NSData+QNRW.m in Sources */,
3159B81A26B10CBC00380B4F /* QNDnsResolver.m in Sources */,
Expand Down
13 changes: 11 additions & 2 deletions HappyDNS/Dns/QNDnsUdpResolver.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#import "QNDnsError.h"
#import "QNDnsResponse.h"
#import "QNDnsUdpResolver.h"
#import <QNAsyncUdpSocket.h>
#import "QNAsyncUdpSocket.h"

@interface QNDnsFlow : NSObject

Expand Down Expand Up @@ -69,9 +69,18 @@ + (instancetype)resolverWithServerIPs:(NSArray <NSString *> *)servers
return resolver;
}

+ (dispatch_queue_t)defaultQueue {
static dispatch_once_t onceToken;
static dispatch_queue_t timerQueue;
dispatch_once(&onceToken, ^{
timerQueue = dispatch_queue_create("com.qiniu.dns.udp.queue", DISPATCH_QUEUE_CONCURRENT);
});
return timerQueue;
}

- (dispatch_queue_t)queue {
if (_queue == nil) {
_queue = dispatch_queue_create("com.qiniu.dns.server.queue", DISPATCH_QUEUE_CONCURRENT);
_queue = [QNDnsUdpResolver defaultQueue];
}
return _queue;
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ File -> Swift Packages -> Add Package Dependency,输入 HappyDNS 库链接,
库对接:
let package = Package(
dependencies: [
.package(url: "https://github.com/qiniu/happy-dns-objc", from: "1.0.1")
.package(url: "https://github.com/qiniu/happy-dns-objc", from: "1.0.2")
],
// ...
)
Expand Down

0 comments on commit 4cabed4

Please sign in to comment.