AdguardTeam / AdguardTeam/gomitmproxy

Feat request: Please allow us to have access to transport config

未关闭
#24 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
Go
星标
344
派生
71
PR 合并指标
30 天内没有已合并 PR

描述

`gomitmproxy.NewProxy` starts out as follows:

```go

// NewProxy creates a new instance of the Proxy
func NewProxy(config Config) *Proxy {
proxy := &Proxy{
Config: config,
transport: &http.Transport{
// This forces http.Transport to not upgrade requests to HTTP/2
// TODO: Remove when HTTP/2 can be supported
TLSNextProto: make(map[string]func(string, *tls.Conn) http.RoundTripper),
Proxy: http.ProxyFromEnvironment,
...
```

The `Proxy: http.ProxyFromEnvironment` is what affects me specifically. I am using an upstream proxy, and having to `os.Setenv...` to make it work is very inelegant:

```go
os.Setenv("ALL_PROXY", upstreamProxy)
os.Setenv("HTTP_PROXY", upstreamProxy)
os.Setenv("HTTPS_PROXY", upstreamProxy)
fmt.Println("Upstream Proxy =", upstreamProxy)
```

Being able to pass this in, perhaps via the `Config` would be amazing. I would be happy to make a PR, please suggest if can be added to `Config` (maybe simple/non-breaking) or should be done some other way.

Thank you.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。