MyCloudNest Server is a file management server built using the Fiber framework in Go. It provides features like file upload, download, temporary link generation, and file statistics with robust security and performance configurations.
-
File Management:
- Upload, retrieve, and delete files.
- Organize files into specific directories based on file type.
-
Temporary Links:
- Generate temporary download links for files with expiration.
-
Statistics:
- Track file downloads and last access timestamps.
-
Rate Limiting:
- Control the number of requests using Redis as a storage backend.
-
Caching:
- Cache frequently accessed data with support for memory-based storage.
-
Access Control:
- Restrict access to specific IP addresses using a whitelist middleware.
The server's configuration is loaded from ~/.cloudnest/config.toml. Below are the configurable sections:
[server]
host = "0.0.0.0"
port = 3000[rate_limit]
enabled = true
limit_body = 104857600 # 100MB
max_requests = 100
expire_time = 60[whitelist]
enabled = true
whitelisted_ips = ["127.0.0.1"][perfomance]
perfork = false
concurrency = 65536[cache]
enabled = true- Endpoint:
/api/v1/files - Method:
POST - Description: Uploads a file to the server and organizes it based on its type.
- Endpoint:
/api/v1/files - Method:
GET - Description: Retrieves a list of all files with their metadata.
- Endpoint:
/api/v1/files/:id - Method:
GET - Description: Downloads or displays a file.
- Endpoint:
/api/v1/files/:id - Method:
DELETE - Description: Deletes a file from the server and its metadata.
- Endpoint:
/api/v1/files/:id/temp-link - Method:
POST - Description: Generates a temporary download link for a file.
- Endpoint:
/api/v1/files/download - Method:
GET - Description: Validates and serves a file through a temporary link.
- Endpoint:
/api/v1/files/:id/stats - Method:
GET - Description: Retrieves download statistics for a specific file.
- Restricts access to the application based on IP addresses.
The server uses SQLite for persistent storage. The database is located at ~/.cloudnest/db.sqlite.
files: Stores metadata about files.temporary_links: Stores information about temporary links.file_stats: Tracks file download statistics.
- Ensure the configuration file exists at
~/.cloudnest/config.toml. - Start the server:
go run main.go
- Access the API at
http://<host>:<port>.
This project is licensed under the MIT License.