ShalonURLProtocol
public class ShalonURLProtocol : URLProtocol
A URLProtocol
that adds support for Shalon by specifying URLs in the following format:
httpss://proxy:port/target:port/index.html. To use more than one proxy
(up to three), e.g., use httpssss://proxy1/proxy2/proxy3/target/index.html
for connecting via three proxies.
In order to support the protocol, it needs to be added to the
URLSessionConfiguration first:
let configuration = URLSessionConfiguration.ephemeral
configuration.protocolClasses?.append(ShalonURLProtocol.self)
Examples
let configuration = URLSessionConfiguration.ephemeral
configuration.protocolClasses?.append(ShalonURLProtocol.self)
let session = URLSession(configuration: configuration)
let url = URL(string: "httpss://shalon1.jondonym.net/example.com/")!
let task = session.dataTask(with: url) {
optionalUrl, optionalResponse, optionalError in
// Handle response
}
-
Implementation of the
URLProtocol.See
Declaration
Swift
override public class func canInit(with request: URLRequest) -> BoolParameters
requestA request.
-
Implementation of the
URLProtocol.Declaration
Swift
override public class func canInit(with task: URLSessionTask) -> BoolParameters
requestA task.
-
Implementation of the
URLProtocol.Declaration
Swift
override public class func canonicalRequest(for request: URLRequest) -> URLRequestParameters
requestA request.
-
Implementation of the
URLProtocol.See
startLoading()Declaration
Swift
override public func startLoading() -
Implementation of the
URLProtocol.See
stopLoading()Declaration
Swift
override public func stopLoading()
View on GitHub
ShalonURLProtocol Class Reference