Documentation
¶
Overview ¶
Package ftp 实现 FTP 文件服务:多用户、每个用户映射到独立目录,可设为只读,支持 FTPS 与被动端口范围。
Index ¶
- Constants
- type CertSource
- type Module
- func (m *Module) ID() string
- func (m *Module) ImportLucky(doc luckyimport.Document, opts luckyimport.Options) (*luckyimport.Report, error)
- func (m *Module) Init(env module.Env) error
- func (m *Module) Routes(r module.Router)
- func (m *Module) Start(context.Context) error
- func (m *Module) Stop() error
- func (m *Module) Title() string
- type Settings
- type User
Constants ¶
const ( TLSOptional = 0 // 明文与 FTPS 均可 TLSMandatory = 1 // 必须先 AUTH TLS(显式 FTPS) TLSImplicit = 2 // 隐式 FTPS,连接即加密 )
TLS 模式,与 Lucky 的 TLSRequired 取值一致。
const ID = "ftp"
ID 是模块标识。
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CertSource ¶
type CertSource interface {
GetCertificate(*tls.ClientHelloInfo) (*tls.Certificate, error)
}
CertSource 提供 FTPS 证书。
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module 是 FTP 模块。
func (*Module) ImportLucky ¶
func (m *Module) ImportLucky(doc luckyimport.Document, opts luckyimport.Options) (*luckyimport.Report, error)
ImportLucky 实现 luckyimport.Importer,迁移监听与被动端口等服务参数(导入后保持停用)。 Lucky 配置中的用户列表结构未在样本中确认,不做猜测性导入,需在界面中重新添加用户。
type Settings ¶
type Settings struct {
Enable bool `json:"enable"`
ListenIP string `json:"listenIp"`
Port int `json:"port"`
// PassiveStart/PassiveEnd 为被动模式数据端口范围,均为 0 时由系统随机分配
PassiveStart int `json:"passiveStart"`
PassiveEnd int `json:"passiveEnd"`
// PublicHost 为被动模式对外通告的 IP(位于 NAT 之后时填写公网或转发后的 IP),留空自动取连接地址
PublicHost string `json:"publicHost"`
// TLSMode 取 TLSOptional / TLSMandatory / TLSImplicit,非 0 时证书由证书模块按 SNI 提供
TLSMode int `json:"tlsMode"`
// IdleTimeout 控制连接空闲多少秒后断开,ConnectionTimeout 为建立数据连接的超时秒数
IdleTimeout int `json:"idleTimeout"`
ConnectionTimeout int `json:"connectionTimeout"`
DisableActiveMode bool `json:"disableActiveMode"`
Users []User `json:"users"`
}
Settings 是模块配置。