FMP is a lightweight data transmission protocol designed for secure, efficient, and decentralized communication. It fragments data into dynamically sized pieces, encrypts them with robust cryptographic algorithms, and routes them through optimized multi-path channels. The protocol ensures low latency, robust tamper resistance, and scalability, making it ideal for applications requiring cutting-edge security and performance.
- Data Fragmentation: Splits data into manageable fragments with metadata for reassembly.
- Encryption: Secures each fragment using authenticated encryption (AES-GCM) with unique nonces.
- Adaptive Multi-Path Routing: Routes fragments through dynamically scored paths for optimal delivery.
- Reassembly: Collects and reassembles fragments securely at the destination.
- Error Handling: Validates fragment integrity and handles missing fragments with high reliability.
- Logging: Provides detailed logs for monitoring and debugging.
- Scalability: Efficiently handles large data payloads and high-throughput scenarios.
- Python 3.7 or higher: Ensure Python is installed. You can download it from python.org.
- pip: Python package installer. It usually comes with Python. Verify by running
pip --version
.
-
Clone the Repository:
git clone https://github.com/yourusername/fmp.git cd fmp
-
Create a Virtual Environment:
python3 -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install Dependencies:
pip install --upgrade pip pip install -r requirements.txt
-
Start the Receiver:
On the destination machine or terminal, run the receiver script:
python scripts/receiver.py
-
Send Data from Sender:
On the source machine or another terminal, run the sender script:
python scripts/sender.py
Example Code:
from fmp.protocol import FMPProtocol # Define available paths (IP, port) paths = [('localhost', 8001), ('localhost', 8002)] # Initialize protocol protocol = FMPProtocol(fragment_size=1024, paths=paths) # Data to send data = b"Your data here..." # Send data protocol.send_data(data)
Receiver Script Example (scripts/receiver.py
):
from fmp.protocol import FMPProtocol
# Define available paths (IP, port)
paths = [] # Not used for receiving
# Initialize protocol
protocol = FMPProtocol(fragment_size=1024, paths=paths)
# Function to handle incoming fragments (to be integrated with actual network code)
def handle_incoming_fragment(encrypted_fragment):
data = protocol.receive_data([encrypted_fragment])
if data:
print("Received Data:", data)
# Note: Integrate this with actual network listening code.
FMP/
├── fmp/
│ ├── __init__.py
│ ├── core.py # Unified fragmentation, encryption, and reassembly
│ ├── routing.py # Adaptive routing and path scoring
│ └── protocol.py # Main protocol logic
├── tests/
│ ├── __init__.py
│ ├── test_core.py
│ ├── test_protocol.py
│ └── test_routing.py
├── benchmarks/
│ ├── benchmark_latency.py
│ └── benchmark_throughput.py
├── scripts/
│ ├── sender.py # Example sender script
│ └── receiver.py # Example receiver script
├── README.md
├── requirements.txt
├── setup.py
├── LICENSE
└── .gitignore
Run unit tests using unittest
:
python -m unittest discover tests
Measure fragmentation and encryption latency:
python benchmarks/benchmark_latency.py
Measure data throughput:
python benchmarks/benchmark_throughput.py
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b feature/YourFeature
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin feature/YourFeature
- Open a pull request.
Please ensure your code follows the project's coding standards and includes relevant tests.
This project is licensed under the MIT License.