Proxy
public struct Proxy
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.
-
Specifies Proxy server host.
Declaration
Swift
public var host: String
-
Specifies Proxy server port.
Declaration
Swift
public var port: Int
-
Specifies Proxy server authorization.
Declaration
Swift
public var authorization: HTTPClient.Authorization? { get set }
-
Create a HTTP proxy.
Declaration
Swift
public static func server(host: String, port: Int) -> Proxy
Parameters
host
proxy server host.
port
proxy server port.
-
Create a HTTP proxy.
Declaration
Swift
public static func server(host: String, port: Int, authorization: HTTPClient.Authorization? = nil) -> Proxy
Parameters
host
proxy server host.
port
proxy server port.
authorization
proxy server authorization.
-
Create a SOCKSv5 proxy.
Declaration
Swift
public static func socksServer(host: String, port: Int = 1080) -> Proxy
Parameters
host
The SOCKSv5 proxy address.
port
The SOCKSv5 proxy port, defaults to 1080.
Return Value
A new instance of
Proxy
configured to connect to aSOCKSv5
server.