ftpd

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ftpd is the small FTP server cameras upload their clips to. It implements what a camera's FTP client uses -- login, directories, passive and active data connections, STOR -- and keeps every login inside its own folder. It accepts uploads and lists what it holds; it serves no downloads.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FreeBytes

func FreeBytes(dir string) (int64, bool)

FreeBytes is the space left on dir's disk, for a page to show.

Types

type Config

type Config struct {
	// Listen is the control address, e.g. ":2121".
	Listen string
	// Root holds one folder per login.
	Root string
	// PassiveMin and PassiveMax bound the data ports offered for PASV.
	PassiveMin, PassiveMax int
	// PublicHost is the address told to clients for passive data; empty
	// uses the address the client reached the control connection on.
	PublicHost string
	// Auth checks a login and returns the folder name for it.
	Auth func(user, pass string) (folder string, ok bool)
	// MaxFile caps one upload; 0 means 4 GiB.
	MaxFile int64
	// Stored is told about each file once it is fully received.
	Stored func(folder, file string, size int64)
	// MinFree refuses uploads while Root's disk has less than this many
	// bytes free; 0 is no limit. Full is told when one is refused.
	MinFree int64
	Full    func(free int64)
}

Config is how the server listens and where files go.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is a running FTP server.

func Start

func Start(ctx context.Context, cfg Config) (*Server, error)

Start listens and serves until ctx ends.

func (*Server) Addr

func (s *Server) Addr() net.Addr

Addr is the control listener's address.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL