Skip to content

Commit cc53231

Browse files
authored
Merge pull request #140 from Ryanmello07/feat/device-probe-suite-upstream
sdk: bridge probe suite and exit fault injection to DeviceRemote
2 parents f6621d3 + 8d33731 commit cc53231

9 files changed

Lines changed: 1158 additions & 2 deletions

cgo/coverage_report.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Code generated by gen/gen.go. DO NOT EDIT.
22
The exported c surface, and every exported sdk symbol that is not exported with the reason.
33

4-
== exported (672) ==
4+
== exported (679) ==
55
urnet_account_preferences_view_controller_add_allow_product_updates_listener <- AccountPreferencesViewController.AddAllowProductUpdatesListener
66
urnet_account_preferences_view_controller_close <- AccountPreferencesViewController.Close
77
urnet_account_preferences_view_controller_get_allow_product_updates <- AccountPreferencesViewController.GetAllowProductUpdates
@@ -345,8 +345,10 @@ urnet_device_remote_close_locations_view_controller <- DeviceRemote.CloseLocatio
345345
urnet_device_remote_close_peer_view_controller <- DeviceRemote.ClosePeerViewController
346346
urnet_device_remote_close_post_quantum_identity_view_controller <- DeviceRemote.ClosePostQuantumIdentityViewController
347347
urnet_device_remote_close_view_controller <- DeviceRemote.CloseViewController
348+
urnet_device_remote_drop_exit <- DeviceRemote.DropExit
348349
urnet_device_remote_get_destination_exits <- DeviceRemote.GetDestinationExits
349350
urnet_device_remote_get_exits <- DeviceRemote.GetExits
351+
urnet_device_remote_get_probe_results <- DeviceRemote.GetProbeResults
350352
urnet_device_remote_get_reliability_metrics <- DeviceRemote.GetReliabilityMetrics
351353
urnet_device_remote_get_reliability_settings <- DeviceRemote.GetReliabilitySettings
352354
urnet_device_remote_get_remote_connected <- DeviceRemote.GetRemoteConnected
@@ -371,11 +373,16 @@ urnet_device_remote_open_referral_code_view_controller <- DeviceRemote.OpenRefer
371373
urnet_device_remote_open_subscription_balance_view_controller <- DeviceRemote.OpenSubscriptionBalanceViewController
372374
urnet_device_remote_open_wallet_view_controller <- DeviceRemote.OpenWalletViewController
373375
urnet_device_remote_probe_all_exits <- DeviceRemote.ProbeAllExits
376+
urnet_device_remote_probe_suite_running <- DeviceRemote.ProbeSuiteRunning
374377
urnet_device_remote_reset_reliability_metrics <- DeviceRemote.ResetReliabilityMetrics
375378
urnet_device_remote_reset_reliability_settings <- DeviceRemote.ResetReliabilitySettings
376379
urnet_device_remote_set_reliability_settings <- DeviceRemote.SetReliabilitySettings
377380
urnet_device_remote_set_rpc_server <- DeviceRemote.SetRpcServer
381+
urnet_device_remote_shuffle_exits <- DeviceRemote.ShuffleExits
378382
urnet_device_remote_simulate_network_change <- DeviceRemote.SimulateNetworkChange
383+
urnet_device_remote_stall_exit <- DeviceRemote.StallExit
384+
urnet_device_remote_start_probe_suite <- DeviceRemote.StartProbeSuite
385+
urnet_device_remote_stop_probe_suite <- DeviceRemote.StopProbeSuite
379386
urnet_device_remote_sync <- DeviceRemote.Sync
380387
urnet_device_remove_block_action_override <- Device.RemoveBlockActionOverride
381388
urnet_device_remove_connected_provider <- Device.RemoveConnectedProvider
@@ -675,7 +682,7 @@ urnet_wallet_view_controller_update_payout_wallet <- WalletViewController.Update
675682
urnet_wallet_view_controller_validate_address <- WalletViewController.ValidateAddress
676683
urnet_websocket_device_rpc_listener_close <- WebsocketDeviceRpcListener.Close
677684

678-
== skipped (855) ==
685+
== skipped (858) ==
679686
AccountPayment: data: crosses as json
680687
AccountPaymentsList: data: crosses as json
681688
AccountPoint: data: crosses as json
@@ -1104,9 +1111,12 @@ DeviceRemoteLocalOverrideAppIds: data: crosses as json
11041111
DeviceRemoteNetworkPeers: data: crosses as json
11051112
DeviceRemoteOfflineChangeEvent: data: crosses as json
11061113
DeviceRemotePacketStats: data: crosses as json
1114+
DeviceRemoteProbeResultListRpc: skipped: rpc gob internal (macOS parity: ignored)
1115+
DeviceRemoteProbeSuiteConfigRpc: skipped: rpc gob internal (macOS parity: ignored)
11071116
DeviceRemoteReliabilityMetricsRpc: skipped: rpc gob internal (macOS parity: ignored)
11081117
DeviceRemoteReliabilitySettingsRpc: skipped: rpc gob internal (macOS parity: ignored)
11091118
DeviceRemoteRpc: skipped: rpc gob internal (macOS parity: ignored)
1119+
DeviceRemoteStallExitRpc: skipped: rpc gob internal (macOS parity: ignored)
11101120
DeviceRemoteState: data: crosses as json
11111121
DeviceRemoteSyncRequest: data: crosses as json
11121122
DeviceRemoteSyncResponse: data: crosses as json

cgo/exports_gen.go

Lines changed: 85 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cgo/include/urnetwork_sdk.def

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,10 @@ EXPORTS
353353
urnet_device_remote_close_peer_view_controller
354354
urnet_device_remote_close_post_quantum_identity_view_controller
355355
urnet_device_remote_close_view_controller
356+
urnet_device_remote_drop_exit
356357
urnet_device_remote_get_destination_exits
357358
urnet_device_remote_get_exits
359+
urnet_device_remote_get_probe_results
358360
urnet_device_remote_get_reliability_metrics
359361
urnet_device_remote_get_reliability_settings
360362
urnet_device_remote_get_remote_connected
@@ -379,11 +381,16 @@ EXPORTS
379381
urnet_device_remote_open_subscription_balance_view_controller
380382
urnet_device_remote_open_wallet_view_controller
381383
urnet_device_remote_probe_all_exits
384+
urnet_device_remote_probe_suite_running
382385
urnet_device_remote_reset_reliability_metrics
383386
urnet_device_remote_reset_reliability_settings
384387
urnet_device_remote_set_reliability_settings
385388
urnet_device_remote_set_rpc_server
389+
urnet_device_remote_shuffle_exits
386390
urnet_device_remote_simulate_network_change
391+
urnet_device_remote_stall_exit
392+
urnet_device_remote_start_probe_suite
393+
urnet_device_remote_stop_probe_suite
387394
urnet_device_remote_sync
388395
urnet_device_remove_block_action_override
389396
urnet_device_remove_connected_provider

cgo/include/urnetwork_sdk.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,8 +831,10 @@ void urnet_device_remote_close_locations_view_controller(uint64_t self, uint64_t
831831
void urnet_device_remote_close_peer_view_controller(uint64_t self, uint64_t vc);
832832
void urnet_device_remote_close_post_quantum_identity_view_controller(uint64_t self, uint64_t vc);
833833
void urnet_device_remote_close_view_controller(uint64_t self, urnet_view_controller_close_cb vc_close, urnet_view_controller_start_cb vc_start, urnet_view_controller_stop_cb vc_stop, void* vc_user_data);
834+
bool urnet_device_remote_drop_exit(uint64_t self, const char* exit_client_id);
834835
char* urnet_device_remote_get_destination_exits(uint64_t self);
835836
char* urnet_device_remote_get_exits(uint64_t self);
837+
char* urnet_device_remote_get_probe_results(uint64_t self);
836838
char* urnet_device_remote_get_reliability_metrics(uint64_t self);
837839
char* urnet_device_remote_get_reliability_settings(uint64_t self);
838840
bool urnet_device_remote_get_remote_connected(uint64_t self);
@@ -857,11 +859,16 @@ uint64_t urnet_device_remote_open_referral_code_view_controller(uint64_t self);
857859
uint64_t urnet_device_remote_open_subscription_balance_view_controller(uint64_t self);
858860
uint64_t urnet_device_remote_open_wallet_view_controller(uint64_t self);
859861
void urnet_device_remote_probe_all_exits(uint64_t self);
862+
bool urnet_device_remote_probe_suite_running(uint64_t self);
860863
void urnet_device_remote_reset_reliability_metrics(uint64_t self);
861864
void urnet_device_remote_reset_reliability_settings(uint64_t self);
862865
void urnet_device_remote_set_reliability_settings(uint64_t self, const char* reliability_settings_json);
863866
bool urnet_device_remote_set_rpc_server(uint64_t self, const char* client_pem, const char* server_cert_pem, const char* host_port, char** out_error);
867+
void urnet_device_remote_shuffle_exits(uint64_t self);
864868
void urnet_device_remote_simulate_network_change(uint64_t self);
869+
bool urnet_device_remote_stall_exit(uint64_t self, const char* exit_client_id, bool stalled);
870+
bool urnet_device_remote_start_probe_suite(uint64_t self, const char* config_json);
871+
void urnet_device_remote_stop_probe_suite(uint64_t self);
865872
void urnet_device_remote_sync(uint64_t self);
866873

867874
/* ----- DeviceRpcKeyMaterial ----- */

cgo/include/urnetwork_sdk.hpp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10756,8 +10756,10 @@ class DeviceRemote final : public Device {
1075610756
void closePeerViewController(const PeerViewController& vc) const;
1075710757
void closePostQuantumIdentityViewController(const PostQuantumIdentityViewController& vc) const;
1075810758
void closeViewController(ViewController vc) const;
10759+
bool dropExit(const std::string& exit_client_id) const;
1075910760
std::optional<DestinationExitList> getDestinationExits() const;
1076010761
std::optional<ExitList> getExits() const;
10762+
std::optional<ProbeResultList> getProbeResults() const;
1076110763
std::optional<ReliabilityMetrics> getReliabilityMetrics() const;
1076210764
std::optional<ReliabilitySettings> getReliabilitySettings() const;
1076310765
bool getRemoteConnected() const;
@@ -10782,11 +10784,16 @@ class DeviceRemote final : public Device {
1078210784
SubscriptionBalanceViewController openSubscriptionBalanceViewController() const;
1078310785
WalletViewController openWalletViewController() const;
1078410786
void probeAllExits() const;
10787+
bool probeSuiteRunning() const;
1078510788
void resetReliabilityMetrics() const;
1078610789
void resetReliabilitySettings() const;
1078710790
void setReliabilitySettings(const std::optional<ReliabilitySettings>& reliability_settings) const;
1078810791
void setRpcServer(const std::string& client_pem, const std::string& server_cert_pem, const std::string& host_port) const;
10792+
void shuffleExits() const;
1078910793
void simulateNetworkChange() const;
10794+
bool stallExit(const std::string& exit_client_id, bool stalled) const;
10795+
bool startProbeSuite(const std::optional<ProbeSuiteConfig>& config) const;
10796+
void stopProbeSuite() const;
1079010797
void sync() const;
1079110798
/* the raw public identity key (post quantum identity) */
1079210799
std::vector<uint8_t> getPublicIdentityKey() const;
@@ -17883,6 +17890,10 @@ inline void DeviceRemote::closeViewController(ViewController vc) const {
1788317890
}
1788417891
urnet_device_remote_close_view_controller(handle(), vc_fn ? &detail::retained_view_controller_close : nullptr, vc_fn ? &detail::retained_view_controller_start : nullptr, vc_fn ? &detail::retained_view_controller_stop : nullptr, vc_fn.get());
1788517892
}
17893+
inline bool DeviceRemote::dropExit(const std::string& exit_client_id) const {
17894+
bool r = urnet_device_remote_drop_exit(handle(), exit_client_id.c_str());
17895+
return r;
17896+
}
1788617897
inline std::optional<DestinationExitList> DeviceRemote::getDestinationExits() const {
1788717898
char* r_c = urnet_device_remote_get_destination_exits(handle());
1788817899
auto r_s = detail::takeStringOpt(r_c);
@@ -17899,6 +17910,14 @@ inline std::optional<ExitList> DeviceRemote::getExits() const {
1789917910
}
1790017911
return detail::parseJson<ExitList>(r_s->c_str());
1790117912
}
17913+
inline std::optional<ProbeResultList> DeviceRemote::getProbeResults() const {
17914+
char* r_c = urnet_device_remote_get_probe_results(handle());
17915+
auto r_s = detail::takeStringOpt(r_c);
17916+
if (!r_s) {
17917+
return std::nullopt;
17918+
}
17919+
return detail::parseJson<ProbeResultList>(r_s->c_str());
17920+
}
1790217921
inline std::optional<ReliabilityMetrics> DeviceRemote::getReliabilityMetrics() const {
1790317922
char* r_c = urnet_device_remote_get_reliability_metrics(handle());
1790417923
auto r_s = detail::takeStringOpt(r_c);
@@ -18001,6 +18020,10 @@ inline WalletViewController DeviceRemote::openWalletViewController() const {
1800118020
inline void DeviceRemote::probeAllExits() const {
1800218021
urnet_device_remote_probe_all_exits(handle());
1800318022
}
18023+
inline bool DeviceRemote::probeSuiteRunning() const {
18024+
bool r = urnet_device_remote_probe_suite_running(handle());
18025+
return r;
18026+
}
1800418027
inline void DeviceRemote::resetReliabilityMetrics() const {
1800518028
urnet_device_remote_reset_reliability_metrics(handle());
1800618029
}
@@ -18026,9 +18049,29 @@ inline void DeviceRemote::setRpcServer(const std::string& client_pem, const std:
1802618049
throw Error("urnet: urnet_device_remote_set_rpc_server failed");
1802718050
}
1802818051
}
18052+
inline void DeviceRemote::shuffleExits() const {
18053+
urnet_device_remote_shuffle_exits(handle());
18054+
}
1802918055
inline void DeviceRemote::simulateNetworkChange() const {
1803018056
urnet_device_remote_simulate_network_change(handle());
1803118057
}
18058+
inline bool DeviceRemote::stallExit(const std::string& exit_client_id, bool stalled) const {
18059+
bool r = urnet_device_remote_stall_exit(handle(), exit_client_id.c_str(), stalled);
18060+
return r;
18061+
}
18062+
inline bool DeviceRemote::startProbeSuite(const std::optional<ProbeSuiteConfig>& config) const {
18063+
std::string config_json;
18064+
const char* config_c = nullptr;
18065+
if (config) {
18066+
config_json = nlohmann::json(*config).dump();
18067+
config_c = config_json.c_str();
18068+
}
18069+
bool r = urnet_device_remote_start_probe_suite(handle(), config_c);
18070+
return r;
18071+
}
18072+
inline void DeviceRemote::stopProbeSuite() const {
18073+
urnet_device_remote_stop_probe_suite(handle());
18074+
}
1803218075
inline void DeviceRemote::sync() const {
1803318076
urnet_device_remote_sync(handle());
1803418077
}

0 commit comments

Comments
 (0)