The core protocol of WoopChain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
woop/p2p/p2pimpl/p2pimpl.go

26 lines
555 B

package p2pimpl
import (
"github.com/harmony-one/harmony/p2p"
"github.com/harmony-one/harmony/p2p/host"
"github.com/harmony-one/harmony/p2p/host/hostv1"
"github.com/harmony-one/harmony/p2p/host/hostv2"
)
// Version The version number of p2p library
// 1 - Direct socket connection
// 2 - libp2p
const Version = 2
// NewHost starts the host
func NewHost(peer p2p.Peer) host.Host {
// log.Debug("New Host", "ip/port", net.JoinHostPort(peer.IP, peer.Port))
if Version == 1 {
h := hostv1.New(peer)
return h
}
h := hostv2.New(peer)
return h
}