unexport the config

This commit is contained in:
Marten Seemann 2021-11-26 10:57:23 +04:00
parent 169748caf2
commit 7122409767
2 changed files with 6 additions and 7 deletions

View File

@ -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,

View File

@ -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
}