factory

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package factory provides filesystem creation and connection management. It handles instantiation of local and remote (SFTP) filesystems with proper authentication.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultConnector

type DefaultConnector struct{}

DefaultConnector is the production implementation of FileSystemConnector.

func (*DefaultConnector) CreateHostKeyCallback

func (c *DefaultConnector) CreateHostKeyCallback() (sshx.HostKeyCallback, error)

func (*DefaultConnector) NewLocalFS

func (c *DefaultConnector) NewLocalFS() core.FileSystem

func (*DefaultConnector) NewRemoteFS

func (c *DefaultConnector) NewRemoteFS(opts ssh.SSHConfig) (core.FileSystem, error)

func (*DefaultConnector) ReadPassword

func (c *DefaultConnector) ReadPassword() (string, error)

type FileSystemConnector

type FileSystemConnector interface {
	NewLocalFS() core.FileSystem
	NewRemoteFS(opts ssh.SSHConfig) (core.FileSystem, error)
	ReadPassword() (string, error)
	CreateHostKeyCallback() (sshx.HostKeyCallback, error)
}

FileSystemConnector defines the interface for creating file systems.

type RemoteInfo

type RemoteInfo struct {
	Host      string
	User      string
	StartPath string
}

RemoteInfo contains information about a remote connection

func CreateFileSystem

func CreateFileSystem(remoteStr string, args []string) (core.FileSystem, *RemoteInfo, error)

CreateFileSystem instantiates a LocalFS or RemoteFS based on the remote string.

func CreateFileSystemWithConnector

func CreateFileSystemWithConnector(remoteStr string, args []string, conn FileSystemConnector) (core.FileSystem, *RemoteInfo, error)

CreateFileSystemWithConnector allows injecting a custom connector for testing.

Jump to

Keyboard shortcuts

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