diff --git a/connectClient/client b/connectClient/client new file mode 100755 index 0000000000000000000000000000000000000000..55b3f98c36f3312074ae993e282a0a9db6287457 Binary files /dev/null and b/connectClient/client differ diff --git a/connectClient/main.go b/connectClient/main.go index 079f071f1997cf558274b660706dc20c02d17d7d..7147b0fc7c137fb499d6c1f18f152ade425145d8 100644 --- a/connectClient/main.go +++ b/connectClient/main.go @@ -70,7 +70,7 @@ func main() { // Login to your client session-------------------------------------------- // Login with the same sessionPath and sessionPass used to call NewClient() - baseClient, err := xxdk.LoadCmix(statePath, []byte(statePass), + net, err := xxdk.LoadCmix(statePath, []byte(statePass), xxdk.GetDefaultCMixParams()) if err != nil { jww.FATAL.Panicf("Failed to load state: %+v", err) @@ -78,15 +78,15 @@ func main() { // Get reception identity (automatically created if one does not exist) identityStorageKey := "identityStorageKey" - identity, err := xxdk.LoadReceptionIdentity(identityStorageKey, baseClient) + identity, err := xxdk.LoadReceptionIdentity(identityStorageKey, net) if err != nil { // If no extant xxdk.ReceptionIdentity, generate and store a new one - identity, err = xxdk.MakeReceptionIdentity(baseClient) + identity, err = xxdk.MakeReceptionIdentity(net) if err != nil { jww.FATAL.Panicf("Failed to generate reception identity: %+v", err) } err = xxdk.StoreReceptionIdentity( - identityStorageKey, identity, baseClient) + identityStorageKey, identity, net) if err != nil { jww.FATAL.Panicf("Failed to store new reception identity: %+v", err) } @@ -97,7 +97,7 @@ func main() { // `xxdk.DefaultAuthCallbacks` is fine here params := xxdk.GetDefaultE2EParams() jww.INFO.Printf("Using E2E parameters: %+v", params) - e2eClient, err := xxdk.Login(baseClient, xxdk.DefaultAuthCallbacks{}, + messenger, err := xxdk.Login(net, xxdk.DefaultAuthCallbacks{}, identity, params) if err != nil { jww.FATAL.Panicf("Unable to Login: %+v", err) @@ -107,7 +107,7 @@ func main() { // Set networkFollowerTimeout to a value of your choice (seconds) networkFollowerTimeout := 5 * time.Second - err = e2eClient.StartNetworkFollower(networkFollowerTimeout) + err = messenger.StartNetworkFollower(networkFollowerTimeout) if err != nil { jww.FATAL.Panicf("Failed to start network follower: %+v", err) } @@ -133,7 +133,7 @@ func main() { connected := make(chan bool, 10) // Provide a callback that will be signalled when network // health status changes - e2eClient.GetCmix().AddHealthCallback( + messenger.GetCmix().AddHealthCallback( func(isConnected bool) { connected <- isConnected }) @@ -159,7 +159,7 @@ func main() { jww.INFO.Printf("Recipient contact: %+v", recipientContact) // Create the connection - handler, err := connect.Connect(recipientContact, e2eClient, params) + handler, err := connect.Connect(recipientContact, messenger, params) if err != nil { jww.FATAL.Panicf("Failed to create connection object: %+v", err) } @@ -197,7 +197,7 @@ func main() { signal.Notify(c, os.Interrupt, syscall.SIGTERM) <-c - err = e2eClient.StopNetworkFollower() + err = messenger.StopNetworkFollower() if err != nil { jww.ERROR.Printf("Failed to stop network follower: %+v", err) } else { diff --git a/connectServer/main.go b/connectServer/main.go index 78c049f293fea91024da03182184acffda0a9ebe..acb20048ecc7b4363a5ca52e34cf98ff5438f733 100644 --- a/connectServer/main.go +++ b/connectServer/main.go @@ -69,7 +69,7 @@ func main() { // Load client state and identity------------------------------------------ // Load with the same sessionPath and sessionPass used to call NewClient() - baseClient, err := xxdk.LoadCmix(statePath, []byte(statePass), + net, err := xxdk.LoadCmix(statePath, []byte(statePass), xxdk.GetDefaultCMixParams()) if err != nil { jww.FATAL.Panicf("Failed to load state: %+v", err) @@ -77,14 +77,14 @@ func main() { // Get reception identity (automatically created if one does not exist) identityStorageKey := "identityStorageKey" - identity, err := xxdk.LoadReceptionIdentity(identityStorageKey, baseClient) + identity, err := xxdk.LoadReceptionIdentity(identityStorageKey, net) if err != nil { // If no extant xxdk.ReceptionIdentity, generate and store a new one - identity, err = xxdk.MakeReceptionIdentity(baseClient) + identity, err = xxdk.MakeReceptionIdentity(net) if err != nil { jww.FATAL.Panicf("Failed to generate reception identity: %+v", err) } - err = xxdk.StoreReceptionIdentity(identityStorageKey, identity, baseClient) + err = xxdk.StoreReceptionIdentity(identityStorageKey, identity, net) if err != nil { jww.FATAL.Panicf("Failed to store new reception identity: %+v", err) } @@ -127,7 +127,7 @@ func main() { //connections with you connectionListParams := connect.DefaultConnectionListParams() connectServer, err := connect.StartServer( - identity, cb, baseClient, e2eParams, connectionListParams) + identity, cb, net, e2eParams, connectionListParams) if err != nil { jww.FATAL.Panicf("Unable to start connection server: %+v", err) } diff --git a/connectServer/server b/connectServer/server new file mode 100755 index 0000000000000000000000000000000000000000..a8e52976efc6ae45b2c52731e7e3831ed45503ec Binary files /dev/null and b/connectServer/server differ diff --git a/restConnectClient/main.go b/restConnectClient/main.go index 58310b55c9ac8bce577ea4e97dd29ae8b98b09ad..e0365a249343fb7298dfc0d5a048008cfd4da1f2 100644 --- a/restConnectClient/main.go +++ b/restConnectClient/main.go @@ -87,7 +87,7 @@ func main() { // Login to your client session-------------------------------------------- // Login with the same sessionPath and sessionPass used to call NewClient() - baseClient, err := xxdk.LoadCmix(statePath, []byte(statePass), + net, err := xxdk.LoadCmix(statePath, []byte(statePass), xxdk.GetDefaultCMixParams()) if err != nil { jww.FATAL.Panicf("Failed to load state: %+v", err) @@ -95,14 +95,14 @@ func main() { // Get reception identity (automatically created if one does not exist) identityStorageKey := "identityStorageKey" - identity, err := xxdk.LoadReceptionIdentity(identityStorageKey, baseClient) + identity, err := xxdk.LoadReceptionIdentity(identityStorageKey, net) if err != nil { // If no extant xxdk.ReceptionIdentity, generate and store a new one - identity, err = xxdk.MakeReceptionIdentity(baseClient) + identity, err = xxdk.MakeReceptionIdentity(net) if err != nil { jww.FATAL.Panicf("Failed to generate reception identity: %+v", err) } - err = xxdk.StoreReceptionIdentity(identityStorageKey, identity, baseClient) + err = xxdk.StoreReceptionIdentity(identityStorageKey, identity, net) if err != nil { jww.FATAL.Panicf("Failed to store new reception identity: %+v", err) } @@ -113,7 +113,7 @@ func main() { // xxdk.DefaultAuthCallbacks is fine here params := xxdk.GetDefaultE2EParams() jww.INFO.Printf("Using E2E parameters: %+v", params) - e2eClient, err := xxdk.Login(baseClient, xxdk.DefaultAuthCallbacks{}, + messenger, err := xxdk.Login(net, xxdk.DefaultAuthCallbacks{}, identity, params) if err != nil { jww.FATAL.Panicf("Unable to Login: %+v", err) @@ -123,7 +123,7 @@ func main() { // Set networkFollowerTimeout to a value of your choice (seconds) networkFollowerTimeout := 5 * time.Second - err = e2eClient.StartNetworkFollower(networkFollowerTimeout) + err = messenger.StartNetworkFollower(networkFollowerTimeout) if err != nil { jww.FATAL.Panicf("Failed to start network follower: %+v", err) } @@ -149,7 +149,7 @@ func main() { connected := make(chan bool, 10) // Provide a callback that will be signalled when network health status // changes - e2eClient.GetCmix().AddHealthCallback( + messenger.GetCmix().AddHealthCallback( func(isConnected bool) { connected <- isConnected }) @@ -176,7 +176,7 @@ func main() { // Establish connection with the server------------------------------------ - handler, err := connect.Connect(serverContact, e2eClient, params) + handler, err := connect.Connect(serverContact, messenger, params) if err != nil { jww.FATAL.Panicf("Failed to create connection object: %+v", err) } @@ -185,7 +185,7 @@ func main() { // Construct request------------------------------------------------------- - stream := e2eClient.GetRng().GetStream() + stream := messenger.GetRng().GetStream() defer stream.Close() grp, err := identity.GetGroup() @@ -241,7 +241,7 @@ func main() { jww.DEBUG.Printf("Waiting for SIGTERM signal to close process") <-c - err = e2eClient.StopNetworkFollower() + err = messenger.StopNetworkFollower() if err != nil { jww.ERROR.Printf("Failed to stop network follower: %+v", err) } else { diff --git a/restConnectServer/main.go b/restConnectServer/main.go index ccf694221a841137f110f02d276821e4f7185a16..893c1af1f6d04f744f3699dfa2bad619c6581fbb 100644 --- a/restConnectServer/main.go +++ b/restConnectServer/main.go @@ -80,7 +80,7 @@ func main() { // Login to your client session-------------------------------------------- // Login with the same sessionPath and sessionPass used to call NewClient() - baseClient, err := xxdk.LoadCmix(statePath, []byte(statePass), + net, err := xxdk.LoadCmix(statePath, []byte(statePass), xxdk.GetDefaultCMixParams()) if err != nil { jww.FATAL.Panicf("Failed to load state: %+v", err) @@ -88,14 +88,14 @@ func main() { // Get reception identity (automatically created if one does not exist) identityStorageKey := "identityStorageKey" - identity, err := xxdk.LoadReceptionIdentity(identityStorageKey, baseClient) + identity, err := xxdk.LoadReceptionIdentity(identityStorageKey, net) if err != nil { // If no extant xxdk.ReceptionIdentity, generate and store a new one - identity, err = xxdk.MakeReceptionIdentity(baseClient) + identity, err = xxdk.MakeReceptionIdentity(net) if err != nil { jww.FATAL.Panicf("Failed to generate reception identity: %+v", err) } - err = xxdk.StoreReceptionIdentity(identityStorageKey, identity, baseClient) + err = xxdk.StoreReceptionIdentity(identityStorageKey, identity, net) if err != nil { jww.FATAL.Panicf("Failed to store new reception identity: %+v", err) } @@ -105,7 +105,7 @@ func main() { // The 'restlike' package handles AuthCallbacks, // xxdk.DefaultAuthCallbacks is fine here jww.INFO.Printf("Using E2E parameters: %+v", e2eParams) - e2eClient, err := xxdk.Login(baseClient, xxdk.DefaultAuthCallbacks{}, + messenger, err := xxdk.Login(net, xxdk.DefaultAuthCallbacks{}, identity, e2eParams) if err != nil { jww.FATAL.Panicf("Unable to Login: %+v", err) @@ -117,7 +117,7 @@ func main() { writeContact(contactFilePath, identity.GetContact()) // Start rest-like connect server------------------------------------------ - restlikeServer, err := restConnect.NewServer(identity, e2eClient.Cmix, + restlikeServer, err := restConnect.NewServer(identity, messenger.Cmix, e2eParams, connParams) if err != nil { jww.FATAL.Panicf("Unable to start restlike connect server: %+v", err) @@ -137,7 +137,7 @@ func main() { // Set networkFollowerTimeout to a value of your choice (seconds) networkFollowerTimeout := 5 * time.Second - err = e2eClient.StartNetworkFollower(networkFollowerTimeout) + err = messenger.StartNetworkFollower(networkFollowerTimeout) if err != nil { jww.FATAL.Panicf("Failed to start network follower: %+v", err) } @@ -163,7 +163,7 @@ func main() { connected := make(chan bool, 10) // Provide a callback that will be signalled when network // health status changes - e2eClient.GetCmix().AddHealthCallback( + messenger.GetCmix().AddHealthCallback( func(isConnected bool) { connected <- isConnected }) @@ -178,7 +178,7 @@ func main() { jww.DEBUG.Printf("Waiting for SIGTERM signal to close process") <-c - err = e2eClient.StopNetworkFollower() + err = messenger.StopNetworkFollower() if err != nil { jww.ERROR.Printf("Failed to stop network follower: %+v", err) } else { diff --git a/restSingleUseClient/main.go b/restSingleUseClient/main.go index 881569a97cc6bb4dec139025bb4ad78c28ba1d41..ad2e29c1ee742a559b509105dd7daef8ad642610 100644 --- a/restSingleUseClient/main.go +++ b/restSingleUseClient/main.go @@ -84,7 +84,7 @@ func main() { // Login to your client session-------------------------------------------- // Login with the same sessionPath and sessionPass used to call NewClient() - baseClient, err := xxdk.LoadCmix(statePath, []byte(statePass), + net, err := xxdk.LoadCmix(statePath, []byte(statePass), xxdk.GetDefaultCMixParams()) if err != nil { jww.FATAL.Panicf("Failed to load state: %+v", err) @@ -92,14 +92,14 @@ func main() { // Get reception identity (automatically created if one does not exist) identityStorageKey := "identityStorageKey" - identity, err := xxdk.LoadReceptionIdentity(identityStorageKey, baseClient) + identity, err := xxdk.LoadReceptionIdentity(identityStorageKey, net) if err != nil { // If no extant xxdk.ReceptionIdentity, generate and store a new one - identity, err = xxdk.MakeReceptionIdentity(baseClient) + identity, err = xxdk.MakeReceptionIdentity(net) if err != nil { jww.FATAL.Panicf("Failed to generate reception identity: %+v", err) } - err = xxdk.StoreReceptionIdentity(identityStorageKey, identity, baseClient) + err = xxdk.StoreReceptionIdentity(identityStorageKey, identity, net) if err != nil { jww.FATAL.Panicf("Failed to store new reception identity: %+v", err) } @@ -110,7 +110,7 @@ func main() { // xxdk.DefaultAuthCallbacks is fine here params := xxdk.GetDefaultE2EParams() jww.INFO.Printf("Using E2E parameters: %+v", params) - e2eClient, err := xxdk.Login(baseClient, xxdk.DefaultAuthCallbacks{}, + messenger, err := xxdk.Login(net, xxdk.DefaultAuthCallbacks{}, identity, params) if err != nil { jww.FATAL.Panicf("Unable to Login: %+v", err) @@ -120,7 +120,7 @@ func main() { // Set networkFollowerTimeout to a value of your choice (seconds) networkFollowerTimeout := 5 * time.Second - err = e2eClient.StartNetworkFollower(networkFollowerTimeout) + err = messenger.StartNetworkFollower(networkFollowerTimeout) if err != nil { jww.FATAL.Panicf("Failed to start network follower: %+v", err) } @@ -146,7 +146,7 @@ func main() { connected := make(chan bool, 10) // Provide a callback that will be signalled when network health status // changes - e2eClient.GetCmix().AddHealthCallback( + messenger.GetCmix().AddHealthCallback( func(isConnected bool) { connected <- isConnected }) @@ -173,7 +173,7 @@ func main() { // Construct request------------------------------------------------------- - stream := e2eClient.GetRng().GetStream() + stream := messenger.GetRng().GetStream() defer stream.Close() grp, err := identity.GetGroup() @@ -182,7 +182,7 @@ func main() { } request := restSingle.Request{ - Net: e2eClient.GetCmix(), + Net: messenger.GetCmix(), Rng: stream, E2eGrp: grp, } @@ -230,7 +230,7 @@ func main() { jww.DEBUG.Printf("Waiting for SIGTERM signal to close process") <-c - err = e2eClient.StopNetworkFollower() + err = messenger.StopNetworkFollower() if err != nil { jww.ERROR.Printf("Failed to stop network follower: %+v", err) } else { diff --git a/restSingleUseServer/main.go b/restSingleUseServer/main.go index c21288e1141b6934eb948423181fd5b11d359c9f..0ba74c3ba71370e99b2245ac0f39f4efcaa361c3 100644 --- a/restSingleUseServer/main.go +++ b/restSingleUseServer/main.go @@ -75,7 +75,7 @@ func main() { // Login to your client session-------------------------------------------- // Login with the same sessionPath and sessionPass used to call NewClient() - baseClient, err := xxdk.LoadCmix(statePath, []byte(statePass), + net, err := xxdk.LoadCmix(statePath, []byte(statePass), xxdk.GetDefaultCMixParams()) if err != nil { jww.FATAL.Panicf("Failed to load state: %+v", err) @@ -83,14 +83,14 @@ func main() { // Get reception identity (automatically created if one does not exist) identityStorageKey := "identityStorageKey" - identity, err := xxdk.LoadReceptionIdentity(identityStorageKey, baseClient) + identity, err := xxdk.LoadReceptionIdentity(identityStorageKey, net) if err != nil { // If no extant xxdk.ReceptionIdentity, generate and store a new one - identity, err = xxdk.MakeReceptionIdentity(baseClient) + identity, err = xxdk.MakeReceptionIdentity(net) if err != nil { jww.FATAL.Panicf("Failed to generate reception identity: %+v", err) } - err = xxdk.StoreReceptionIdentity(identityStorageKey, identity, baseClient) + err = xxdk.StoreReceptionIdentity(identityStorageKey, identity, net) if err != nil { jww.FATAL.Panicf("Failed to store new reception identity: %+v", err) } @@ -101,7 +101,7 @@ func main() { // xxdk.DefaultAuthCallbacks is fine here params := xxdk.GetDefaultE2EParams() jww.INFO.Printf("Using E2E parameters: %+v", params) - e2eClient, err := xxdk.Login(baseClient, xxdk.DefaultAuthCallbacks{}, + messenger, err := xxdk.Login(net, xxdk.DefaultAuthCallbacks{}, identity, params) if err != nil { jww.FATAL.Panicf("Unable to Login: %+v", err) @@ -126,7 +126,7 @@ func main() { } // Initialize the server restlikeServer := single.NewServer(identity.ID, dhKeyPrivateKey, - grp, e2eClient.GetCmix()) + grp, messenger.GetCmix()) jww.INFO.Printf("Initialized restlike single use server") // Implement restlike endpoint--------------------------------------------- @@ -142,7 +142,7 @@ func main() { // Set networkFollowerTimeout to a value of your choice (seconds) networkFollowerTimeout := 5 * time.Second - err = e2eClient.StartNetworkFollower(networkFollowerTimeout) + err = messenger.StartNetworkFollower(networkFollowerTimeout) if err != nil { jww.FATAL.Panicf("Failed to start network follower: %+v", err) } @@ -168,7 +168,7 @@ func main() { connected := make(chan bool, 10) // Provide a callback that will be signalled when network // health status changes - e2eClient.GetCmix().AddHealthCallback( + messenger.GetCmix().AddHealthCallback( func(isConnected bool) { connected <- isConnected }) @@ -183,7 +183,7 @@ func main() { jww.DEBUG.Printf("Waiting for SIGTERM signal to close process") <-c - err = e2eClient.StopNetworkFollower() + err = messenger.StopNetworkFollower() if err != nil { jww.ERROR.Printf("Failed to stop network follower: %+v", err) } else {