The application, written in Rust, consists of a server to which multiple clients (vehicles) can connect. Each client simulates a moving vehicle along geographical coordinates, periodically sending its telemetry data to the server (every 30 seconds by default). The server collects this data and provides tools to calculate detailed statistics on the routes taken.
The repository is primarily organized into the following directories:
docs/: contains technical documentation and user manuals for both client and server.src/: contains all Rust source files for the project.
To compile and run the project, you need the Rust toolchain installed, which includes Cargo.
To install the application, clone the repository and compile in release mode:
git clone <repository_url>
cd georust
cargo build --releaseThe application consists of two separate binaries: server and client.
Always start the server before any clients:
cargo run --bin server --release -- [--with-init]To start a single client:
cargo run --bin client --release -- [OPTIONS]By default, the client looks for its settings in the ./config/client_config.json file. However, any parameter can be overridden via command-line arguments. This is particularly useful, for example, when launching multiple vehicles simultaneously without modifying the configuration file.
Available Options:
--config <PATH>: Specifies a custom path for the JSON configuration file.--client-username <NAME>: Overrides the username for login/registration.--client-password <PASSWORD>: Overrides the password.--server-url <URL>: Overrides the server address (e.g.,ws://127.0.0.1:9001).--tick-interval-millis <MS>: Changes the interval (in milliseconds) at which each GPS point is sent.
- Start the server: Run the server startup command in a terminal.
- Start a client: Run the client startup command in another terminal. The client will connect to the server and start sending its GPS coordinates automatically.
- Client Interaction:
- Type the
STOPcommand in the client terminal to pause sending coordinates.
- Type the
- Server Interaction: From the server terminal, you can interact by typing:
statistics <vehicle_id> [DAY|WEEK|MONTH]: calculates distance traveled, average speed for the specified vehicle, total pause duration, and trip duration.send <user_id> <message>: sends a text message to a specific vehicle.broadcast <message>: sends a message to all currently connected vehicles.
A dedicated bash script is available to quickly launch a complete test environment with the server and multiple clients.
Important
Before using the demo script, switch to the specific demo branch:
git checkout demoThe ./demo.sh script provides the following commands:
- Compilation: Explicitly compiles the binaries in release mode.
./demo.sh compile
- Start: Launches (compiling if necessary) the server and
Nspecified clients. Clients simulate movement by reading predefined routes from the./data/folder. The update frequency can be adjusted (default is 30000ms)../demo.sh start <N> [TICK_INTERVAL_MILLIS]
Warning
Currently, a maximum of 10 valid clients can be started, as ./data/ contains coordinates for only 10 routes.
- Cleanup: Safely stops and cleans up all client processes started by the demo. This step is also triggered automatically when pressing
CTRL+Cduring startup, which also terminates the server../demo.sh cleanup
For full manuals with detailed explanations of all configuration parameters, CLI commands, and architectural design choices, please refer to the documents in the docs/ folder.