Fixed imports.

pull/4455/head
frozen 1 year ago
parent 6179450507
commit 96e03868ae
No known key found for this signature in database
GPG Key ID: 5391C63E79B03EDE
  1. 7
      p2p/host.go
  2. 14
      p2p/security/security.go
  3. 2
      p2p/security/security_test.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"

@ -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:

@ -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"

Loading…
Cancel
Save