QNDnsPrefetch.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //
  2. // QNDnsPrefetch.h
  3. // QnDNS
  4. //
  5. // Created by yangsen on 2020/3/26.
  6. // Copyright © 2020 com.qiniu. All rights reserved.
  7. //
  8. #import "QNDns.h"
  9. #import "QNUpToken.h"
  10. #import "QNConfiguration.h"
  11. #import "QNTransactionManager.h"
  12. NS_ASSUME_NONNULL_BEGIN
  13. #define kQNDnsPrefetch [QNDnsPrefetch shared]
  14. @interface QNDnsPrefetch : NSObject
  15. /// 最近一次预取错误信息
  16. @property(nonatomic, copy, readonly)NSString *lastPrefetchedErrorMessage;
  17. + (instancetype)shared;
  18. /// 根据host从缓存中读取DNS信息
  19. /// @param host 域名
  20. - (NSArray <id <QNIDnsNetworkAddress> > *)getInetAddressByHost:(NSString *)host;
  21. @end
  22. @interface QNTransactionManager(Dns)
  23. /// 添加加载本地dns事务
  24. - (void)addDnsLocalLoadTransaction;
  25. /// 添加检测并预取dns事务 如果未开启DNS 或 事务队列中存在token对应的事务未处理,则返回NO
  26. /// @param currentZone 当前区域
  27. /// @param token token信息
  28. - (BOOL)addDnsCheckAndPrefetchTransaction:(QNZone *)currentZone token:(QNUpToken *)token;
  29. /// 设置定时事务:检测已缓存DNS有效情况事务 无效会重新预取
  30. - (void)setDnsCheckWhetherCachedValidTransactionAction;
  31. @end
  32. NS_ASSUME_NONNULL_END