2019-02-26 18:35:16 +00:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package testplanet
|
|
|
|
|
|
|
|
import (
|
2019-07-10 03:36:09 +01:00
|
|
|
"time"
|
|
|
|
|
2019-02-26 18:35:16 +00:00
|
|
|
"go.uber.org/zap"
|
|
|
|
|
2019-11-21 22:34:49 +00:00
|
|
|
"storj.io/storj/pkg/pb"
|
2019-12-10 16:32:54 +00:00
|
|
|
"storj.io/storj/pkg/storj"
|
|
|
|
"storj.io/storj/private/testidentity"
|
2019-02-26 18:35:16 +00:00
|
|
|
"storj.io/storj/satellite"
|
2019-10-10 19:06:26 +01:00
|
|
|
"storj.io/storj/satellite/metainfo"
|
2019-02-26 18:35:16 +00:00
|
|
|
"storj.io/storj/storagenode"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Reconfigure allows to change node configurations
|
|
|
|
type Reconfigure struct {
|
2019-10-10 19:06:26 +01:00
|
|
|
NewSatelliteDB func(log *zap.Logger, index int) (satellite.DB, error)
|
|
|
|
NewSatellitePointerDB func(log *zap.Logger, index int) (metainfo.PointerDB, error)
|
|
|
|
Satellite func(log *zap.Logger, index int, config *satellite.Config)
|
2019-11-21 22:34:49 +00:00
|
|
|
ReferralManagerServer func(log *zap.Logger) pb.ReferralManagerServer
|
2019-02-26 18:35:16 +00:00
|
|
|
|
2019-07-05 17:04:15 +01:00
|
|
|
NewStorageNodeDB func(index int, db storagenode.DB, log *zap.Logger) (storagenode.DB, error)
|
2019-02-26 18:35:16 +00:00
|
|
|
StorageNode func(index int, config *storagenode.Config)
|
2019-11-06 21:38:52 +00:00
|
|
|
UniqueIPCount int
|
2019-12-10 16:32:54 +00:00
|
|
|
|
|
|
|
Identities func(log *zap.Logger, version storj.IDVersion) *testidentity.Identities
|
2019-02-26 18:35:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// DisablePeerCAWhitelist returns a `Reconfigure` that sets `UsePeerCAWhitelist` for
|
|
|
|
// all node types that use kademlia.
|
|
|
|
var DisablePeerCAWhitelist = Reconfigure{
|
|
|
|
Satellite: func(log *zap.Logger, index int, config *satellite.Config) {
|
|
|
|
config.Server.UsePeerCAWhitelist = false
|
|
|
|
},
|
|
|
|
StorageNode: func(index int, config *storagenode.Config) {
|
|
|
|
config.Server.UsePeerCAWhitelist = false
|
|
|
|
},
|
|
|
|
}
|
2019-07-10 03:36:09 +01:00
|
|
|
|
|
|
|
// ShortenOnlineWindow returns a `Reconfigure` that sets the NodeSelection
|
|
|
|
// OnlineWindow to 1 second, meaning a connection failure leads to marking the nodes as offline
|
|
|
|
var ShortenOnlineWindow = Reconfigure{
|
|
|
|
Satellite: func(log *zap.Logger, index int, config *satellite.Config) {
|
|
|
|
config.Overlay.Node.OnlineWindow = 1 * time.Second
|
|
|
|
},
|
|
|
|
}
|