Browse Source

add godocs.

pull/702/head
Raúl Kripalani 5 years ago
parent
commit
9cf6af474b
  1. 4
      config/config.go
  2. 2
      p2p/protocol/identify/opts.go

4
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

2
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

Loading…
Cancel
Save