aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/protocol.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-10-27 21:10:30 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-10-28 18:44:15 +0800
commite46ab3bdcde7236c8fe54d6c83655e50bd19fe31 (patch)
tree4f30c5f9757ebfbde6501e1d53484ff51fd2fad9 /p2p/protocol.go
parent05f74077fb1bc23937f3b25fd4e826dcf5789212 (diff)
downloaddexon-e46ab3bdcde7236c8fe54d6c83655e50bd19fe31.tar
dexon-e46ab3bdcde7236c8fe54d6c83655e50bd19fe31.tar.gz
dexon-e46ab3bdcde7236c8fe54d6c83655e50bd19fe31.tar.bz2
dexon-e46ab3bdcde7236c8fe54d6c83655e50bd19fe31.tar.lz
dexon-e46ab3bdcde7236c8fe54d6c83655e50bd19fe31.tar.xz
dexon-e46ab3bdcde7236c8fe54d6c83655e50bd19fe31.tar.zst
dexon-e46ab3bdcde7236c8fe54d6c83655e50bd19fe31.zip
eth, p2p, rpc/api: polish protocol info gathering
Diffstat (limited to 'p2p/protocol.go')
-rw-r--r--p2p/protocol.go15
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 {