Skip to content

Commit

Permalink
feat:将静态变量修改为宏命令
Browse files Browse the repository at this point in the history
  • Loading branch information
erichuyuehu committed Jul 29, 2024
1 parent d49918c commit 056b2c3
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 83 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"editor.formatOnSave": false
}
16 changes: 8 additions & 8 deletions MSDKDns.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@
LINK_WITH_STANDARD_LIBRARIES = NO;
MACH_O_TYPE = mh_object;
MACOSX_DEPLOYMENT_TARGET = "";
MARKETING_VERSION = 1.10.3;
MARKETING_VERSION = 1.10.4;
ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = "-fembed-bitcode";
OTHER_LDFLAGS = (
Expand Down Expand Up @@ -1104,7 +1104,7 @@
LINK_WITH_STANDARD_LIBRARIES = NO;
MACH_O_TYPE = mh_object;
MACOSX_DEPLOYMENT_TARGET = "";
MARKETING_VERSION = 1.10.3;
MARKETING_VERSION = 1.10.4;
OTHER_CFLAGS = "-fembed-bitcode";
OTHER_LDFLAGS = (
"-ObjC",
Expand Down Expand Up @@ -1147,7 +1147,7 @@
LINK_WITH_STANDARD_LIBRARIES = NO;
MACH_O_TYPE = mh_object;
MACOSX_DEPLOYMENT_TARGET = "";
MARKETING_VERSION = 1.10.3;
MARKETING_VERSION = 1.10.4;
ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = "-fembed-bitcode";
OTHER_LDFLAGS = (
Expand Down Expand Up @@ -1189,7 +1189,7 @@
LINK_WITH_STANDARD_LIBRARIES = NO;
MACH_O_TYPE = mh_object;
MACOSX_DEPLOYMENT_TARGET = "";
MARKETING_VERSION = 1.10.3;
MARKETING_VERSION = 1.10.4;
OTHER_CFLAGS = "-fembed-bitcode";
OTHER_LDFLAGS = (
"-ObjC",
Expand Down Expand Up @@ -1238,7 +1238,7 @@
LINK_WITH_STANDARD_LIBRARIES = NO;
MACH_O_TYPE = mh_object;
MACOSX_DEPLOYMENT_TARGET = "";
MARKETING_VERSION = 1.10.3;
MARKETING_VERSION = 1.10.4;
ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = "-fembed-bitcode";
OTHER_LDFLAGS = (
Expand Down Expand Up @@ -1286,7 +1286,7 @@
LINK_WITH_STANDARD_LIBRARIES = NO;
MACH_O_TYPE = mh_object;
MACOSX_DEPLOYMENT_TARGET = "";
MARKETING_VERSION = 1.10.3;
MARKETING_VERSION = 1.10.4;
OTHER_CFLAGS = "-fembed-bitcode";
OTHER_LDFLAGS = (
"-ObjC",
Expand Down Expand Up @@ -1324,7 +1324,7 @@
LINK_WITH_STANDARD_LIBRARIES = NO;
MACH_O_TYPE = mh_object;
MACOSX_DEPLOYMENT_TARGET = "";
MARKETING_VERSION = 1.10.3;
MARKETING_VERSION = 1.10.4;
ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = "-fembed-bitcode";
OTHER_LDFLAGS = (
Expand Down Expand Up @@ -1364,7 +1364,7 @@
LINK_WITH_STANDARD_LIBRARIES = NO;
MACH_O_TYPE = mh_object;
MACOSX_DEPLOYMENT_TARGET = "";
MARKETING_VERSION = 1.10.3;
MARKETING_VERSION = 1.10.4;
OTHER_CFLAGS = "-fembed-bitcode";
OTHER_LDFLAGS = (
"-ObjC",
Expand Down
2 changes: 1 addition & 1 deletion MSDKDns/MSDKDns.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef __MSDKDns_H__
#define __MSDKDns_H__

#define MSDKDns_Version @"1.10.3"
#define MSDKDns_Version @"1.10.4"

#import <Foundation/Foundation.h>

Expand Down
146 changes: 72 additions & 74 deletions MSDKDns/MSDKDnsPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,93 +5,91 @@
#ifndef HTTPDNS_SDK_IOS_MSDKDNS_MSDKDNSPRIVATE_H_
#define HTTPDNS_SDK_IOS_MSDKDNS_MSDKDNSPRIVATE_H_

static NSString * const HTTP_DNS_UNKNOWN_STR = @"UNKNOWN";
#define HTTP_DNS_UNKNOWN_STR @"UNKNOWN"

// cacheDictionary
static NSString * const kIP = @"ips";
static NSString * const kClientIP = @"clientIP";
static NSString * const kTTL = @"ttl";
static NSString * const kTTLExpired = @"ttlExpried";
static NSString * const kChannel = @"channel";
static NSString * const kDnsTimeConsuming = @"timeConsuming";
static NSString * const kDnsErrCode = @"errCode";
static NSString * const kDnsErrMsg = @"errMsg";
static NSString * const kDnsRetry = @"retry";
static NSString * const kMSDKHttpDnsCache_A = @"httpDnsCache_A";
static NSString * const kMSDKHttpDnsCache_4A = @"httpDnsCache_4A";
static NSString * const kMSDKHttpDnsInfo_A = @"httpDnsInfo_A";
static NSString * const kMSDKHttpDnsInfo_4A = @"httpDnsInfo_4A";
static NSString * const kMSDKHttpDnsInfo_BOTH = @"httpDnsInfo_BOTH";
static NSString * const kMSDKLocalDnsCache = @"localDnsCache";
#define kIP @"ips"
#define kClientIP @"clientIP"
#define kTTL @"ttl"
#define kTTLExpired @"ttlExpried"
#define kChannel @"channel"
#define kDnsTimeConsuming @"timeConsuming"
#define kDnsErrCode @"errCode"
#define kDnsErrMsg @"errMsg"
#define kDnsRetry @"retry"
#define kMSDKHttpDnsCache_A @"httpDnsCache_A"
#define kMSDKHttpDnsCache_4A @"httpDnsCache_4A"
#define kMSDKHttpDnsInfo_A @"httpDnsInfo_A"
#define kMSDKHttpDnsInfo_4A @"httpDnsInfo_4A"
#define kMSDKHttpDnsInfo_BOTH @"httpDnsInfo_BOTH"
#define kMSDKLocalDnsCache @"localDnsCache"

// HttpDns解析结果数据上报相关
static NSString * const MSDKDnsEventName = @"HDNSGetHostByName";
#define MSDKDnsEventName @"HDNSGetHostByName"

static NSString * const kMSDKDnsSDK_Version = @"sdk_Version"; // SDK版本号
static NSString * const kMSDKDnsAppID = @"appID"; // 业务AppId
static NSString * const kMSDKDnsID = @"id"; // 业务DnsId,内部业务固定为1
static NSString * const kMSDKDnsKEY = @"key"; // 业务DnsKey,内部业务固定为>srW/8;&
static NSString * const kMSDKDnsUserID = @"userID"; // 用户Id,内部业务为OpenId
static NSString * const kMSDKDnsChannel = @"channel"; // HTTPDNS服务渠道, http/https/udp
static NSString * const kMSDKDnsNetType = @"netType"; // 用户网络类型
static NSString * const kMSDKDnsSSID = @"ssid"; // WiFi SSID,网络类型不为WiFi时为空
static NSString * const kMSDKDnsDomain = @"domain"; // 解析域名
static NSString * const kMSDKDnsLDNS_IP = @"ldns_ip"; // LocalDns解析结果IP
static NSString * const kMSDKDnsLDNS_Time = @"ldns_time"; // LocalDns解析耗时
#define kMSDKDnsSDK_Version @"sdk_Version" // SDK版本号
#define kMSDKDnsAppID @"appID" // 业务AppId
#define kMSDKDnsID @"id" // 业务DnsId,内部业务固定为1
#define kMSDKDnsKEY @"key" // 业务DnsKey,内部业务固定为>srW/8&
#define kMSDKDnsUserID @"userID" // 用户Id,内部业务为OpenId
#define kMSDKDnsChannel @"channel" // HTTPDNS服务渠道, http/https/udp
#define kMSDKDnsNetType @"netType" // 用户网络类型
#define kMSDKDnsSSID @"ssid" // WiFi SSID,网络类型不为WiFi时为空
#define kMSDKDnsDomain @"domain" // 解析域名
#define kMSDKDnsLDNS_IP @"ldns_ip" // LocalDns解析结果IP
#define kMSDKDnsLDNS_Time @"ldns_time" // LocalDns解析耗时
// 域名解析发起时网络栈 - 0: 无网络/未知 - 1: IPv4 Only - 2: IPv6 Only - 3: Dual Stack
static NSString * const kMSDKDnsNet_Stack = @"net_stack";
static NSString * const kMSDKDns_A_IsCache = @"isCache"; // 域名解析A记录是否命中缓存
static NSString * const kMSDKDns_A_ErrCode = @"hdns_a_err_code"; // 域名解析A记录解析错误码
static NSString * const kMSDKDns_A_ErrMsg = @"hdns_a_err_msg"; // 域名解析A记录解析错误信息
static NSString * const kMSDKDns_A_IP = @"hdns_ip"; // 域名解析A记录解析结果IP,多个ip以“,”拼接
static NSString * const kMSDKDns_A_TTL = @"ttl"; // 域名解析A记录解析结果TTL(单位s)
static NSString * const kMSDKDns_A_ClientIP = @"clientIP"; // 域名解析A记录结果客户端IP
static NSString * const kMSDKDns_A_Time = @"hdns_time"; // 域名解析A记录耗时(单位ms)
static NSString * const kMSDKDns_A_Retry = @"hdns_a_retry"; // 域名解析A记录重试次数
static NSString * const kMSDKDns_4A_IsCache = @"hdns_4a_cache_hit"; // 域名解析AAAA记录是否命中缓存
static NSString * const kMSDKDns_4A_ErrCode = @"hdns_4a_err_code"; // 域名解析AAAA记录解析错误码
static NSString * const kMSDKDns_4A_ErrMsg = @"hdns_4a_err_msg"; // 域名解析AAAA记录解析错误信息
static NSString * const kMSDKDns_4A_IP = @"hdns_4a_ips"; // 域名解析AAAA记录解析结果IP,多个ip以“,”拼接
static NSString * const kMSDKDns_4A_TTL = @"hdns_4a_ttl"; // 域名解析AAAA记录解析结果TTL(单位s)
static NSString * const kMSDKDns_4A_ClientIP = @"hdns_4a_client_ip"; // 域名解析AAAA记录结果客户端IP
static NSString * const kMSDKDns_4A_Time = @"hdns_4a_time_ms"; // 域名解析AAAA记录耗时(单位ms)
static NSString * const kMSDKDns_4A_Retry = @"hdns_4a_retry"; // 域名解析AAAA记录重试次数
static NSString * const kMSDKDns_BOTH_Retry = @"hdns_both_retry"; // 双栈域名解析重试次数
static NSString * const kMSDKDns_BOTH_ErrCode = @"hdns_both_err_code"; // 双栈域名解析解析错误码
static NSString * const kMSDKDns_BOTH_ErrMsg = @"hdns_both_err_msg"; // 双栈域名解析解析错误信息
static NSString * const kMSDKDns_DNS_A_IP = @"dns_ips"; // 域名解析结果v4 IP,多个ip以“,”拼接
static NSString * const kMSDKDns_DNS_4A_IP = @"dns_4a_ips"; // 域名解析结果v6 IP,多个ip以“,”拼接
#define kMSDKDnsNet_Stack @"net_stack"
#define kMSDKDns_A_IsCache @"isCache" // 域名解析A记录是否命中缓存
#define kMSDKDns_A_ErrCode @"hdns_a_err_code" // 域名解析A记录解析错误码
#define kMSDKDns_A_ErrMsg @"hdns_a_err_msg" // 域名解析A记录解析错误信息
#define kMSDKDns_A_IP @"hdns_ip" // 域名解析A记录解析结果IP,多个ip以“,”拼接
#define kMSDKDns_A_TTL @"ttl" // 域名解析A记录解析结果TTL(单位s)
#define kMSDKDns_A_ClientIP @"clientIP" // 域名解析A记录结果客户端IP
#define kMSDKDns_A_Time @"hdns_time" // 域名解析A记录耗时(单位ms)
#define kMSDKDns_A_Retry @"hdns_a_retry" // 域名解析A记录重试次数
#define kMSDKDns_4A_IsCache @"hdns_4a_cache_hit" // 域名解析AAAA记录是否命中缓存
#define kMSDKDns_4A_ErrCode @"hdns_4a_err_code" // 域名解析AAAA记录解析错误码
#define kMSDKDns_4A_ErrMsg @"hdns_4a_err_msg" // 域名解析AAAA记录解析错误信息
#define kMSDKDns_4A_IP @"hdns_4a_ips" // 域名解析AAAA记录解析结果IP,多个ip以“,”拼接
#define kMSDKDns_4A_TTL @"hdns_4a_ttl" // 域名解析AAAA记录解析结果TTL(单位s)
#define kMSDKDns_4A_ClientIP @"hdns_4a_client_ip" // 域名解析AAAA记录结果客户端IP
#define kMSDKDns_4A_Time @"hdns_4a_time_ms" // 域名解析AAAA记录耗时(单位ms)
#define kMSDKDns_4A_Retry @"hdns_4a_retry" // 域名解析AAAA记录重试次数
#define kMSDKDns_BOTH_Retry @"hdns_both_retry" // 双栈域名解析重试次数
#define kMSDKDns_BOTH_ErrCode @"hdns_both_err_code" // 双栈域名解析解析错误码
#define kMSDKDns_BOTH_ErrMsg @"hdns_both_err_msg" // 双栈域名解析解析错误信息
#define kMSDKDns_DNS_A_IP @"dns_ips" // 域名解析结果v4 IP,多个ip以“,”拼接
#define kMSDKDns_DNS_4A_IP @"dns_4a_ips" // 域名解析结果v6 IP,多个ip以“,”拼接

/*** 域名解析错误码*/
static NSString * const MSDKDns_Fail = @"-1"; // 失败
static NSString * const MSDKDns_Success = @"0"; // 成功
static NSString * const MSDKDns_UnResolve = @"1"; // 未解析
static NSString * const MSDKDns_Timeout = @"2"; // 解析超时
static NSString * const MSDKDns_NoData = @"3"; // 没有解析数据
static NSString * const MSDKDns_ErrorCode = @"errorCode";
#define MSDKDns_Fail @"-1" // 失败
#define MSDKDns_Success @"0" // 成功
#define MSDKDns_UnResolve @"1" // 未解析
#define MSDKDns_Timeout @"2" // 解析超时
#define MSDKDns_NoData @"3" // 没有解析数据
#define MSDKDns_ErrorCode @"errorCode"

/** 上报事件*/
static NSString * const MSDKDnsEventHttpDnsfail = @"HttpDnsfail";
static NSString * const MSDKDnsEventHttpDnsSpend = @"HttpDnsSpend";
static NSString * const MSDKDnsEventHttpDnsCached = @"HDNSLookupCached"; // 命中缓存
static NSString * const MSDKDnsEventHttpDnsNormal = @"HDNSGetHostByName"; // 常规解析请求
static NSString * const MSDKDnsEventHttpDnsPreResolved = @"HDNSPreLookup"; // 预解析请求
static NSString * const MSDKDnsEventHttpDnsAutoRefresh = @"HDNSLookupAsync"; // 缓存自动刷新
static NSString * const MSDKDnsEventHttpDnsExpiredAsync = @"HDNSLookupExpiredAsync"; // 乐观DNS中缓存异步刷新请求
static NSString * const MSDKDnsEventHttpDnsGetHTTPDNSDomainIP = @"HDNSGetDomainIP"; // 获取三网域名的IP
#define MSDKDnsEventHttpDnsfail @"HttpDnsfail"
#define MSDKDnsEventHttpDnsSpend @"HttpDnsSpend"
#define MSDKDnsEventHttpDnsCached @"HDNSLookupCached" // 命中缓存
#define MSDKDnsEventHttpDnsNormal @"HDNSGetHostByName" // 常规解析请求
#define MSDKDnsEventHttpDnsPreResolved @"HDNSPreLookup" // 预解析请求
#define MSDKDnsEventHttpDnsAutoRefresh @"HDNSLookupAsync" // 缓存自动刷新
#define MSDKDnsEventHttpDnsExpiredAsync @"HDNSLookupExpiredAsync" // 乐观DNS中缓存异步刷新请求
#define MSDKDnsEventHttpDnsGetHTTPDNSDomainIP @"HDNSGetDomainIP" // 获取三网域名的IP

// 命中缓存的状态
static NSString * const MSDKDnsDomainCacheHit = @"domainCacheHit"; // 命中缓存
static NSString * const MSDKDnsDomainCacheExpired = @"domainCacheExpired"; // 缓存过期
static NSString * const MSDKDnsDomainCacheEmpty = @"domainCacheEmpty"; // 没有缓存
#define MSDKDnsDomainCacheHit @"domainCacheHit" // 命中缓存
#define MSDKDnsDomainCacheExpired @"domainCacheExpired" // 缓存过期
#define MSDKDnsDomainCacheEmpty @"domainCacheEmpty" // 没有缓存

// 本地DB存储字段
static NSString * const DB_HttpDNS_IPV4_Channel = [kMSDKHttpDnsCache_A stringByAppendingString:kChannel];
static NSString * const DB_HttpDNS_IPV4_ClientIP = [kMSDKHttpDnsCache_A stringByAppendingString:kClientIP];
static NSString * const DB_HttpDNS_IPV4_TimeConsuming = [kMSDKHttpDnsCache_A stringByAppendingString:kDnsTimeConsuming];
static NSString * const DB_HttpDNS_IPV4_TTL = [kMSDKHttpDnsCache_A stringByAppendingString:kTTL];
static NSString * const DB_HttpDNS_IPV4_TTLExpired = [kMSDKHttpDnsCache_A stringByAppendingString:kTTLExpired];


#define DB_HttpDNS_IPV4_Channel [kMSDKHttpDnsCache_A stringByAppendingString:kChannel]
#define DB_HttpDNS_IPV4_ClientIP [kMSDKHttpDnsCache_A stringByAppendingString:kClientIP]
#define DB_HttpDNS_IPV4_TimeConsuming [kMSDKHttpDnsCache_A stringByAppendingString:kDnsTimeConsuming]
#define DB_HttpDNS_IPV4_TTL [kMSDKHttpDnsCache_A stringByAppendingString:kTTL]
#define DB_HttpDNS_IPV4_TTLExpired [kMSDKHttpDnsCache_A stringByAppendingString:kTTLExpired]

#endif // HTTPDNS_SDK_IOS_MSDKDNS_MSDKDNSPRIVATE_H_

0 comments on commit 056b2c3

Please sign in to comment.