Latest 0.9.0
Homepage https://github.com/yourtion/HTTPDNS-Swift
License MIT
Platforms ios 8.0, osx 10.10, requires ARC
Frameworks Foundation
Authors

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

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

Latest podspec

{
    "name": "HTTPDNS-Swift",
    "version": "0.9.0",
    "summary": "Use HTTP to resolve domain (Swift)",
    "description": "HttpDNS u5e93 Swift u5b9eu73b0uff08u4f7fu7528DNSPodu3001AliYunDNSuff09",
    "homepage": "https://github.com/yourtion/HTTPDNS-Swift",
    "license": "MIT",
    "authors": {
        "Yourtion": "[email protected]"
    },
    "source": {
        "git": "https://github.com/yourtion/HTTPDNS-Swift.git",
        "tag": "0.9.0"
    },
    "source_files": "HTTPDNS/*.swift",
    "platforms": {
        "ios": "8.0",
        "osx": "10.10"
    },
    "frameworks": "Foundation",
    "requires_arc": true,
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This