Skip to content

Commit

Permalink
Fixed imports.
Browse files Browse the repository at this point in the history
  • Loading branch information
Frozen committed Oct 23, 2023
1 parent 99ded8d commit 9a0d5da
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion p2p/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import (
"context"
"encoding/binary"
"fmt"
"github.com/harmony-one/harmony/internal/utils/blockedpeers"
"net"
"os"
"runtime"
"strings"
"sync"
"time"

"github.com/harmony-one/harmony/internal/utils/blockedpeers"
"github.com/libp2p/go-libp2p"
dht "github.com/libp2p/go-libp2p-kad-dht"
libp2p_pubsub "github.com/libp2p/go-libp2p-pubsub"
Expand Down
19 changes: 10 additions & 9 deletions p2p/security/security.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@ package security

import (
"fmt"
"sync"
"sync/atomic"
"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"
"sync"
"sync/atomic"
"time"
)

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 {
Expand Down Expand Up @@ -83,7 +84,7 @@ func NewManager(maxConnPerIP int, maxPeers int64, banned *blockedpeers.Manager)
}
}

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()

Expand Down Expand Up @@ -137,7 +138,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()

Expand Down Expand Up @@ -180,7 +181,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:
Expand Down
2 changes: 1 addition & 1 deletion p2p/security/security_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 9a0d5da

Please sign in to comment.