Skip to content

Commit

Permalink
Adjust override logic
Browse files Browse the repository at this point in the history
  • Loading branch information
bdwyertech committed Mar 7, 2021
1 parent 7055965 commit 2afaef2
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions pkg/gontlm-proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,20 @@ func Run() {

proxyDialer := func(addr string, pxyUrl *url.URL) proxyplease.DialContext {
cacheKey := addr
if pxyUrl != nil && pxyUrl.Host != "" {
cacheKey = strings.Split(pxyUrl.Host, ":")[0]
if pxyUrl != nil && pxyUrl.Host != "" && ProxyOverrides == nil {
cacheKey = pxyUrl.Host
}

s, _, _ := dialerCache.Memoize(cacheKey, func() (pxyCtx interface{}, err error) {
if ProxyOverrides != nil {
if pxy, ok := (*ProxyOverrides)[addr]; ok {
if pxy == nil {
d := net.Dialer{}
return d.DialContext, nil
for _, s := range []string{addr, strings.Split(addr, ":")[0]} {
if pxy, ok := (*ProxyOverrides)[strings.ToLower(s)]; ok {
if pxy == nil {
d := net.Dialer{}
return d.DialContext, nil
}
pxyUrl = pxy
}
pxyUrl = pxy
}
}

Expand Down

0 comments on commit 2afaef2

Please sign in to comment.