From 71224097679bae1109ef5806fde24c7be3d70999 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Fri, 26 Nov 2021 10:57:23 +0400 Subject: [PATCH] unexport the config --- p2p/net/connmgr/connmgr.go | 4 ++-- p2p/net/connmgr/options.go | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/p2p/net/connmgr/connmgr.go b/p2p/net/connmgr/connmgr.go index 51b6592a..a6cf5d16 100644 --- a/p2p/net/connmgr/connmgr.go +++ b/p2p/net/connmgr/connmgr.go @@ -29,7 +29,7 @@ var log = logging.Logger("connmgr") type BasicConnMgr struct { *decayer - cfg *BasicConnManagerConfig + cfg *config segments segments plk sync.RWMutex @@ -99,7 +99,7 @@ func (s *segment) tagInfoFor(p peer.ID) *peerInfo { func NewConnManager(low, hi int, grace time.Duration, opts ...Option) *BasicConnMgr { ctx, cancel := context.WithCancel(context.Background()) - cfg := &BasicConnManagerConfig{ + cfg := &config{ highWater: hi, lowWater: low, gracePeriod: grace, diff --git a/p2p/net/connmgr/options.go b/p2p/net/connmgr/options.go index cfe919e1..a4135d9a 100644 --- a/p2p/net/connmgr/options.go +++ b/p2p/net/connmgr/options.go @@ -2,9 +2,8 @@ package connmgr import "time" -// BasicConnManagerConfig is the configuration struct for the basic connection -// manager. -type BasicConnManagerConfig struct { +// config is the configuration struct for the basic connection manager. +type config struct { highWater int lowWater int gracePeriod time.Duration @@ -13,11 +12,11 @@ type BasicConnManagerConfig struct { } // Option represents an option for the basic connection manager. -type Option func(*BasicConnManagerConfig) error +type Option func(*config) error // DecayerConfig applies a configuration for the decayer. func DecayerConfig(opts *DecayerCfg) Option { - return func(cfg *BasicConnManagerConfig) error { + return func(cfg *config) error { cfg.decayer = opts return nil }