refactor: change GetIP to GetIPString

This commit is contained in:
Derrick Hammer 2024-03-10 07:16:37 -04:00
parent 48ef3e3a2a
commit 5f5b522e68
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
3 changed files with 6 additions and 6 deletions

View File

@ -44,7 +44,7 @@ type Peer interface {
ConnectionURIs() []*url.URL
IsHandshakeDone() bool
SetHandshakeDone(status bool)
GetIP() string
GetIPString() string
Abuser() bool
}
@ -83,7 +83,7 @@ func (b *BasePeer) End() error {
func (b *BasePeer) EndForAbuse() error {
panic("must implement in child class")
}
func (b *BasePeer) GetIP() string {
func (b *BasePeer) GetIPString() string {
panic("must implement in child class")
}

View File

@ -137,7 +137,7 @@ func (p *WebSocketPeer) GetChallenge() []byte {
return p.challenge
}
func (b *WebSocketPeer) GetIP() string {
func (b *WebSocketPeer) GetIPString() string {
ctx, cancel := context.WithCancel(context.Background())
netConn := websocket.NetConn(ctx, b.socket, websocket.MessageBinary)

View File

@ -222,7 +222,7 @@ func (p *P2PServiceDefault) ConnectToNode(connectionUris []*url.URL, retry uint,
}
}
fromPeerIP := fromPeer.GetIP()
fromPeerIP := fromPeer.GetIPString()
if !p.incomingIPBlocklist.Contains(fromPeerIP) {
p.incomingIPBlocklist.Put(fromPeerIP, true)
@ -282,7 +282,7 @@ func (p *P2PServiceDefault) ConnectToNode(connectionUris []*url.URL, retry uint,
}
}
fromPeerIP := fromPeer.GetIP()
fromPeerIP := fromPeer.GetIPString()
if !p.incomingIPBlocklist.Contains(fromPeerIP) {
p.incomingIPBlocklist.Put(fromPeerIP, true)
blocked = true
@ -371,7 +371,7 @@ func (p *P2PServiceDefault) OnNewPeer(peer net.Peer, verifyId bool) error {
pid = "unknown"
}
pip := peer.GetIP()
pip := peer.GetIPString()
if p.incomingIPBlocklist.Contains(pid) {
p.Logger().Error("peer is on identity blocklist", zap.String("peer", pid))