diff --git a/p2p/host.go b/p2p/host.go index aeafea7dc..18dce6a46 100644 --- a/p2p/host.go +++ b/p2p/host.go @@ -11,13 +11,6 @@ import ( "sync" "time" - "github.com/harmony-one/bls/ffi/go/bls" - nodeconfig "github.com/harmony-one/harmony/internal/configs/node" - "github.com/harmony-one/harmony/internal/utils" - "github.com/harmony-one/harmony/internal/utils/blockedpeers" - "github.com/harmony-one/harmony/p2p/discovery" - "github.com/harmony-one/harmony/p2p/security" - sttypes "github.com/harmony-one/harmony/p2p/stream/types" "github.com/libp2p/go-libp2p" dht "github.com/libp2p/go-libp2p-kad-dht" libp2p_pubsub "github.com/libp2p/go-libp2p-pubsub" diff --git a/p2p/security/security.go b/p2p/security/security.go index e9523cd02..f8d032253 100644 --- a/p2p/security/security.go +++ b/p2p/security/security.go @@ -3,16 +3,18 @@ package security import ( "fmt" "sync" + "time" + "github.com/harmony-one/harmony/internal/utils" "github.com/harmony-one/harmony/internal/utils/blockedpeers" - libp2p_network "github.com/libp2p/go-libp2p/core/network" + libp2pnetwork "github.com/libp2p/go-libp2p/core/network" ma "github.com/multiformats/go-multiaddr" "github.com/pkg/errors" ) type Security interface { - OnConnectCheck(net libp2p_network.Network, conn libp2p_network.Conn) error - OnDisconnectCheck(conn libp2p_network.Conn) error + OnConnectCheck(net libp2pnetwork.Network, conn libp2pnetwork.Conn) error + OnDisconnectCheck(conn libp2pnetwork.Conn) error } type peerMap struct { @@ -85,7 +87,7 @@ func (m *Manager) RangePeers(f func(key string, value []string) bool) { m.peers.Range(f) } -func (m *Manager) OnConnectCheck(net libp2p_network.Network, conn libp2p_network.Conn) error { +func (m *Manager) OnConnectCheck(net libp2pnetwork.Network, conn libp2pnetwork.Conn) error { m.mutex.Lock() defer m.mutex.Unlock() @@ -131,7 +133,7 @@ func (m *Manager) OnConnectCheck(net libp2p_network.Network, conn libp2p_network return nil } -func (m *Manager) OnDisconnectCheck(conn libp2p_network.Conn) error { +func (m *Manager) OnDisconnectCheck(conn libp2pnetwork.Conn) error { m.mutex.Lock() defer m.mutex.Unlock() @@ -169,7 +171,7 @@ func find(slice []string, val string) (int, bool) { return -1, false } -func getRemoteIP(conn libp2p_network.Conn) (string, error) { +func getRemoteIP(conn libp2pnetwork.Conn) (string, error) { for _, protocol := range conn.RemoteMultiaddr().Protocols() { switch protocol.Code { case ma.P_IP4: diff --git a/p2p/security/security_test.go b/p2p/security/security_test.go index 79a2dac28..7d610707e 100644 --- a/p2p/security/security_test.go +++ b/p2p/security/security_test.go @@ -3,10 +3,10 @@ package security import ( "context" "fmt" - "github.com/harmony-one/harmony/internal/utils/blockedpeers" "testing" "time" + "github.com/harmony-one/harmony/internal/utils/blockedpeers" "github.com/libp2p/go-libp2p" ic "github.com/libp2p/go-libp2p/core/crypto" "github.com/libp2p/go-libp2p/core/host"