-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(iOS): add setDNSResolve interface
- Loading branch information
Showing
4 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// CicadaPlayerGlobalSettings.h | ||
// CicadaPlayerGlobalSettings | ||
// | ||
// Created by huang_jiafa on 2020/04/09. | ||
// Copyright © 2020 com.alibaba.AliyunPlayer. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
OBJC_EXPORT | ||
@interface CicadaPlayerGlobalSettings : NSObject | ||
|
||
/** | ||
@brief 设置域名对应的解析ip | ||
@param host 域名,需指定端口(http默认端口80,https默认端口443)。例如player.alicdn.com:443 | ||
@param ip 相应的ip,设置为空字符串清空设定。 | ||
*/ | ||
/**** | ||
@brief Set a DNS ip to resolve the host. | ||
@param host The host. Need to specify the port (http defualt port is 80,https default port is 443). E.g player.alicdn.com:443 | ||
@param ip The ip address, set as empty string to clear the setting. | ||
*/ | ||
+(void)setDNSResolve:(NSString *)host ip:(NSString *)ip; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#import "CicadaPlayerGlobalSettings.h" | ||
#import "utils/globalSettings.h" | ||
|
||
@interface CicadaPlayerGlobalSettings () | ||
{ | ||
} | ||
@end | ||
|
||
@implementation CicadaPlayerGlobalSettings | ||
|
||
+(void)setDNSResolve:(NSString *)host ip:(NSString *)ip | ||
{ | ||
if (nil == host) { | ||
return; | ||
} | ||
|
||
const string theHost = [host UTF8String]; | ||
Cicada::globalSettings::getSetting()->removeResolve(theHost, ""); | ||
|
||
string theip; | ||
if (nil != ip && 0 < [ip length]) { | ||
theip = [ip UTF8String]; | ||
Cicada::globalSettings::getSetting()->addResolve(theHost, theip); | ||
} | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters