Perfect DNS Parser 简体中文
This project provides an express function to parse an IPv4 address from a valid domain name.
This package builds with Swift Package Manager and is part of the Perfect project. It was written to be stand-alone and so does not require PerfectLib or any other components.
Ensure you have installed and activated the latest Swift 3.1 tool chain.
Add dependencies to your Package.swift:
.Package(url: "https://github.com/PerfectSideRepos/Perfect-DNSParser.git", majorVersion: 1)
Import Library
import PerfectDNSParser
Get IP address from a domain name:
if let ip = "perfect.org".parseDNS() {
// print out the ip address, and it will be "65.39.133.132" if success
print(ip)
}//end if
Perfect DNSParser library expends the String class with a new function: func parseDNS(_ service: String = "http") -> String?
, which can get IPv4 address from current host DNS name.
- parameter: (optional) service. i.e., the internet service port, such as "http" (default), "ftp", "https" or "ssh", etc.
- returns: ip address if success, or nil if something wrong.
We are transitioning to using JIRA for all bugs and support related issues, therefore the GitHub issues has been disabled.
If you find a mistake, bug, or any other helpful suggestion you'd like to make on the docs please head over to http://jira.perfect.org:8080/servicedesk/customer/portal/1 and raise it.
A comprehensive list of open issues can be found at http://jira.perfect.org:8080/projects/ISS/issues
For more information on the Perfect project, please visit perfect.org.