SMHttpDnsCacheManager.h
1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// SMHttpDnsCacheManager.h
// SMHttpDnsProxy
//
// Created by cairui01 on 16/12/2.
// Copyright © 2016年 baidu. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSUInteger, SMDNSCacheIPStack) {
SMDNSCacheIPStackv4,
SMDNSCacheIPStackv6
};
// 本地cache时间.单位秒
static const int cacheExpirationSecond = 60;
@interface SMHttpDnsCacheManager : NSObject
@property (atomic, strong, readwrite) NSNumber* cacheExpirSecond;
@property (atomic, readwrite) BOOL isCloudLoad;
@property (atomic, assign) BOOL isAtSpecificArea;
@property (atomic, copy) NSArray *specificHosts;
@property (atomic, copy) NSString *areaInfo; // HTTPDNS接口返回的地域.运营商信息,例如: "beijing.cmnet"
@property (atomic, assign) double lastAreaUpdateTimestamp; // 最近一次AreaInfo更新时间戳, areaInfo为空时为-1
+ (instancetype)sharedInstance;
- (void)setIps:(NSArray*)ips forHost:(NSString*)host ipStack:(SMDNSCacheIPStack)ipStack;
- (id)ipsForHost:(NSString*)host ipStack:(SMDNSCacheIPStack)ipStack;
- (void)setExtIps:(NSArray*)ips forHost:(NSString*)host ipStack:(SMDNSCacheIPStack)ipStack;
- (id)IpCacheForHost:(NSString *)host ipStack:(SMDNSCacheIPStack)ipStack;
- (void)clearMemory;
- (void)setLocalPrefetchSecond;
- (NSNumber*)localPrefetchSecond;
- (id)currentBackupIpForHost:(NSString*)host ipStack:(SMDNSCacheIPStack)ipStack;
- (id)backupIpsForHost:(NSString*)host ipStack:(SMDNSCacheIPStack)ipStack;
- (void)updateBackupIps:(NSDictionary*)ips version:(NSString *)version;
- (NSString *)backupIpsVersion;
- (void)setLocalDnsCache:(NSArray *)ips forHost:(NSString *)host ipStack:(SMDNSCacheIPStack)ipStack;
- (id)localDnsCacheForHost:(NSString *)host ipStack:(SMDNSCacheIPStack)ipStack;
@end