You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
3.5 KiB

2 years ago
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#import <Foundation/Foundation.h>
#import "HttpdnsDegradationDelegate.h"
#import "HttpdnsLoggerDelegate.h"
#define ALICLOUD_HTTPDNS_DEPRECATED(explain) __attribute__((deprecated(explain)))
@interface HttpDnsService: NSObject
@property (nonatomic, assign, readonly) int accountID;
@property (nonatomic, copy, readonly) NSString *secretKey;
@property (nonatomic, weak, setter=setDelegateForDegradationFilter:) id<HttpDNSDegradationDelegate> delegate;
@property (nonatomic, assign) NSTimeInterval timeoutInterval;
- (instancetype)autoInit;
- (instancetype)initWithAccountID:(int)accountID;
/*!
* @brief
* @details HTTPDNS Account ID secretKey
* Account ID secretKey
*
* @param accountID HTTPDNS Account ID
* @param secretKey secretKey
*/
- (instancetype)initWithAccountID:(int)accountID secretKey:(NSString *)secretKey;
/*!
* @brief App
* @param authCurrentTime
* @details `(NSUInteger)[[NSDate date] timeIntervalSince1970]`
* @attention APP APP
*/
- (void)setAuthCurrentTime:(NSUInteger)authCurrentTime;
+ (instancetype)sharedInstance;
- (void)setCachedIPEnabled:(BOOL)enable;
- (void)setPreResolveHosts:(NSArray *)hosts;
- (NSString *)getIpByHostAsync:(NSString *)host;
- (NSArray *)getIpsByHostAsync:(NSString *)host;
- (NSString *)getIpByHostAsyncInURLFormat:(NSString *)host;
- (void)setHTTPSRequestEnabled:(BOOL)enable;
- (void)setExpiredIPEnabled:(BOOL)enable;
- (void)setLogEnabled:(BOOL)enable;
- (void)setRegion:(NSString *)region;
- (void)setPreResolveAfterNetworkChanged:(BOOL)enable;
- (void)setIPRankingDatasource:(NSDictionary<NSString *, NSNumber *> *)IPRankingDatasource;
- (void)setLogHandler:(id<HttpdnsLoggerProtocol>)logHandler;
- (NSString *)getSessionId;
- (void)enableIPv6:(BOOL)enable;
- (NSString *)getIPv6ByHostAsync:(NSString *)host;
- (void)setSdnsGlobalParams:(NSDictionary<NSString *, NSString *> *)params;
- (void)clearSdnsGlobalParams;
- (NSDictionary *)getIpsByHostAsync:(NSString *)host withParams:(NSDictionary<NSString *, NSString *> *)params withCacheKey:(NSString *)cacheKey;
@end
@interface HttpDnsService (HttpdnsDeprecated)
- (void)setAccountID:(int)accountID ALICLOUD_HTTPDNS_DEPRECATED("Deprecated in v1.5.2. Use -[HttpDnsService initWithAccountID:] instead.");
@end