packagelibp2pimport(config"github.com/ipfs/go-ipfs-config""github.com/libp2p/go-libp2p"noise"github.com/libp2p/go-libp2p-noise"secio"github.com/libp2p/go-libp2p-secio"tls"github.com/libp2p/go-libp2p-tls")funcSecurity(enabledbool,tptConfigconfig.Transports)interface{}{if!enabled{returnfunc()(optsLibp2pOpts){// TODO: shouldn't this be Errorf to guarantee visibility?log.Warnf(`Your IPFS node has been configured to run WITHOUT ENCRYPTED CONNECTIONS. You will not be able to connect to any nodes configured to use encrypted connections`)opts.Opts=append(opts.Opts,libp2p.NoSecurity)returnopts}}// Using the new config options.returnfunc()(optsLibp2pOpts){opts.Opts=append(opts.Opts,prioritizeOptions([]priorityOption{{priority:tptConfig.Security.TLS,defaultPriority:100,opt:libp2p.Security(tls.ID,tls.New),},{priority:tptConfig.Security.SECIO,defaultPriority:200,opt:libp2p.Security(secio.ID,secio.New),},{priority:tptConfig.Security.Noise,defaultPriority:300,opt:libp2p.Security(noise.ID,noise.New),}}))returnopts}}