-
Notifications
You must be signed in to change notification settings - Fork 1
/
opts.go
40 lines (34 loc) · 1006 Bytes
/
opts.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package identify
type config struct {
protocolVersion string
userAgent string
disableSignedPeerRecord bool
metricsTracer MetricsTracer
}
// Option is an option function for identify.
type Option func(*config)
// ProtocolVersion sets the protocol version string that will be used to
// identify the family of protocols used by the peer.
func ProtocolVersion(s string) Option {
return func(cfg *config) {
cfg.protocolVersion = s
}
}
// 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
}
}
// DisableSignedPeerRecord disables populating signed peer records on the outgoing Identify response
// and ONLY sends the unsigned addresses.
func DisableSignedPeerRecord() Option {
return func(cfg *config) {
cfg.disableSignedPeerRecord = true
}
}
func WithMetricsTracer(tr MetricsTracer) Option {
return func(cfg *config) {
cfg.metricsTracer = tr
}
}