Source File
reuseport.go
Belonging Package
github.com/libp2p/go-libp2p/p2p/transport/tcpreuse
package tcpreuseimport ()// envReuseport is the env variable name used to turn off reuse port.// It default to true.const envReuseport = "LIBP2P_TCP_REUSEPORT"// EnvReuseportVal stores the value of envReuseport. defaults to true.var EnvReuseportVal = truefunc init() {:= strings.ToLower(os.Getenv(envReuseport))if == "false" || == "f" || == "0" {EnvReuseportVal = falselog.Infof("REUSEPORT disabled (LIBP2P_TCP_REUSEPORT=%s)", )}}// 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://// LIBP2P_TCP_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 () bool {return EnvReuseportVal && reuseport.Available()}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |