Skip to content

Commit dc1fb92

Browse files
committed
feat(sdk): bridge probe suite and exit fault injection to DeviceRemote
Adds the DeviceRemote-side RPC proxy for the probe suite and per-exit fault injection controls that already exist on DeviceLocal: DropExit, StallExit, ShuffleExits, StartProbeSuite, StopProbeSuite, ProbeSuiteRunning, and GetProbeResults. Desktop clients run the sdk in a privileged service and talk to it only through DeviceRemote, so without this bridge those seven controls are unreachable outside the service process. Also includes: - normalizeProbeSuiteConfig: bounds every ProbeSuiteConfig field before a run starts, since the config crosses a process boundary over rpc and a hostile value (e.g. Concurrency 1<<30) would spawn goroutines inside the privileged service. - exportedList.MarshalJSON: an empty list now encodes as `[]` rather than `null`, which GetProbeResults depends on for the c++ wrapper that unwraps a list getter into a std::vector. - cgo bindings regenerated via `go run ./gen` (GOOS=linux, to include the unix-tagged declarations a Windows host cannot see), which also catches up already-merged RoutingTier bindings that predated this regeneration. Unblocks urnetwork/windows#1, which calls these seven methods on DeviceRemote and fails to compile against upstream sdk without them.
1 parent eb99be6 commit dc1fb92

9 files changed

Lines changed: 1260 additions & 2 deletions

cgo/coverage_report.txt

Lines changed: 16 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 (669) ==
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
@@ -321,6 +321,7 @@ urnet_device_local_set_flow_owner_lookup <- DeviceLocal.SetFlowOwnerLookup
321321
urnet_device_local_set_key_material <- DeviceLocal.SetKeyMaterial
322322
urnet_device_local_set_performance_degraded <- DeviceLocal.SetPerformanceDegraded
323323
urnet_device_local_set_reliability_settings <- DeviceLocal.SetReliabilitySettings
324+
urnet_device_local_set_routing_tier <- DeviceLocal.SetRoutingTier
324325
urnet_device_local_set_rpc_server <- DeviceLocal.SetRpcServer
325326
urnet_device_local_set_tunnel_dns_setting <- DeviceLocal.SetTunnelDnsSetting
326327
urnet_device_local_shuffle_exits <- DeviceLocal.ShuffleExits
@@ -344,8 +345,10 @@ urnet_device_remote_close_locations_view_controller <- DeviceRemote.CloseLocatio
344345
urnet_device_remote_close_peer_view_controller <- DeviceRemote.ClosePeerViewController
345346
urnet_device_remote_close_post_quantum_identity_view_controller <- DeviceRemote.ClosePostQuantumIdentityViewController
346347
urnet_device_remote_close_view_controller <- DeviceRemote.CloseViewController
348+
urnet_device_remote_drop_exit <- DeviceRemote.DropExit
347349
urnet_device_remote_get_destination_exits <- DeviceRemote.GetDestinationExits
348350
urnet_device_remote_get_exits <- DeviceRemote.GetExits
351+
urnet_device_remote_get_probe_results <- DeviceRemote.GetProbeResults
349352
urnet_device_remote_get_reliability_metrics <- DeviceRemote.GetReliabilityMetrics
350353
urnet_device_remote_get_reliability_settings <- DeviceRemote.GetReliabilitySettings
351354
urnet_device_remote_get_remote_connected <- DeviceRemote.GetRemoteConnected
@@ -370,11 +373,16 @@ urnet_device_remote_open_referral_code_view_controller <- DeviceRemote.OpenRefer
370373
urnet_device_remote_open_subscription_balance_view_controller <- DeviceRemote.OpenSubscriptionBalanceViewController
371374
urnet_device_remote_open_wallet_view_controller <- DeviceRemote.OpenWalletViewController
372375
urnet_device_remote_probe_all_exits <- DeviceRemote.ProbeAllExits
376+
urnet_device_remote_probe_suite_running <- DeviceRemote.ProbeSuiteRunning
373377
urnet_device_remote_reset_reliability_metrics <- DeviceRemote.ResetReliabilityMetrics
374378
urnet_device_remote_reset_reliability_settings <- DeviceRemote.ResetReliabilitySettings
375379
urnet_device_remote_set_reliability_settings <- DeviceRemote.SetReliabilitySettings
376380
urnet_device_remote_set_rpc_server <- DeviceRemote.SetRpcServer
381+
urnet_device_remote_shuffle_exits <- DeviceRemote.ShuffleExits
377382
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
378386
urnet_device_remote_sync <- DeviceRemote.Sync
379387
urnet_device_remove_block_action_override <- Device.RemoveBlockActionOverride
380388
urnet_device_remove_connected_provider <- Device.RemoveConnectedProvider
@@ -467,6 +475,7 @@ urnet_local_state_get_provide_mode <- LocalState.GetProvideMode
467475
urnet_local_state_get_provide_network_mode <- LocalState.GetProvideNetworkMode
468476
urnet_local_state_get_provide_secret_keys <- LocalState.GetProvideSecretKeys
469477
urnet_local_state_get_route_local <- LocalState.GetRouteLocal
478+
urnet_local_state_get_routing_tier <- LocalState.GetRoutingTier
470479
urnet_local_state_get_vpn_interface_while_offline <- LocalState.GetVpnInterfaceWhileOffline
471480
urnet_local_state_logout <- LocalState.Logout
472481
urnet_local_state_parse_by_jwt <- LocalState.ParseByJwt
@@ -490,6 +499,7 @@ urnet_local_state_set_provide_mode <- LocalState.SetProvideMode
490499
urnet_local_state_set_provide_network_mode <- LocalState.SetProvideNetworkMode
491500
urnet_local_state_set_provide_secret_keys <- LocalState.SetProvideSecretKeys
492501
urnet_local_state_set_route_local <- LocalState.SetRouteLocal
502+
urnet_local_state_set_routing_tier <- LocalState.SetRoutingTier
493503
urnet_local_state_set_vpn_interface_while_offline <- LocalState.SetVpnInterfaceWhileOffline
494504
urnet_locations_view_controller_add_filtered_locations_listener <- LocationsViewController.AddFilteredLocationsListener
495505
urnet_locations_view_controller_close <- LocationsViewController.Close
@@ -672,7 +682,7 @@ urnet_wallet_view_controller_update_payout_wallet <- WalletViewController.Update
672682
urnet_wallet_view_controller_validate_address <- WalletViewController.ValidateAddress
673683
urnet_websocket_device_rpc_listener_close <- WebsocketDeviceRpcListener.Close
674684

675-
== skipped (854) ==
685+
== skipped (858) ==
676686
AccountPayment: data: crosses as json
677687
AccountPaymentsList: data: crosses as json
678688
AccountPoint: data: crosses as json
@@ -1101,9 +1111,12 @@ DeviceRemoteLocalOverrideAppIds: data: crosses as json
11011111
DeviceRemoteNetworkPeers: data: crosses as json
11021112
DeviceRemoteOfflineChangeEvent: data: crosses as json
11031113
DeviceRemotePacketStats: data: crosses as json
1114+
DeviceRemoteProbeResultListRpc: skipped: rpc gob internal (macOS parity: ignored)
1115+
DeviceRemoteProbeSuiteConfigRpc: skipped: rpc gob internal (macOS parity: ignored)
11041116
DeviceRemoteReliabilityMetricsRpc: skipped: rpc gob internal (macOS parity: ignored)
11051117
DeviceRemoteReliabilitySettingsRpc: skipped: rpc gob internal (macOS parity: ignored)
11061118
DeviceRemoteRpc: skipped: rpc gob internal (macOS parity: ignored)
1119+
DeviceRemoteStallExitRpc: skipped: rpc gob internal (macOS parity: ignored)
11071120
DeviceRemoteState: data: crosses as json
11081121
DeviceRemoteSyncRequest: data: crosses as json
11091122
DeviceRemoteSyncResponse: data: crosses as json
@@ -1400,6 +1413,7 @@ RenderIdenticonPng: unmappable: result: []byte
14001413
RequireIdFromBytes: skipped: panics on bad input; use urnet_parse_id
14011414
RouteLocalChangeListener: callback interface: crosses as c function pointer
14021415
RouteOverride: data: crosses as json
1416+
RoutingTier: no exports
14031417
RpcNoArg: skipped: rpc gob internal (macOS parity: ignored)
14041418
RpcVoid: skipped: rpc gob internal (macOS parity: ignored)
14051419
SelectedLocationListener: callback interface: crosses as c function pointer

cgo/exports_gen.go

Lines changed: 121 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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ EXPORTS
329329
urnet_device_local_set_key_material
330330
urnet_device_local_set_performance_degraded
331331
urnet_device_local_set_reliability_settings
332+
urnet_device_local_set_routing_tier
332333
urnet_device_local_set_rpc_server
333334
urnet_device_local_set_tunnel_dns_setting
334335
urnet_device_local_shuffle_exits
@@ -352,8 +353,10 @@ EXPORTS
352353
urnet_device_remote_close_peer_view_controller
353354
urnet_device_remote_close_post_quantum_identity_view_controller
354355
urnet_device_remote_close_view_controller
356+
urnet_device_remote_drop_exit
355357
urnet_device_remote_get_destination_exits
356358
urnet_device_remote_get_exits
359+
urnet_device_remote_get_probe_results
357360
urnet_device_remote_get_reliability_metrics
358361
urnet_device_remote_get_reliability_settings
359362
urnet_device_remote_get_remote_connected
@@ -378,11 +381,16 @@ EXPORTS
378381
urnet_device_remote_open_subscription_balance_view_controller
379382
urnet_device_remote_open_wallet_view_controller
380383
urnet_device_remote_probe_all_exits
384+
urnet_device_remote_probe_suite_running
381385
urnet_device_remote_reset_reliability_metrics
382386
urnet_device_remote_reset_reliability_settings
383387
urnet_device_remote_set_reliability_settings
384388
urnet_device_remote_set_rpc_server
389+
urnet_device_remote_shuffle_exits
385390
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
386394
urnet_device_remote_sync
387395
urnet_device_remove_block_action_override
388396
urnet_device_remove_connected_provider
@@ -477,6 +485,7 @@ EXPORTS
477485
urnet_local_state_get_provide_network_mode
478486
urnet_local_state_get_provide_secret_keys
479487
urnet_local_state_get_route_local
488+
urnet_local_state_get_routing_tier
480489
urnet_local_state_get_vpn_interface_while_offline
481490
urnet_local_state_logout
482491
urnet_local_state_parse_by_jwt
@@ -500,6 +509,7 @@ EXPORTS
500509
urnet_local_state_set_provide_network_mode
501510
urnet_local_state_set_provide_secret_keys
502511
urnet_local_state_set_route_local
512+
urnet_local_state_set_routing_tier
503513
urnet_local_state_set_vpn_interface_while_offline
504514
urnet_locations_view_controller_add_filtered_locations_listener
505515
urnet_locations_view_controller_close

cgo/include/urnetwork_sdk.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ bool urnet_device_get_public_identity_key(uint64_t self, uint8_t* out, int32_t*
113113
#define URNET_PURCHASE_REPORT_STATUS_INVALID "invalid"
114114
#define URNET_PURCHASE_REPORT_STATUS_PENDING "pending"
115115
#define URNET_PURCHASE_REPORT_STATUS_WRONG_NETWORK "wrong_network"
116+
#define URNET_ROUTING_TIER_FULL 2
117+
#define URNET_ROUTING_TIER_LIGHT 1
118+
#define URNET_ROUTING_TIER_OFF 0
116119
#define URNET_SOL "SOL"
117120
#define URNET_SOLANA_PAY_REFERENCE_BYTES 32
118121
#define URNET_STRIPE_ITEM_DATA10_TIB "data_10tib"
@@ -798,6 +801,7 @@ void urnet_device_local_set_flow_owner_lookup(uint64_t self, urnet_flow_owner_lo
798801
void urnet_device_local_set_key_material(uint64_t self, uint64_t key_material);
799802
void urnet_device_local_set_performance_degraded(uint64_t self, bool degraded);
800803
void urnet_device_local_set_reliability_settings(uint64_t self, const char* reliability_settings_json);
804+
void urnet_device_local_set_routing_tier(uint64_t self, int64_t tier);
801805
bool urnet_device_local_set_rpc_server(uint64_t self, const char* server_pem, const char* client_cert_pem, const char* host_port, char** out_error);
802806
void urnet_device_local_set_tunnel_dns_setting(uint64_t self, const char* setting_json);
803807
void urnet_device_local_shuffle_exits(uint64_t self);
@@ -827,8 +831,10 @@ void urnet_device_remote_close_locations_view_controller(uint64_t self, uint64_t
827831
void urnet_device_remote_close_peer_view_controller(uint64_t self, uint64_t vc);
828832
void urnet_device_remote_close_post_quantum_identity_view_controller(uint64_t self, uint64_t vc);
829833
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);
830835
char* urnet_device_remote_get_destination_exits(uint64_t self);
831836
char* urnet_device_remote_get_exits(uint64_t self);
837+
char* urnet_device_remote_get_probe_results(uint64_t self);
832838
char* urnet_device_remote_get_reliability_metrics(uint64_t self);
833839
char* urnet_device_remote_get_reliability_settings(uint64_t self);
834840
bool urnet_device_remote_get_remote_connected(uint64_t self);
@@ -853,11 +859,16 @@ uint64_t urnet_device_remote_open_referral_code_view_controller(uint64_t self);
853859
uint64_t urnet_device_remote_open_subscription_balance_view_controller(uint64_t self);
854860
uint64_t urnet_device_remote_open_wallet_view_controller(uint64_t self);
855861
void urnet_device_remote_probe_all_exits(uint64_t self);
862+
bool urnet_device_remote_probe_suite_running(uint64_t self);
856863
void urnet_device_remote_reset_reliability_metrics(uint64_t self);
857864
void urnet_device_remote_reset_reliability_settings(uint64_t self);
858865
void urnet_device_remote_set_reliability_settings(uint64_t self, const char* reliability_settings_json);
859866
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);
860868
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);
861872
void urnet_device_remote_sync(uint64_t self);
862873

863874
/* ----- DeviceRpcKeyMaterial ----- */
@@ -917,6 +928,7 @@ int64_t urnet_local_state_get_provide_mode(uint64_t self);
917928
char* urnet_local_state_get_provide_network_mode(uint64_t self);
918929
char* urnet_local_state_get_provide_secret_keys(uint64_t self);
919930
bool urnet_local_state_get_route_local(uint64_t self);
931+
int64_t urnet_local_state_get_routing_tier(uint64_t self);
920932
bool urnet_local_state_get_vpn_interface_while_offline(uint64_t self);
921933
bool urnet_local_state_logout(uint64_t self, char** out_error);
922934
char* urnet_local_state_parse_by_jwt(uint64_t self, char** out_error);
@@ -940,6 +952,7 @@ bool urnet_local_state_set_provide_mode(uint64_t self, int64_t provide_mode, cha
940952
bool urnet_local_state_set_provide_network_mode(uint64_t self, const char* provide_network_mode, char** out_error);
941953
bool urnet_local_state_set_provide_secret_keys(uint64_t self, const char* provide_secret_key_list_json, char** out_error);
942954
bool urnet_local_state_set_route_local(uint64_t self, bool route_local, char** out_error);
955+
bool urnet_local_state_set_routing_tier(uint64_t self, int64_t tier, char** out_error);
943956
bool urnet_local_state_set_vpn_interface_while_offline(uint64_t self, bool vpn_interface_while_offline, char** out_error);
944957

945958
/* ----- LocationsViewController ----- */
@@ -2568,6 +2581,11 @@ uint64_t urnet_new_io_loop(uint64_t device_local, int64_t fd, urnet_io_loop_done
25682581
* SchedulerPauseRecoveryTimeoutMillis: number
25692582
* BlackholeConnectComparativeTimeoutMillis: number
25702583
* HeartbeatIntervalMillis: number
2584+
* ScoredPlacement: boolean
2585+
* PlacementHysteresisPct: number
2586+
* PlacementDemoteConsecutive: number
2587+
* RewardInstrumentation: boolean
2588+
* QuarantineDampening: boolean
25712589
*/
25722590

25732591
/* ReliabilityWindow (json):

0 commit comments

Comments
 (0)