dgrr / http2

HTTP/2 implementation for fasthttp
Apache License 2.0
208 stars 35 forks source link

client add proxy support #41

Closed liandeliang closed 2 years ago

liandeliang commented 2 years ago

code from fasthttp client example

` import ( "github.com/valyala/fasthttp/fasthttpproxy" )

// ... hostWithPort := "example.com:80"

    client := &fasthttp.HostClient{
        Addr:                hostWithPort,
    }

    if proxyUrl != "" {
        if "http" == proxyUrl[:4] {
            client.Dial = fasthttpproxy.FasthttpHTTPDialer(proxyUrl)
        } else {
            client.Dial = fasthttpproxy.FasthttpSocksDialer(proxyUrl)
        }
    }

    e = http2.ConfigureClient(client, http2.ClientOpts{})
    if e != nil {
        return
    }

`

dgrr commented 2 years ago

Thank you for your PR!