Note: This project is a high-performance, SSL-enabled text search server designed to handle thousands of concurrent TCP client connections. It reads a configuration file that specifies a target text file path (linuxpath), performs full-line search queries for exact matches, and responds with either STRING EXISTS or STRING NOT FOUND. The server supports PSK-based SSL authentication, multithreading for concurrency, and can be deployed as a Linux daemon using systemd or run manually for development and testing.
fastSearch/main_server.py— main server implementation (entry point)fastSearch/config.txt— example configuration (containslinuxpath=,REREAD_ON_QUERY,SSL_ENABLED,PSK_*entries)fastSearch/etc/systemd/system/fastsearch.service— systemd unit file to run server as daemonfastSearch/tests/— pytest tests; for unit testing of exceptions and edge cases
These steps assume you want to install the service on an Ubuntu system (or WSL Ubuntu). The systemd file expects the installation path /opt/fastsearch, but you can choose your preferred path — if you do, update the systemd unit accordingly.
- Install WSL If not Installed already
wsl --installThen reboot
-
Open Ubuntu from your Start Menu
-
Navigate to the project folder
cd /path/to/fastsearch - Run the script
chmod +x install_fastsearch.sh
./install_fastsearch.shSSL-PSK Setup
If you enable ssl_enabled=true in config.txt, the installer automatically:
Generates a random PSK token at /path/to/fastsearch_psk.txt Generates a random PSK Identity at /path/to/fastsearch_psk_identity.txt Injects the PSK token and identity values into config.txt Starts FastSearch with secure TLS-PSK authentication
In the project directory
source .venv/bin/activate
pip install -r requirements.txt
python main_server.py
# or
python main_server.py --daemonize # to run a daemonized server (compatible with Windows systems only)
# To stop the daemonized server
python main_server.py --stopThe server will bind to the configured port and log debug messages to stdout. The logs should also contain DEBUG: markers with query, requesting IP, and timing.
Open a different terminal and run
python client.py <host> <port> "<query>" # for where SSL is False in config
python client.py 127.0.0.1 44445 "searchMe" # Real example command - assuming SSL is FalseIf SSL is enabled in the config, the PSK token and PSK identity must already be set. Update the client script with these values from the server before running:
python client.py <host> <port> "<query>" --true # SSL is True in config
python client.py 127.0.0.1 44445 "searchMe" --true # Real example command - assuming SSL is TrueAuthor: Samuel Adetoyinbo Software Engineer • Algorithmic Sciences