This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
go build -v ./...- Build all packagesgo run main.go- Run the FTP server locallygo run main.go -conf ftpserver.json- Run with specific config filego run main.go -conf-only- Generate configuration file only
go test -race -v ./...- Run all tests with race detection- Individual test:
go test -v ./fs/utils/
golangci-lint run- Run comprehensive linting (configured via .golangci.yml)go fmt ./...- Format codegoimports -w ./- Fix imports
This is a Go FTP server that acts as a gateway between FTP clients and various cloud storage backends. It's built on top of ftpserverlib and uses the afero filesystem abstraction.
Entry point that handles configuration loading, server instantiation, and graceful shutdown. Supports SIGTERM and SIGHUP (config reload) signals.
config/config.go- Configuration management and user authenticationconfig/confpar/- Configuration parameter definitions- Uses JSON configuration files (default:
ftpserver.json)
Each subdirectory implements a specific storage backend:
fs/afos/- Local OS filesystem (afero wrapper)fs/s3/- Amazon S3 storagefs/gdrive/- Google Drive integrationfs/dropbox/- Dropbox storagefs/gcs/- Google Cloud Storagefs/sftp/- SFTP backendfs/mail/- Email storage backendfs/telegram/- Telegram bot storagefs/keycloak/- Keycloak authentication integrationfs/utils/- Shared filesystem utilitiesfs/stripprefix/- Path manipulation utilitiesfs/fslog/- Filesystem logging wrapper
Contains the main FTP server driver implementation that bridges ftpserverlib with the various filesystem backends.
- JSON-based configuration with schema validation
- Supports multiple user accounts with different backends
- Each user can have different filesystem backends (S3, Dropbox, etc.)
- TLS/SSL support for secure connections
- Configurable passive transfer port ranges
Each filesystem backend in fs/ follows a consistent pattern:
- Implements afero.Fs interface
- Handles backend-specific authentication/configuration
- Maps FTP operations to backend API calls
- Provides error handling and logging
build.gocontains build-time variables (version, date, commit)- Cross-platform builds supported via GitHub Actions
- Docker images available and built automatically
- Limited test coverage (only
fs/utils/env_test.gocurrently) - Integration testing likely done via Docker containers
- GitHub Actions runs tests with race detection
- Comprehensive golangci-lint configuration with 40+ linters enabled
- Strict formatting and import organization rules
- Local package prefix:
github.com/fclairamb/ftpserver/ - Line length limit: 120 characters
- Function length limits: 80 lines/40 statements
- Go 1.24+ required (toolchain 1.25+)
- Key dependencies: ftpserverlib, afero, various cloud SDK packages
- Logging via go-kit/log framework
- Authentication via go-crypt for password hashing