diff --git a/cmix/interface.go b/cmix/interface.go index c03dc1296249a8174916e87f7de2836bd1c7d39f..863530bffb9e2ae583c1375cc78f0825a2907188 100644 --- a/cmix/interface.go +++ b/cmix/interface.go @@ -299,5 +299,5 @@ type ClientErrorReport func(source, message, trace string) type clientCommsInterface interface { followNetworkComms SendCmixCommsInterface - nodes.RegisterNodeCommsInterface + nodes.registerNodeCommsInterface } diff --git a/cmix/nodes/interfaces.go b/cmix/nodes/interfaces.go index 35a16cbe2db8d5a62672b657f8c66369240bc258..34824da338670ea9a40848d71518d9819a3bbda8 100644 --- a/cmix/nodes/interfaces.go +++ b/cmix/nodes/interfaces.go @@ -62,16 +62,16 @@ type MixCypher interface { MakeClientGatewayAuthMAC(salt, digest []byte) []byte } -// RegisterNodeCommsInterface is a sub-interface of client.Comms containing +// registerNodeCommsInterface is a sub-interface of client.Comms containing // the send function for registering with a cMix node. -type RegisterNodeCommsInterface interface { +type registerNodeCommsInterface interface { SendRequestClientKeyMessage(host *connect.Host, message *pb.SignedClientKeyRequest) (*pb.SignedKeyResponse, error) } -// Session is a sub-interface of the storage.Session interface relevant to +// session is a sub-interface of the storage.Session interface relevant to // the methods used in this package. -type Session interface { +type session interface { GetTransmissionID() *id.ID IsPrecanned() bool GetCmixGroup() *cyclic.Group diff --git a/cmix/nodes/register.go b/cmix/nodes/register.go index 3d03fe4569590f1f6b96af6968e55db6ce359d4e..f225cef16fd09b6b8769b4eef5661395acba8787 100644 --- a/cmix/nodes/register.go +++ b/cmix/nodes/register.go @@ -30,7 +30,7 @@ import ( // The sync.Map's keep track of the node(s) that were in progress // before an interruption and how many registration attempts have // been attempted. -func registerNodes(r *registrar, s Session, stop *stoppable.Single, +func registerNodes(r *registrar, s session, stop *stoppable.Single, inProgress, attempts *sync.Map) { interval := time.Duration(500) * time.Millisecond @@ -114,8 +114,8 @@ func registerNodes(r *registrar, s Session, stop *stoppable.Single, // registerWithNode serves as a helper for registerNodes. It registers a user // with a specific in the client's NDF. -func registerWithNode(sender gateway.Sender, comms RegisterNodeCommsInterface, - ngw network.NodeGateway, s Session, r *registrar, +func registerWithNode(sender gateway.Sender, comms registerNodeCommsInterface, + ngw network.NodeGateway, s session, r *registrar, rng csprng.Source, stop *stoppable.Single) error { nodeID, err := ngw.Node.GetNodeId() diff --git a/cmix/nodes/registrar.go b/cmix/nodes/registrar.go index 23f859915ae356020b885b4339c2871ecde8ec6c..1d076e5254f1375788b04d6673ced91734fad0ab 100644 --- a/cmix/nodes/registrar.go +++ b/cmix/nodes/registrar.go @@ -34,9 +34,9 @@ type registrar struct { kv *versioned.KV mux sync.RWMutex - session Session + session session sender gateway.Sender - comms RegisterNodeCommsInterface + comms registerNodeCommsInterface rng *fastRNG.StreamGenerator c chan network.NodeGateway @@ -44,8 +44,8 @@ type registrar struct { // LoadRegistrar loads a Registrar from disk or creates a new one if it does not // exist. -func LoadRegistrar(session Session, sender gateway.Sender, - comms RegisterNodeCommsInterface, rngGen *fastRNG.StreamGenerator, +func LoadRegistrar(session session, sender gateway.Sender, + comms registerNodeCommsInterface, rngGen *fastRNG.StreamGenerator, c chan network.NodeGateway) (Registrar, error) { kv := session.GetKV().Prefix(prefix) diff --git a/cmix/nodes/request.go b/cmix/nodes/request.go index fe251e46a97bae064b840e7bcc6ac84278a481fa..a172c28246b8e88d908317c6873b56ebe129f3f1 100644 --- a/cmix/nodes/request.go +++ b/cmix/nodes/request.go @@ -26,8 +26,8 @@ import ( // requestKey is a helper function which constructs a ClientKeyRequest message. // This message is sent to the passed gateway. It will further handle the // request from the gateway. -func requestKey(sender gateway.Sender, comms RegisterNodeCommsInterface, - ngw network.NodeGateway, s Session, r *registrar, +func requestKey(sender gateway.Sender, comms registerNodeCommsInterface, + ngw network.NodeGateway, s session, r *registrar, rng io.Reader, stop *stoppable.Single) (*cyclic.Int, []byte, uint64, error) { @@ -92,7 +92,7 @@ func requestKey(sender gateway.Sender, comms RegisterNodeCommsInterface, // makeSignedKeyRequest is a helper function which constructs a // pb.SignedClientKeyRequest to send to the node/gateway pair the // user is trying to register with. -func makeSignedKeyRequest(s Session, rng io.Reader, +func makeSignedKeyRequest(s session, rng io.Reader, gwId *id.ID, dhPub *cyclic.Int) (*pb.SignedClientKeyRequest, error) { // Reconstruct client confirmation message diff --git a/cmix/nodes/utils_test.go b/cmix/nodes/utils_test.go index 2c1169c386582248549258522145b80b2afb4413..895999b6faca1976df84da2369d59f77f4a74a9b 100644 --- a/cmix/nodes/utils_test.go +++ b/cmix/nodes/utils_test.go @@ -145,7 +145,7 @@ func (m mockSender) GetHostParams() connect.HostParams { } /////////////////////////////////////////////////////////////////////////////// -///////////////// Mock storage.Session Interface ////////////////////////////// +///////////////// Mock storage.session Interface ////////////////////////////// /////////////////////////////////////////////////////////////////////////////// type mockSession struct { @@ -192,7 +192,7 @@ func (m mockSession) GetTransmissionRegistrationValidationSignature() []byte { ///////////////// Mock Comms Interface /////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -// Mock client comms object adhering to RegisterNodeCommsInterface for testing. +// Mock client comms object adhering to registerNodeCommsInterface for testing. type MockClientComms struct { rsaPrivKey *rsa.PrivateKey dhPrivKey *cyclic.Int