package tcpreuse

import (
	
	

	
)

// 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 = true

func init() {
	 := strings.ToLower(os.Getenv(envReuseport))
	if  == "false" ||  == "f" ||  == "0" {
		EnvReuseportVal = false
		log.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()
}