wongzigii / etchosts

Resolve host names to custom IP addresses.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EtcHosts

EtcHosts is a URLSession-based framework for *OS to resolves host name to specific IP address directly, likes /etc/host in *inux.

Example

Usage is brain-dead simple with two lines of codes.

import EtcHosts

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

	URLProtocol.registerClass(EtcHostsURLProtocol.self)

	EtcHostsURLProtocol.configureHosts { (configuration) in
		configuration.resolveHostName(hostname: "google.com", to: "192.168.0.1")
	}

	return true
}

LICENSE

MIT

About

Resolve host names to custom IP addresses.

License:MIT License


Languages

Language:Swift 90.6%Language:Objective-C 9.4%