Add count and change timeout
This commit is contained in:
parent
f174f8b1b1
commit
a10b811217
4
sox.go
4
sox.go
|
@ -10,7 +10,7 @@ import (
|
|||
)
|
||||
|
||||
func persistentResolver(hostname string) []netip.Addr {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
var ips []netip.Addr
|
||||
if hostname == "" {
|
||||
|
@ -87,7 +87,7 @@ func (c *Checker) GetAndVerifySOCKS() (chan netip.AddrPort, chan error) {
|
|||
go func(prx netip.AddrPort) {
|
||||
defer wg.Done()
|
||||
var conn net.Conn
|
||||
conn, err = net.DialTimeout("tcp", prx.String(), 5*time.Second)
|
||||
conn, err = net.DialTimeout("tcp", prx.String(), 10*time.Second)
|
||||
if err != nil {
|
||||
errs <- err
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ func TestChecker_GetSOCKS(t *testing.T) {
|
|||
t.Fatalf("%s", err.Error())
|
||||
}
|
||||
gotSox, errs := c.GetAndVerifySOCKS()
|
||||
count := 0
|
||||
for sox := range gotSox {
|
||||
select {
|
||||
case err := <-errs:
|
||||
|
@ -34,7 +35,9 @@ func TestChecker_GetSOCKS(t *testing.T) {
|
|||
}
|
||||
default:
|
||||
t.Logf("got verified: %s", sox.String())
|
||||
count++
|
||||
}
|
||||
}
|
||||
t.Logf("got %d active mullvad SOCKS5 servers", count)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue