From 9cf6af474bc2aee09efcc37b39e59a58b4c597e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Wed, 28 Aug 2019 11:50:26 +0100 Subject: [PATCH] add godocs. --- config/config.go | 4 ++++ p2p/protocol/identify/opts.go | 2 ++ 2 files changed, 6 insertions(+) diff --git a/config/config.go b/config/config.go index c37dbc61c..782ac10c7 100644 --- a/config/config.go +++ b/config/config.go @@ -44,6 +44,10 @@ type RoutingC func(host.Host) (routing.PeerRouting, error) // This is *not* a stable interface. Use the options defined in the root // package. type Config struct { + // UserAgent is the identifier this node will send to other peers when + // identifying itself, e.g. via the identify protocol. + // + // Set it via the UserAgent option function. UserAgent string PeerKey crypto.PrivKey diff --git a/p2p/protocol/identify/opts.go b/p2p/protocol/identify/opts.go index 94be5b786..670b213b7 100644 --- a/p2p/protocol/identify/opts.go +++ b/p2p/protocol/identify/opts.go @@ -4,8 +4,10 @@ type config struct { userAgent string } +// Option is an option function for identify. type Option func(*config) +// UserAgent sets the user agent this node will identify itself with to peers. func UserAgent(ua string) Option { return func(cfg *config) { cfg.userAgent = ua