Documentation
¶
Index ¶
- Constants
- Variables
- func CreateTestConfig(t *testing.T, schemes *TestSchemes, geometry *geo.Geometry, ...) *config.Config
- func CreateTestGeometry(schemes *TestSchemes) *geo.Geometry
- func CreateTestGeometryCustom(schemes *TestSchemes, payloadSize, nrHops int) *geo.Geometry
- func CreateTestGeometryECDH(forwardPayloadLength, nrHops int) *geo.Geometry
- func CreateTestPKIDocument(t *testing.T, replicas []*pki.ReplicaDescriptor, ...) *pki.Document
- func CreateTestTempDir(t *testing.T, prefix string) string
- func GenerateTestReplica(t *testing.T, schemes *TestSchemes, index int) *pki.ReplicaDescriptor
- func StoreTestDocument(t *testing.T, pkiWorker *PKIWorker, doc *pki.Document)
- type Connector
- func (co *Connector) CloseAllCh() chan interface{}
- func (co *Connector) DispatchCommand(cmd commands.Command, idHash *[32]byte)
- func (co *Connector) DispatchReplication(cmd *commands.ReplicaWrite)
- func (co *Connector) ForceUpdate()
- func (co *Connector) Halt()
- func (co *Connector) OnClosedConn(c *outgoingConn)
- func (co *Connector) Server() *Server
- type EnvelopeKeys
- type GenericConnector
- type GenericListener
- type Listener
- type PKIWorker
- type Server
- type TestKeys
- type TestSchemes
Constants ¶
const ( // GracePeriod is the duration after key expirey that we keep the keys. GracePeriod = 3 * time.Hour )
const NumPKIDocsToFetch = 3
const PKIDocNum = 3
Variables ¶
var ErrGenerateOnly = errors.New("server: GenerateOnly set")
ErrGenerateOnly is the error returned when the server initialization terminates due to the `GenerateOnly` debug config option.
var (
PublishDeadline = vServer.MixPublishDeadline
)
Functions ¶
func CreateTestConfig ¶
func CreateTestConfig(t *testing.T, schemes *TestSchemes, geometry *geo.Geometry, dataDir, identifier string, addresses []string) *config.Config
CreateTestConfig creates a standard test configuration
func CreateTestGeometry ¶
func CreateTestGeometry(schemes *TestSchemes) *geo.Geometry
CreateTestGeometry creates a standard test geometry
func CreateTestGeometryCustom ¶
func CreateTestGeometryCustom(schemes *TestSchemes, payloadSize, nrHops int) *geo.Geometry
CreateTestGeometryCustom creates a custom test geometry
func CreateTestGeometryECDH ¶
CreateTestGeometryECDH creates a test geometry using ECDH
func CreateTestPKIDocument ¶
func CreateTestPKIDocument(t *testing.T, replicas []*pki.ReplicaDescriptor, serviceNodes []*pki.MixDescriptor) *pki.Document
CreateTestPKIDocument creates a test PKI document
func CreateTestTempDir ¶
CreateTestTempDir creates a temporary directory for tests
func GenerateTestReplica ¶
func GenerateTestReplica(t *testing.T, schemes *TestSchemes, index int) *pki.ReplicaDescriptor
GenerateTestReplica creates a test replica descriptor
Types ¶
type Connector ¶
func (*Connector) CloseAllCh ¶
func (co *Connector) CloseAllCh() chan interface{}
func (*Connector) DispatchCommand ¶
func (*Connector) DispatchReplication ¶
func (co *Connector) DispatchReplication(cmd *commands.ReplicaWrite)
func (*Connector) ForceUpdate ¶
func (co *Connector) ForceUpdate()
func (*Connector) OnClosedConn ¶
func (co *Connector) OnClosedConn(c *outgoingConn)
type EnvelopeKeys ¶
func NewEnvelopeKeys ¶
func (*EnvelopeKeys) EnsureKey ¶
func (k *EnvelopeKeys) EnsureKey(replicaEpoch uint64) (*replicaCommon.EnvelopeKey, error)
func (*EnvelopeKeys) Generate ¶
func (k *EnvelopeKeys) Generate(replicaEpoch uint64) error
func (*EnvelopeKeys) GetKeypair ¶
func (k *EnvelopeKeys) GetKeypair(replicaEpoch uint64) (*replicaCommon.EnvelopeKey, error)
func (*EnvelopeKeys) Prune ¶
func (k *EnvelopeKeys) Prune() bool
type GenericConnector ¶
type GenericListener ¶
type GenericListener interface {
Halt()
CloseOldConns(interface{}) error
GetConnIdentities() (map[[constants.RecipientIDLength]byte]interface{}, error)
}
type Listener ¶
func (*Listener) CloseOldConns ¶
func (*Listener) GetConnIdentities ¶
func (l *Listener) GetConnIdentities() (map[[sConstants.RecipientIDLength]byte]interface{}, error)
GetConnIdentities returns a slice of byte slices each corresponding to a currently connected client identity.
type PKIWorker ¶
type PKIWorker struct {
worker.Worker
*pki.WorkerBase
// contains filtered or unexported fields
}
func (*PKIWorker) ForceFetchPKI ¶
ForceFetchPKI forces the PKI worker to fetch a new PKI document for the current epoch. This is useful for integration tests where you want to ensure the replica has the latest PKI document without waiting for the normal fetch cycle.
func (*PKIWorker) HasCurrentPKIDocument ¶
HasCurrentPKIDocument returns true if the replica has a PKI document for the current epoch. This is useful for integration tests to check if the replica is ready.
func (*PKIWorker) PKIDocument ¶
PKIDocument returns the PKI document for the current epoch
func (*PKIWorker) ReplicasCopy ¶
func (p *PKIWorker) ReplicasCopy() map[[32]byte]*pki.ReplicaDescriptor
ReplicasCopy returns a copy of the replicas map
type Server ¶
type Server struct {
sync.WaitGroup
PKIWorker *PKIWorker
// contains filtered or unexported fields
}
func CreateTestServer ¶
func CreateTestServer(t *testing.T, cfg *config.Config, keys *TestKeys, logBackend *log.Backend) *Server
CreateTestServer creates a test server with PKI worker
func NewWithPKI ¶
NewWithPKI returns a new Server instance with a custom PKI implementation. If pkiFactory is nil, the default PKI worker is used.
func (*Server) LogBackend ¶
func (*Server) RotateLog ¶
func (s *Server) RotateLog()
RotateLog rotates the log file if logging to a file is enabled.
type TestKeys ¶
type TestKeys struct {
IdentityPubKey sign.PublicKey
IdentityPrivKey sign.PrivateKey
IdentityKeyBlob []byte
LinkPubKey kem.PublicKey
LinkPrivKey kem.PrivateKey
LinkKeyBlob []byte
ReplicaPubKey nike.PublicKey
ReplicaPrivKey nike.PrivateKey
ReplicaKeyBlob []byte
}
GenerateTestKeys generates a complete set of test keys
func GenerateTestKeys ¶
func GenerateTestKeys(t *testing.T, schemes *TestSchemes) *TestKeys
GenerateTestKeys creates a complete set of test keys
type TestSchemes ¶
TestSchemes holds the cryptographic schemes used in tests
func NewTestSchemes ¶
func NewTestSchemes() *TestSchemes
NewTestSchemes creates standard test schemes
func NewTestSchemesAdvanced ¶
func NewTestSchemesAdvanced() *TestSchemes
NewTestSchemesAdvanced creates advanced test schemes