server

package module
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: Apache-2.0 Imports: 16 Imported by: 1 module, 1 package

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.

README

go-ftpserver: An FTP based Fuse implementation written in Go

Unit tests Go Reference Go version

Install

go get -u github.com/telepresenceio/go-ftpserver

Architecture

This is an FTP server build on [github.com/fclairamb/ftpserverlib]https://github.com/fclairamb/ftpserverlib which exposes a file system where all symlinks have been resolved

Documentation

Overview

Package server: confinedFs is an afero.Fs backed by one or more *os.Root values, confining every path -- however it is spelled, however many symlinks it crosses -- to a fixed set of directory trees: basePath (the tree the FTP client sees as its root) and, optionally, one or more resolveRoots. A symlink found anywhere under basePath is followed only when its literal, unresolved target text names basePath or one of resolveRoots (or a path under one of them); any other target -- including one that would otherwise resolve back inside an allowed root by way of ".." segments the kernel would happily walk -- is refused rather than followed. With no resolveRoots, only basePath itself qualifies: confinement then reduces to "nothing outside basePath is ever reachable", which is what os.Root already guarantees on its own.

This mirrors the *os.Root-based confinement in cmd/traffic/cmd/agent/sftpserver/server.go's resolve/resolveLink/underMounts, generalized from a fixed two-root (exports, mounts) layout to an arbitrary basePath plus N resolveRoots, and from a single fixed symlink position (container/top) to a symlink at any depth.

Package server contains an FTP server based on github.com/fclairamb/ftpserverlib

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(ctx context.Context, publicHost string, basePath string, portAnnounceCh chan<- uint16, resolveRoots ...string) error

Start starts an FTP server serving basePath and authenticating any username with any password (the "anonymous" pattern). The port it bound is sent once on portAnnounceCh, which is then closed.

A symlink under basePath is served (rather than refused) when its target is basePath itself, a path under it, or a path under one of resolveRoots; with no resolveRoots, only basePath qualifies. See confinedFs for the full confinement semantics.

func StartOnPort

func StartOnPort(ctx context.Context, publicHost string, basePath string, port uint16, resolveRoots ...string) error

StartOnPort is like Start, but listens on the given port instead of an ephemeral one.

A symlink under basePath is served (rather than refused) when its target is basePath itself, a path under it, or a path under one of resolveRoots; with no resolveRoots, only basePath qualifies. See confinedFs for the full confinement semantics.

func StartOnPortWithValidator added in v1.3.0

func StartOnPortWithValidator(ctx context.Context, publicHost, basePath string, port uint16, validate PasswordValidator, resolveRoots ...string) error

StartOnPortWithValidator is like StartOnPort, but authenticates logins using validate instead of the built-in anonymous user.

func StartWithValidator added in v1.3.0

func StartWithValidator(ctx context.Context, publicHost, basePath string, portAnnounceCh chan<- uint16, validate PasswordValidator, resolveRoots ...string) error

StartWithValidator is like Start, but authenticates logins using validate instead of the built-in anonymous user.

Types

type PasswordValidator added in v1.3.0

type PasswordValidator func(ctx context.Context, user, password string) error

PasswordValidator validates a username/password pair submitted during FTP login. A non-nil error rejects the login.

Jump to

Keyboard shortcuts

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