utils

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hashsec

func Hashsec(url string) string

Types

type SMBClient

type SMBClient struct {
	Connection net.Conn
	Session    *smb2.Session
}

SMBClient defines the structure for SMB operations

func LoadSMBFromViper

func LoadSMBFromViper(env string) (*SMBClient, error)

func NewSMBClient

func NewSMBClient(config SMBConfig) (*SMBClient, error)

NewSMBClient creates and returns a new SMBClient

func (*SMBClient) Close

func (c *SMBClient) Close()

Close cleans up the SMB session and share

func (*SMBClient) DeleteFile

func (c *SMBClient) DeleteFile(remotePath string) error

DeleteFile deletes a file from the SMB share

func (*SMBClient) DownloadFile

func (c *SMBClient) DownloadFile(remotePath, localPath string) error

DownloadFile downloads a file from the SMB share

func (*SMBClient) ListFiles

func (c *SMBClient) ListFiles(remoteDir string) ([]string, error)

ListFiles lists files in a remote directory

func (*SMBClient) ReadBinaryFile

func (c *SMBClient) ReadBinaryFile(remotePath string) ([]byte, error)

func (*SMBClient) ReadFile

func (c *SMBClient) ReadFile(remotePath string) (string, error)

func (*SMBClient) UploadFile

func (c *SMBClient) UploadFile(localPath, remotePath string) error

UploadFile uploads a file to the SMB share

func (*SMBClient) WriteBinaryFile

func (c *SMBClient) WriteBinaryFile(remotePath string, content []byte) error

func (*SMBClient) WriteFile

func (c *SMBClient) WriteFile(remotePath, content string) error

type SMBConfig

type SMBConfig struct {
	Address  string // e.g., "192.168.1.10"
	Port     int    // default is 445
	Username string
	Password string
	Domain   string // optional, use "" for most cases
	Share    string // e.g., "SharedFolder"
}

SMBConfig holds the configuration for SMB connection

Jump to

Keyboard shortcuts

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