diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-11-04 18:59:31 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-11-04 18:59:31 +0800 |
commit | e165c2d23cf29fdec51c59f42f74735be2a8e1ff (patch) | |
tree | 375a6b3870c6b4f791c79128a4d7b29015b64851 /p2p/protocol.go | |
parent | dda3bf3ce7ef109541adb6f0020f8d2dd28e5e51 (diff) | |
parent | e46ab3bdcde7236c8fe54d6c83655e50bd19fe31 (diff) | |
download | go-tangerine-e165c2d23cf29fdec51c59f42f74735be2a8e1ff.tar go-tangerine-e165c2d23cf29fdec51c59f42f74735be2a8e1ff.tar.gz go-tangerine-e165c2d23cf29fdec51c59f42f74735be2a8e1ff.tar.bz2 go-tangerine-e165c2d23cf29fdec51c59f42f74735be2a8e1ff.tar.lz go-tangerine-e165c2d23cf29fdec51c59f42f74735be2a8e1ff.tar.xz go-tangerine-e165c2d23cf29fdec51c59f42f74735be2a8e1ff.tar.zst go-tangerine-e165c2d23cf29fdec51c59f42f74735be2a8e1ff.zip |
Merge pull request #1934 from karalabe/polish-protocol-infos
eth, p2p, rpc/api: polish protocol info gathering
Diffstat (limited to 'p2p/protocol.go')
-rw-r--r-- | p2p/protocol.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/p2p/protocol.go b/p2p/protocol.go index ac0c3d942..ee747ba23 100644 --- a/p2p/protocol.go +++ b/p2p/protocol.go @@ -16,7 +16,11 @@ package p2p -import "fmt" +import ( + "fmt" + + "github.com/ethereum/go-ethereum/p2p/discover" +) // Protocol represents a P2P subprotocol implementation. type Protocol struct { @@ -39,6 +43,15 @@ type Protocol struct { // any protocol-level error (such as an I/O error) that is // encountered. Run func(peer *Peer, rw MsgReadWriter) error + + // NodeInfo is an optional helper method to retrieve protocol specific metadata + // about the host node. + NodeInfo func() interface{} + + // PeerInfo is an optional helper method to retrieve protocol specific metadata + // about a certain peer in the network. If an info retrieval function is set, + // but returns nil, it is assumed that the protocol handshake is still running. + PeerInfo func(id discover.NodeID) interface{} } func (p Protocol) cap() Cap { |