GoXfer is a command-line tool written in Go for securely transferring files using various protocols such as SFTP, with support for parallel transfers, checksum verification, retries, and SSH key authentication.
- Parallel File Transfers: Speed up large transfers with concurrent file transfers.
- Checksum Verification: Ensure file integrity after transfer using SHA256 checksum comparison.
- Retry Mechanism: Automatically retry transfers in case of checksum mismatches.
- Passphrase-Protected SSH Key Support: Authenticate with SSH private keys that are protected by passphrases.
- Customizable Transfer Options: Configure the number of parallel transfers, retries, and more.
- Go: Make sure you have Go installed. You can install it from here.
git clone https://github.com/JonathanInTheClouds/goxfer.git
cd goxfergo build -o goxfer cmd/main.goThis will create a binary named goxfer in your project directory.
To transfer files using GoXfer, you can use the following command:
./goxfer --protocol=sftp --host=localhost --port=2222 --username=transferuser --key=/path/to/private_key --srcPath=/path/to/local/files --destDir=/remote/destination/path --parallel=5 --retries=3./goxfer --protocol=sftp --host=localhost --port=2222 --username=transferuser --key=/home/jonathan/.ssh/id_rsa --srcPath=./file-transfer-container --destDir=/home/transferuser/file-transfer-container --parallel=5 --retries=3This example transfers the files from the ./file-transfer-container folder to the /home/transferuser/file-transfer-container folder on the remote server using SFTP.
| Option | Description | Default |
|---|---|---|
--protocol |
The protocol to use for file transfer (currently supports sftp). |
sftp |
--host |
The hostname or IP of the remote server. | |
--port |
The port on which to connect to the remote server. | 22 |
--username |
The SSH username to authenticate with. | |
--password |
The SSH password to authenticate with (optional if using SSH key authentication). | |
--key |
The path to your SSH private key file (optional, required if using key-based authentication). | |
--srcPath |
The local file or directory to transfer. | |
--destDir |
The destination directory on the remote server. | |
--parallel |
The number of parallel transfers to run simultaneously. | 5 |
--retries |
The maximum number of retries in case of checksum mismatch. | 3 |
GoXfer automatically verifies file integrity by calculating the SHA256 checksum of both the local and remote files. If the checksums don't match, GoXfer will retry the transfer up to the specified number of retries (default: 3).
You can use a Dockerized SFTP server to test the file transfer functionality. Here’s how to set it up:
In the file-transfer-container folder, run the following commands to build and launch the SFTP server:
docker build -t file-transfer-test .
docker run -p 2222:22 -d file-transfer-test./goxfer --protocol=sftp --host=localhost --port=2222 --username=transferuser --key=/path/to/private_key --srcPath=/path/to/local/files --destDir=/home/transferuser/file-transfer-container --parallel=5 --retries=3This will transfer files to the Docker container acting as the SFTP server.
Contributions are welcome! Feel free to submit pull requests or open issues if you encounter any problems or have suggestions for improvements.
- Fork the repository.
- Create a new branch for your feature/bug fix.
- Submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.