Skip to content
This repository was archived by the owner on Aug 2, 2021. It is now read-only.

Commit 74b12e3

Browse files
acudzelig
authored andcommitted
network/retrieve: add bzz-retrieve protocol (#1589)
* network/retrieve: initial commit * network: import dependencies from stream package branch * network/retrieve: address pr comments * network/retrieve: fix pr comments * network/retrieve: create logger for peer * network: address pr comments * network/retrieve: lint * network/retrieve: prevent forever loop * network/retrieve: address pr comments * network/retrieve: fix linter * network/retrieve: pr comments * network/retrieval: pr comments
1 parent 388d8cc commit 74b12e3

File tree

7 files changed

+997
-1
lines changed

7 files changed

+997
-1
lines changed

network/retrieval/peer.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright 2019 The Swarm Authors
2+
// This file is part of the Swarm library.
3+
//
4+
// The Swarm library is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU Lesser General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// The Swarm library is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU Lesser General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU Lesser General Public License
15+
// along with the Swarm library. If not, see <http://www.gnu.org/licenses/>.
16+
17+
package retrieval
18+
19+
import (
20+
"github.com/ethereum/go-ethereum/log"
21+
"github.com/ethersphere/swarm/network"
22+
)
23+
24+
// Peer wraps BzzPeer with a contextual logger for this peer
25+
type Peer struct {
26+
*network.BzzPeer
27+
logger log.Logger
28+
}
29+
30+
// NewPeer is the constructor for Peer
31+
func NewPeer(peer *network.BzzPeer) *Peer {
32+
return &Peer{
33+
BzzPeer: peer,
34+
logger: log.New("peer", peer.ID()),
35+
}
36+
}

0 commit comments

Comments
 (0)