mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Add delay
This commit is contained in:
parent
37a2570643
commit
e983f7425c
1 changed files with 2 additions and 0 deletions
|
@ -32,6 +32,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
|
mathRand "math/rand"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
@ -691,6 +692,7 @@ func checkIsRelayURLAcceptable(
|
||||||
if !allowPrivateIPs {
|
if !allowPrivateIPs {
|
||||||
hostname := parsedRelayURL.Hostname()
|
hostname := parsedRelayURL.Hostname()
|
||||||
ipArray, _ := net.LookupIP(hostname)
|
ipArray, _ := net.LookupIP(hostname)
|
||||||
|
time.Sleep(time.Second * time.Duration(mathRand.Float64()))
|
||||||
if isHostnameLocal(hostname) {
|
if isHostnameLocal(hostname) {
|
||||||
return fmt.Errorf("rejected Relay URL: private hostnames are not allowed")
|
return fmt.Errorf("rejected Relay URL: private hostnames are not allowed")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue