Skip to content

yourtion/HTTPDNS-Swift

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

HTTPDNS

Carthage compatible Version License Platform Build Status

HTTPDNS 库 Swift 实现,支持 DNSPod、AliYunDNS、Google 等(方便扩展)

安装

CocoaPod

Podfile 中添加:

platform :ios, '8.0'

pod 'HTTPDNS-Swift'

Carthage

github "yourtion/HTTPDNS-Swift"

使用

异步解析

HTTPDNS.sharedInstance.getRecord("qq.com", callback: { (result) -> Void in
	print("Async QQ.com", result)
})

同步解析

print("Sync baidu.com", HTTPDNS.sharedInstance.getRecordSync("baidu.com"))

清除缓存

HTTPDNS.sharedInstance.cleanCache()

切换解析服务

默认为 DNSPod 服务。

切换到 AliYun HTTPDNS,Key 为阿里云的 account id

HTTPDNS.sharedInstance.switchProvider(.AliYun, key: "100000")

切换到 DNSPod HTTPDNS,Keynil

HTTPDNS.sharedInstance.switchProvider(.DNSPod, key: nil)

切换到 Google DNS-over-HTTP,Keynil

HTTPDNS.sharedInstance.switchProvider(.Google, key: nil)

TODO

  • 实现 DNSPod 免费版功能
  • 实现 DNSPod 企业版功能(认证接入)
  • 实现AliYun HTTPDNS
  • 实现 Google DNS-over-HTTP
  • 提供同步获取方法
  • 提供清除缓存方法