module Client
Extends class Async::HTTP::Client with proxy capabilities.
Definitions
def proxy(endpoint, headers = nil)
Create a proxy instance for the given endpoint.
Signature
-
parameter
endpointEndpoint The target endpoint to tunnel to.
-
parameter
headersHash | Nil Optional headers to send with the CONNECT request.
-
returns
Proxy A proxy instance for establishing tunnels.
Implementation
def proxy(endpoint, headers = nil)
Proxy.new(self, endpoint.authority(false), headers)
end
def proxied_client(endpoint, headers = nil)
Create a client that will proxy requests through the current client.
Implementation
def proxied_client(endpoint, headers = nil)
proxy = self.proxy(endpoint, headers)
return self.class.new(proxy.wrap_endpoint(endpoint))
end
def proxied_endpoint(endpoint, headers = nil)
Create an endpoint that connects via this proxy.
Signature
-
parameter
endpointEndpoint The target endpoint.
-
parameter
headersHash | Nil Optional headers for the CONNECT request.
-
returns
Endpoint An endpoint that tunnels through the proxy.
Implementation
def proxied_endpoint(endpoint, headers = nil)
proxy = self.proxy(endpoint, headers)
return proxy.wrap_endpoint(endpoint)
end