Skip to content

Commit

Permalink
Non-authorized proxy support added
Browse files Browse the repository at this point in the history
Added proxy connection option that does not require proxy authorization
  • Loading branch information
Ahmeth4n authored and bogdanfinn committed Dec 22, 2023
1 parent 2133255 commit cbfec5c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,15 @@ func newConnectDialer(proxyUrlStr string, timeout time.Duration, localAddr *net.

if proxyUrl.User != nil {
if proxyUrl.User.Username() != "" {
//example format (with credentials): http://root:[email protected]:12312
password, _ := proxyUrl.User.Password()
dialer.DefaultHeader.Set("Proxy-Authorization", "Basic "+
base64.StdEncoding.EncodeToString([]byte(proxyUrl.User.Username()+":"+password)))

}
} else {
//example format (without credentials): http://127.0.0.1:12312
dialer.DefaultHeader.Set("Proxy-Authorization", "")
}
return dialer, nil
}
Expand Down

0 comments on commit cbfec5c

Please sign in to comment.