Feat/unify initializing flow#391
Draft
kp-antonio-yang wants to merge 23 commits intofeat/general-configsfrom
Draft
Feat/unify initializing flow#391kp-antonio-yang wants to merge 23 commits intofeat/general-configsfrom
kp-antonio-yang wants to merge 23 commits intofeat/general-configsfrom
Conversation
|
Code coverage summary for 329e8c1: ✅ Region coverage 69% passes |
0910ae2 to
7de88cf
Compare
6648517 to
3cd816c
Compare
a23994f to
b3a8910
Compare
3cd816c to
68b221e
Compare
b3a8910 to
5e37c4c
Compare
The `twelf` is not under maintenance it introduced legacy `serde_yaml`(0.8.23). The latest version is 0.9.34, but it was deprecated in March 2024. Such that `struct-patch` introduced and decoupled the deseralizer and config patch function. The flexible way to overlay configs will be easy and maintainable.
0701c9f to
330f52d
Compare
The docments of cli are from Patch struct, remove the redundant default values from clap, so we dont need to difference between user inputs and default values, and all the default valuses are unified from Default trait.
On platforms other than macOS, there is no strict naming rule for the tun interface, so lightway is used as the default. On macOS, a simple assertion is added to catch invalid tun names early, rather than silently NOTE.
Introduce `--generate=<ConfigFormat>` option to lightway-client, it will be nice for developers to have a full spec to know the all parameters for integration, and also add a dummy ConfigFormat::JsonSchema with todo! as our next move.
The `.schema.json` is generated from client side cli, such that jsonschema can help on integration. - Add test cases for our customized duration types - Add test cases for ByteSize
Add config mod, which providing sharing Configs for mobile and cli clients, and unify all the config utils for clients. - MobileConfig is a small set of Config with less fields adepted to UniFFI, rename from `mobile::LightwayUserSettings` - MobileConnectionConfig is a small set of ConnectionConfig adepted to UniFFI, renamed from `endpoint::RustEndpointConfig` - Add apply methods for MobileConfig, MobileConnectionConfig to Config, ConnectionConfig - Sharing ConnectionConfig for mobile - Collecting and sharing basic operations(`take_auth`, `load_ca`, ...) of configs for all clients
330f52d to
a0ebedc
Compare
68b221e to
41adf70
Compare
ExptesslaneState and DeviceNetworkState are also part of interfaces. Such that we put state.rs a mod.
Rename the VpnConnection and Logger of mobile library for simple, the Rust prefix is moved
41adf70 to
e3ab218
Compare
Collecting event handling related functions, traits in a module
To unify the config, struct in connecting level, following struct renamed or merge into a mod, and provide a unified method to produce the connecting config, ClientConnectionConfig - Config::into_client_connection_config() -> ClientConnectionConfig - LightwayClientConnectArgs -> crate::ClientConnectionConfig - any fields in ClientConnection move from mobile to crate, and it will be collected in following steps
e3ab218 to
643eea5
Compare
Keep Config.servers private and provid `take_servers` to produce normalized ConnectionConfigs with following process - If ConnectionConfig have no Auth, then copy from Config - If ConnectionConfig have no CA, then copy from Config - Load CA content from file, if it is provied by path
With general ClientConfig, mobile and cli client can follow the same network initialization flow.
To have a unify flow to initialize VPN network, the funcion renamed as the same cli using. `mobile::lightway::async_lightway_start(..)` is moved to `client(ClientConfig, Vec<ClientConnectionConfig>)` with the same function name and function inputs.
To have a unify flow to initialize VPN network, the funcion renamed as the same cli using. `mobile::lightway::lightway_client_connect(..)` is moved to `connect(ClientConfig, ClientConnectionConfig)` with the same function name and function inputs.
mv MobileInsideIo, TunnelState to io::inside, such all the inside implemeation collected in a same place.
To unify the initialization, the plugins are defined by ClientConnectionConfig in mobile and cli clients.
mv OutsideSocket, build functions, task runner functions to io::outside, such that all the outside impl collected in a same place.
Move mobile::LightwayConnection to ClientConnection cfg gate, such that the network initialization of cli and mobile are the same.
Error is also an interface of lib, such that we expose it as a mod. Such that a developer using lightway-client crate will easy to debug and follow by reading the source code.
Because the type checking is working on ClientConnectionConfig, we can use loose type of server_ip field for MobileConnectionConfig
Pass field meta information of json schema to client, such that mobile clients can based on the meta information to show the field really works in mobile client - pass textview for larger String field - pass x-cfg information - add example for durations and socket address fields
By adding a config_content input, the mobile will easy to apply yaml configs as the same as cli client using, such that we can easy to treat all clients in a unify way.
The build and clean command in dev shell will always run on project root.
643eea5 to
fe92673
Compare
7737cc1 to
5294904
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Mobile and CLI clients currently diverge in their state management, configuration structure, and naming conventions. This PR aligns the two, unifying the network initialization flow and establishing a consistent interface across both clients.
Motivation and Context
Following are the context and flow chart.
How Has This Been Tested?
Follow current test cases
Types of changes
Checklist:
main