mirror of
https://github.com/status-im/status-go.git
synced 2025-02-18 09:47:53 +00:00
Update vendor Integrate rendezvous into status node Add a test with failover using rendezvous Use multiple servers in client Use discovery V5 by default and test that node can be started with rendezvous discovet Fix linter Update rendezvous client to one with instrumented stream Address feedback Fix test with updated topic limits Apply several suggestions Change log to debug for request errors because we continue execution Remove web3js after rebase Update rendezvous package
36 lines
987 B
Go
36 lines
987 B
Go
package tcp
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
|
|
reuseport "github.com/libp2p/go-reuseport"
|
|
)
|
|
|
|
// envReuseport is the env variable name used to turn off reuse port.
|
|
// It default to true.
|
|
const envReuseport = "IPFS_REUSEPORT"
|
|
|
|
// envReuseportVal stores the value of envReuseport. defaults to true.
|
|
var envReuseportVal = true
|
|
|
|
func init() {
|
|
v := strings.ToLower(os.Getenv(envReuseport))
|
|
if v == "false" || v == "f" || v == "0" {
|
|
envReuseportVal = false
|
|
log.Infof("REUSEPORT disabled (IPFS_REUSEPORT=%s)", v)
|
|
}
|
|
}
|
|
|
|
// reuseportIsAvailable returns whether reuseport is available to be used. This
|
|
// is here because we want to be able to turn reuseport on and off selectively.
|
|
// For now we use an ENV variable, as this handles our pressing need:
|
|
//
|
|
// IPFS_REUSEPORT=false ipfs daemon
|
|
//
|
|
// If this becomes a sought after feature, we could add this to the config.
|
|
// In the end, reuseport is a stop-gap.
|
|
func ReuseportIsAvailable() bool {
|
|
return envReuseportVal && reuseport.Available()
|
|
}
|