A production-ready FTP library for Go providing both client and server implementations with extensive RFC compliance, TLS support, and modern extensions.
- FTP Client → - Full client documentation, API reference, examples
- FTP Server → - Server documentation, custom drivers, deployment
- Examples → - Working code examples for common use cases
- Contributing → - How to contribute to this project
# Client library
go get github.com/gonzalop/ftp
# Server library
go get github.com/gonzalop/ftp/serverpackage main
import (
"log"
"github.com/gonzalop/ftp"
)
func main() {
// Connect to server (handles ftp, ftps, ftp+explicit)
// and automatically logs in (default: anonymous)
client, _ := ftp.Connect("ftp://ftp.example.com")
defer client.Quit()
// Upload file
client.UploadFile("local.txt", "remote.txt")
// Download file
client.DownloadFile("remote.txt", "download.txt")
}→ See full client documentation
package main
import (
"log"
"github.com/gonzalop/ftp/server"
)
func main() {
// Start a standard server on port 21 serving files from /var/ftp
log.Println("FTP server listening on :21")
log.Fatal(server.ListenAndServe(":21", "/var/ftp"))
}→ See full server documentation
- TLS/FTPS - Both explicit (AUTH TLS) and implicit modes
- Bandwidth Limiting - Control upload/download speeds with configurable rate limits
- Automatic Keep-Alive - Prevents timeouts during idle periods or long transfers
- Debug Logging - Structured logging with
log/slogfor easier debugging - Progress Tracking - Built-in callbacks for upload/download progress
- File Operations - Upload, download, append, store unique (STOU), delete, rename
- Directory Operations - Create, delete, recursive remove, walk directory trees
- Resume Transfers - Resume interrupted downloads/uploads (REST)
- Modern Extensions - MLST/MLSD, SIZE, MDTM, HASH support
- IPv6 Support - Full IPv6 via EPSV/EPRT (RFC 2428)
- Rich Errors - Detailed protocol error context
- Transport-Agnostic - Pluggable dialer interface for alternative transports (QUIC, Unix sockets, etc.). See examples/quic for a working implementation.
→ Full feature list and API reference
- Pluggable Backends - Filesystem, S3, memory, or custom storage
- Bandwidth Limiting - Global and per-user rate limits for transfer control
- Audit Logging - Comprehensive logging for security-relevant operations
- Graceful Shutdown - Stop accepting connections and wait for active transfers
- TLS/FTPS - Explicit and implicit FTPS support
- Virtual Hosting - HOST command for multi-tenant setups (RFC 7151)
- File Hashing - HASH command with SHA-256, SHA-512, MD5, CRC32
- IP-Based Access Control - Authenticate with client IP for security policies
- Secure by Default - Built-in path validation and chroot support
- Extensible - Custom authentication and driver interfaces
- Transport-Agnostic - Pluggable listener factory for alternative transports (QUIC, Unix sockets, etc.). See examples/quic for a working implementation.
- Command Control - Disable specific commands (i.e.,for security or transport compatibility)
Both client and server implement modern FTP standards:
- RFC 959 - File Transfer Protocol (base)
- RFC 2389 - Feature Negotiation (FEAT)
- RFC 2428 - IPv6 and NAT Extensions (EPSV/EPRT)
- RFC 3659 - Extensions (MLST/MLSD, SIZE, MDTM, REST)
- RFC 4217 - Securing FTP with TLS
- RFC 5797 - FTP Command Registry
- RFC 7151 - File Transfer Protocol HOST Command
Detailed compliance matrices:
- Client Documentation - Complete API reference, examples, TLS setup
- Server Documentation - Server setup, custom drivers, authentication
- Security Best Practices - TLS configuration, authentication, access control
- Performance Guide - Tuning, optimization, benchmarking
- Alternative Transports Guide - QUIC, Unix sockets, custom transports
- Examples Directory - Working code examples
- Client API (GoDoc) - Client API documentation
- Server API (GoDoc) - Server API documentation
This software is available under 2 licenses -- choose whichever you prefer:
- MIT License
- Public Domain (Unlicense)
See LICENSE for details.
Contributions welcome! See CONTRIBUTING.md for guidelines.