Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
fix: dial dual times
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinZonda committed Aug 19, 2022
1 parent 6ba1efc commit 08a723c
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,14 @@ import (
"golang.org/x/net/proxy"
)

var proxyDialer proxy.Dialer = nil

func GetDialer(isSocks5 bool) proxy.Dialer {
if !isSocks5 {
return &net.Dialer{}
}
if proxyDialer != nil {
return proxyDialer

}
var err error
proxyDialer, err = proxy.SOCKS5("tcp", cfg.SocksAddr, nil, proxy.Direct)
proxyDialer, err := proxy.SOCKS5("tcp", cfg.SocksAddr, nil, proxy.Direct)
if err != nil {
panic(err)
// FIXME: I am shit
return &net.Dialer{}
}
return proxyDialer
}

0 comments on commit 08a723c

Please sign in to comment.