diff options
author | Anton Evangelatov <anton.evangelatov@gmail.com> | 2019-01-24 19:02:18 +0800 |
---|---|---|
committer | Rafael Matias <rafael@skyle.net> | 2019-02-19 19:56:30 +0800 |
commit | 4976fcc91a43b5c7047c51a03985887b694f0fbb (patch) | |
tree | c2aef8ce616498f44d38a6a830c211112e0a6d71 /p2p/protocols | |
parent | 878aa58ec66ffc541a80aa65ee35261efa086c9c (diff) | |
download | go-tangerine-4976fcc91a43b5c7047c51a03985887b694f0fbb.tar go-tangerine-4976fcc91a43b5c7047c51a03985887b694f0fbb.tar.gz go-tangerine-4976fcc91a43b5c7047c51a03985887b694f0fbb.tar.bz2 go-tangerine-4976fcc91a43b5c7047c51a03985887b694f0fbb.tar.lz go-tangerine-4976fcc91a43b5c7047c51a03985887b694f0fbb.tar.xz go-tangerine-4976fcc91a43b5c7047c51a03985887b694f0fbb.tar.zst go-tangerine-4976fcc91a43b5c7047c51a03985887b694f0fbb.zip |
swarm: bootnode-mode, new bootnodes and no p2p package discovery (#18498)
(cherry picked from commit bbd120354a8d226b446591eeda9f9462cb9b690a)
Diffstat (limited to 'p2p/protocols')
-rw-r--r-- | p2p/protocols/protocol.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/p2p/protocols/protocol.go b/p2p/protocols/protocol.go index b16720dd3..bf879b985 100644 --- a/p2p/protocols/protocol.go +++ b/p2p/protocols/protocol.go @@ -423,3 +423,17 @@ func (p *Peer) Handshake(ctx context.Context, hs interface{}, verify func(interf } return rhs, nil } + +// HasCap returns true if Peer has a capability +// with provided name. +func (p *Peer) HasCap(capName string) (yes bool) { + if p == nil || p.Peer == nil { + return false + } + for _, c := range p.Caps() { + if c.Name == capName { + return true + } + } + return false +} |