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
}