sftpfsrw

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

README

sftpfsrw

sftpfsrw provides a writefs.FullFS implementation over the SFTP protocol.

Features

  • Secure Transfer: Communicates over SSH to provide secure file access.
  • Full Write Capability: Supports Create, Append, MkDir, Remove, and Rename.
  • Session Management: Manages SFTP sessions for efficient communication.
  • Path Isolation: Paths are relative to a specified base directory on the remote server.

Usage

import (
	"github.com/je4/filesystem/v3/pkg/sftpfsrw"
	"golang.org/x/crypto/ssh"
)

// SSH configuration
sshConfig := &ssh.ClientConfig{
	User: "username",
	Auth: []ssh.AuthMethod{
		ssh.Password("password"),
	},
}

// Initialize SFTP filesystem
fsys, err := sftpfsrw.NewFS(
    "example.com:22", 
    sshConfig, 
    "/remote/data", 
    5, // number of sessions
    false, // readOnly
    logger,
)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFS

func NewFS(addr string, config *ssh.ClientConfig, baseDir string, numSessions uint, readOnly bool, logger zLogger.ZLogger) (*sftpFSRW, error)

func NewSession

func NewSession(conn *ssh.Client, sftpFS *sftpFSRW, i uint, logger zLogger.ZLogger) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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