mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-04 00:31:10 +08:00
Fix critical issues in proxy URL handling.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
parent
c7aea91c43
commit
fb71729fa6
1 changed files with 11 additions and 5 deletions
|
|
@ -9,16 +9,22 @@ import (
|
|||
"golang.org/x/net/proxy"
|
||||
)
|
||||
|
||||
func newProxyDial(prxoyUrls string) proxy.Dialer {
|
||||
func newProxyDial(proxyUrls string) proxy.Dialer {
|
||||
var proxyDialer proxy.Dialer = proxy.Direct
|
||||
for _, prxoyUrl := range strings.Split(prxoyUrls, ",") {
|
||||
urlInfo, err := url.Parse(prxoyUrl)
|
||||
for _, proxyUrl := range strings.Split(proxyUrls, ",") {
|
||||
urlInfo, err := url.Parse(proxyUrl)
|
||||
if err != nil {
|
||||
return proxyDialer
|
||||
continue
|
||||
}
|
||||
if urlInfo.Scheme != "socks5" {
|
||||
continue
|
||||
}
|
||||
var auth *proxy.Auth = nil
|
||||
if urlInfo.User != nil {
|
||||
pwd, _ := urlInfo.User.Password()
|
||||
pwd, ok := urlInfo.User.Password()
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
auth = &proxy.Auth{
|
||||
User: urlInfo.User.Username(),
|
||||
Password: pwd,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue