rapid7 / go-get-proxied

Cross platform retrieval of system proxy configurations
BSD 3-Clause "New" or "Revised" License
54 stars 26 forks source link

Adds ability to set custom timeouts for a given provider #14

Closed tosmun-r7 closed 5 years ago

tosmun-r7 commented 5 years ago

The following functionality has been added:

/*
    Set the timeouts used by this provider making a call which requires external resources (i.e. WPAD/PAC).
    Should any of these timeouts be exceeded, that particular call will be cancelled.
    To this end, this timeout does not represent the complete timeout for any call to this provider,
    but rather are applied to individual implementations uniquely.
    Additionally, this timeout is not guaranteed to be respected by the implementation, and may vary.
    Params:
        resolve: Time in milliseconds to use for name resolution. Provider default is 5000.
        connect: Time in milliseconds to use for server connection requests. Provider default is 5000.
                 TCP/IP can time out while setting up the socket during the
                 three leg SYN/ACK exchange, regardless of the value of this parameter.
        send: Time in milliseconds to use for sending requests. Provider default is 20000.
        receive: Time in milliseconds to receive a response to a request. Provider default is 20000.
*/
SetTimeouts(resolve int, connect int, send int, receive int)

Example:

provider = proxy.NewProvider("")
provider.SetTimeouts(5000, 5000, 20000, 20000)
provider.GetHTTPS("*")