{"id":28539398,"url":"https://github.com/yourtion/httpdns-swift","last_synced_at":"2025-06-25T19:03:34.345Z","repository":{"id":56913977,"uuid":"46848369","full_name":"yourtion/HTTPDNS-Swift","owner":"yourtion","description":"HTTPDNS 库 Swift 实现（支持 DNSPod 与 AliyunDNS ）","archived":false,"fork":false,"pushed_at":"2018-03-06T01:57:50.000Z","size":80,"stargazers_count":18,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-09T18:49:21.569Z","etag":null,"topics":["aliyun-httpdns","carthage","dns-over-https","dnspod","dnspod-httpdns","google-dns","httpdns","httpdns-swift"],"latest_commit_sha":null,"homepage":"http://cocoapods.org/pods/HTTPDNS-Swift","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yourtion.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-25T08:38:13.000Z","updated_at":"2023-12-05T01:49:03.000Z","dependencies_parsed_at":"2022-08-21T03:20:36.588Z","dependency_job_id":null,"html_url":"https://github.com/yourtion/HTTPDNS-Swift","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/yourtion/HTTPDNS-Swift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yourtion%2FHTTPDNS-Swift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yourtion%2FHTTPDNS-Swift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yourtion%2FHTTPDNS-Swift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yourtion%2FHTTPDNS-Swift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yourtion","download_url":"https://codeload.github.com/yourtion/HTTPDNS-Swift/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yourtion%2FHTTPDNS-Swift/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261937020,"owners_count":23232843,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aliyun-httpdns","carthage","dns-over-https","dnspod","dnspod-httpdns","google-dns","httpdns","httpdns-swift"],"created_at":"2025-06-09T18:31:44.977Z","updated_at":"2025-06-25T19:03:34.338Z","avatar_url":"https://github.com/yourtion.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HTTPDNS\n\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Version](https://img.shields.io/cocoapods/v/HTTPDNS-Swift.svg?style=flat)](http://cocoapods.org/pods/HTTPDNS-Swift)\n[![License](https://img.shields.io/cocoapods/l/HTTPDNS-Swift.svg?style=flat)](http://cocoapods.org/pods/HTTPDNS-Swift)\n[![Platform](https://img.shields.io/cocoapods/p/HTTPDNS-Swift.svg?style=flat)](http://cocoapods.org/pods/HTTPDNS-Swift)\n[![Build Status](https://travis-ci.org/yourtion/HTTPDNS-Swift.svg?branch=master)](https://travis-ci.org/yourtion/HTTPDNS-Swift)\n\nHTTPDNS 库 Swift 实现，支持 DNSPod、AliYunDNS、Google 等（方便扩展）\n\n- DNSPod 的 [移动解析服务D+](https://www.dnspod.cn/httpdns) \n- AliYun HTTPDNS [HTTPDNS API](https://help.aliyun.com/document_detail/dpa/sdk/RESTful/httpdns.html?spm=5176.docdpa/sdk/OneSDK/quick-start-ios.6.104.wmIJqo)\n- Google DNS-over-HTTP [介绍](https://developers.google.com/speed/public-dns/docs/dns-over-https)\n\n## 安装\n\n### CocoaPod\n\n在 `Podfile` 中添加：\n\n```\nplatform :ios, '8.0'\n\npod 'HTTPDNS-Swift'\n```\n\n### Carthage\n\n```\ngithub \"yourtion/HTTPDNS-Swift\"\n```\n\n\n## 使用\n\n### 异步解析\n\n```swift\nHTTPDNS.sharedInstance.getRecord(\"qq.com\", callback: { (result) -\u003e Void in\n\tprint(\"Async QQ.com\", result)\n})\n```\n\n### 同步解析\n\n```swift\nprint(\"Sync baidu.com\", HTTPDNS.sharedInstance.getRecordSync(\"baidu.com\"))\n```\n\n### 清除缓存\n\n```swift\nHTTPDNS.sharedInstance.cleanCache()\n```\n\n### 切换解析服务\n\n默认为 DNSPod 服务。\n\n切换到 AliYun HTTPDNS，`Key` 为阿里云的 `account id`\n\n```swift\nHTTPDNS.sharedInstance.switchProvider(.AliYun, key: \"100000\")\n```\n\n切换到 DNSPod HTTPDNS，`Key` 为 `nil`\n\n```swift\nHTTPDNS.sharedInstance.switchProvider(.DNSPod, key: nil)\n```\n\n切换到 Google DNS-over-HTTP，`Key` 为 `nil`\n\n```swift\nHTTPDNS.sharedInstance.switchProvider(.Google, key: nil)\n```\n\n## TODO\n\n- [X] 实现 DNSPod 免费版功能\n- [ ] 实现 DNSPod 企业版功能（认证接入）\n- [X] 实现AliYun HTTPDNS\n- [X] 实现 Google DNS-over-HTTP\n- [X] 提供同步获取方法\n- [X] 提供清除缓存方法\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyourtion%2Fhttpdns-swift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyourtion%2Fhttpdns-swift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyourtion%2Fhttpdns-swift/lists"}