diff --git a/Sources/AsyncHTTPClient/HTTPClient.swift b/Sources/AsyncHTTPClient/HTTPClient.swift index 55db26ce2..218a70568 100644 --- a/Sources/AsyncHTTPClient/HTTPClient.swift +++ b/Sources/AsyncHTTPClient/HTTPClient.swift @@ -279,7 +279,7 @@ public class HTTPClient { } } - private func resolveAddress(request: Request, proxy: Proxy?) -> (host: String, port: Int) { + private func resolveAddress(request: Request, proxy: Configuration.Proxy?) -> (host: String, port: Int) { switch self.configuration.proxy { case .none: return (request.host, request.port) diff --git a/Sources/AsyncHTTPClient/HTTPClientProxyHandler.swift b/Sources/AsyncHTTPClient/HTTPClientProxyHandler.swift index 69a62716a..72cdf49fe 100644 --- a/Sources/AsyncHTTPClient/HTTPClientProxyHandler.swift +++ b/Sources/AsyncHTTPClient/HTTPClientProxyHandler.swift @@ -15,20 +15,28 @@ import NIO import NIOHTTP1 -/// Specifies the remote address of an HTTP proxy. -/// -/// Adding an `HTTPClientProxy` to your client's `HTTPClient.Configuration` -/// will cause requests to be passed through the specified proxy using the -/// HTTP `CONNECT` method. -/// -/// If a `TLSConfiguration` is used in conjunction with `HTTPClientProxy`, -/// TLS will be established _after_ successful proxy, between your client -/// and the destination server. -public extension HTTPClient { +public extension HTTPClient.Configuration { + /// Proxy server configuration + /// Specifies the remote address of an HTTP proxy. + /// + /// Adding an `Proxy` to your client's `HTTPClient.Configuration` + /// will cause requests to be passed through the specified proxy using the + /// HTTP `CONNECT` method. + /// + /// If a `TLSConfiguration` is used in conjunction with `HTTPClient.Configuration.Proxy`, + /// TLS will be established _after_ successful proxy, between your client + /// and the destination server. struct Proxy { - internal let host: String - internal let port: Int - + /// Specifies Proxy server host. + public var host: String + /// Specifies Proxy server port. + public var port: Int + + /// Create proxy. + /// + /// - parameters: + /// - host: proxy server host. + /// - port: proxy server port. public static func server(host: String, port: Int) -> Proxy { return .init(host: host, port: port) }