Disable libp2p TLS security protocols for now (#2622)

* Disable security protocols for now

* Enabling security for test only. See https://github.com/libp2p/go-libp2p-swarm/issues/124

* Fix spacing
This commit is contained in:
Preston Van Loon
2019-05-17 13:29:25 -04:00
committed by GitHub
parent b9fe8b172c
commit 15cac0c0b1
2 changed files with 17 additions and 1 deletions

View File

@@ -9,6 +9,12 @@ import (
"github.com/prysmaticlabs/prysm/shared/iputils"
)
// Using package global for test. Swarm testing does not allow testing with
// NoSecurity option enabled. If this is resolved upstream, we can set up swarm
// with security disabled in the pubsub tests and remove this package global.
// https://github.com/libp2p/go-libp2p-swarm/issues/124
var disableSecurity = true
// buildOptions for the libp2p host.
// TODO(287): Expand on these options and provide the option configuration via flags.
// Currently, this is a random port and a (seemingly) consistent private key
@@ -24,9 +30,15 @@ func buildOptions(port, maxPeers int) []libp2p.Option {
log.Errorf("Failed to p2p listen: %v", err)
}
return []libp2p.Option{
opts := []libp2p.Option{
libp2p.ListenAddrs(listen),
libp2p.EnableRelay(), // Allows dialing to peers via relay.
optionConnectionManager(maxPeers),
}
if disableSecurity {
opts = append(opts, libp2p.NoSecurity)
}
return opts
}

View File

@@ -37,6 +37,10 @@ const testTopic = "test_topic"
func init() {
logrus.SetLevel(logrus.DebugLevel)
// Security required for swarm testing.
// https://github.com/libp2p/go-libp2p-swarm/issues/124
disableSecurity = false
}
func TestNewServer_InvalidMultiaddress(t *testing.T) {