file-transfer/README.md
2025-02-07 00:24:26 +01:00

2.0 KiB

File Transfer Service

A simple HTTP file transfer service written in Go that allows uploading, downloading, and managing files with optional password protection.

Why

This project was created to address the need for a lightweight, secure file transfer solution that:

  • Stores files in a RAM-Disk for enhanced security and performance
  • Provides simple password protection for sensitive files
  • Runs as a standalone service without complex dependencies
  • Offers a straightforward HTTP API for easy integration

Features

  • Upload files up to 16GB
  • Download files using unique file IDs
  • Password protection for sensitive files
  • File information retrieval
  • Delete uploaded files
  • CORS support

API Endpoints

Upload File - POST /

  • Multipart form data with file field
  • Optional password field for protection
  • Returns JSON with filename and file ID

Download File - GET /

  • Query params: id (required), password (if protected), show-popup (boolean)
  • Returns file as attachment
  • Basic auth support for password protected files

Delete File - DELETE /

  • Query params: id (required), password (if protected), show-popup (boolean)
  • Deletes file and its directory

File Info - GET /info

  • Query params: id (required), password (if protected), show-popup (boolean)
  • Returns JSON with name, age, MIME type, and size

Setup

  1. Requires Go 1.22.5 or later
  2. Install dependencies:
go mod download
  1. Run the server:
go run .

The service runs on port 4545 and stores files in /var/cache/file-transfer.

Future Features

Planned improvements for future releases:

  • Configurable maximum upload file size
  • Custom storage path configuration
  • Configuration file support for easier deployment and customization
  • Configurable password strength requirement
  • Custom CORS options
  • Configurable port

Security Features

  • SHA3-512 password hashing with salt
  • Basic authentication support
  • Temporary file storage in cache directory