Documentation
¶
Index ¶
- func GetRemoteHostnameSRVSVC(session *smb2.Session, host string) (string, error)
- func NetbiosNameFromNBNS(ip string) (string, error)
- type Chunk
- type ChunkConfig
- type ChunkProcessor
- type Config
- type ConnectionPool
- type Operation
- type PoolConfig
- type SMBConfig
- type SMBConnection
- func (c *SMBConnection) Connect() error
- func (c *SMBConnection) CopyFile(share *smb2.Share, remotePath, localPath string) (int64, error)
- func (c *SMBConnection) Disconnect()
- func (c *SMBConnection) IsShareReadable(shareName string) (bool, error)
- func (c *SMBConnection) ListShares() ([]string, error)
- func (c *SMBConnection) MountShare(shareName string) (*smb2.Share, error)
- type ThrottleConfig
- type Throttler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRemoteHostnameSRVSVC ¶
GetRemoteHostnameSRVSVC faz uma chamada NetServerGetInfo via SRVSVC para obter o NetBIOS name real do host
func NetbiosNameFromNBNS ¶
NetbiosNameFromNBNS tenta obter o NetBIOS name de um host via NBNS (porta 137 UDP)
Types ¶
type ChunkConfig ¶
type ChunkConfig struct {
ChunkSize int64 // Size of each chunk in bytes
MaxChunks int // Maximum number of chunks processed simultaneously
UseMMap bool // Use memory-mapped files for reading
BufferSize int // Buffer size for non-mmap operations
}
ChunkConfig configures the chunking behavior
func DefaultChunkConfig ¶
func DefaultChunkConfig() *ChunkConfig
DefaultChunkConfig returns a default configuration for chunking
type ChunkProcessor ¶
type ChunkProcessor struct {
// contains filtered or unexported fields
}
ChunkProcessor manages the processing of file chunks
func NewChunkProcessor ¶
func NewChunkProcessor(config *Config, processor func([]byte) error) *ChunkProcessor
NewChunkProcessor creates a new chunk processor
func (*ChunkProcessor) ProcessFile ¶
func (p *ChunkProcessor) ProcessFile(file *os.File) error
ProcessFile processes a file in chunks
type ConnectionPool ¶
type ConnectionPool struct {
// contains filtered or unexported fields
}
ConnectionPool gerencia um pool de conexões SMB
func NewConnectionPool ¶
func NewConnectionPool(config *PoolConfig) *ConnectionPool
NewConnectionPool cria um novo pool de conexões
func (*ConnectionPool) Close ¶
func (p *ConnectionPool) Close()
Close fecha todas as conexões no pool
func (*ConnectionPool) GetConnection ¶
func (p *ConnectionPool) GetConnection(ctx context.Context, config *SMBConfig) (*SMBConnection, error)
GetConnection obtém uma conexão do pool ou cria uma nova
func (*ConnectionPool) GetShare ¶
func (p *ConnectionPool) GetShare(conn *SMBConnection, shareName string) (*smb2.Share, error)
GetShare obtém um share do pool ou cria um novo
func (*ConnectionPool) ReleaseConnection ¶
func (p *ConnectionPool) ReleaseConnection(config *SMBConfig)
ReleaseConnection libera uma conexão de volta para o pool
type Operation ¶
type Operation struct {
Type string // Tipo da operação (read, write, list)
Data interface{} // Dados da operação
Size int64 // Tamanho estimado da operação
Callback func() error
}
Operation representa uma operação SMB genérica
type PoolConfig ¶
type PoolConfig struct {
MaxConnsPerHost int // Máximo de conexões por host
IdleTimeout time.Duration // Tempo máximo que uma conexão pode ficar ociosa
MaxRetries int // Número máximo de tentativas de reconexão
}
PoolConfig configura o comportamento do pool
func DefaultPoolConfig ¶
func DefaultPoolConfig() *PoolConfig
DefaultPoolConfig retorna uma configuração padrão para o pool
type SMBConfig ¶
type SMBConfig struct {
Host string
Port int
Domain string
Username string
Password string
Timeout time.Duration
// Novos campos para compatibilidade
Dialect uint16 // Dialeto SMB a ser forçado
Signing *bool // Se deve forçar signing obrigatório
// New authentication fields
AuthMethod auth.AuthMethod
NTLMHash string
UseNTLM bool
}
SMBConfig holds the configuration for SMB connections
type SMBConnection ¶
type SMBConnection struct {
Config *SMBConfig
Connection *smb2.Session
IsConnected bool
// contains filtered or unexported fields
}
SMBConnection represents an SMB connection
func NewSMBConnection ¶
func NewSMBConnection(config *SMBConfig) *SMBConnection
NewSMBConnection creates a new SMB connection
func (*SMBConnection) Connect ¶
func (c *SMBConnection) Connect() error
Connect establishes a connection to the SMB server
func (*SMBConnection) Disconnect ¶
func (c *SMBConnection) Disconnect()
Disconnect closes the SMB connection
func (*SMBConnection) IsShareReadable ¶
func (c *SMBConnection) IsShareReadable(shareName string) (bool, error)
IsShareReadable checks if a share is readable
func (*SMBConnection) ListShares ¶
func (c *SMBConnection) ListShares() ([]string, error)
ListShares lists available shares on the SMB server
func (*SMBConnection) MountShare ¶
func (c *SMBConnection) MountShare(shareName string) (*smb2.Share, error)
MountShare mounts a share and returns a file system object
type ThrottleConfig ¶
type ThrottleConfig struct {
MaxBandwidth int64 // Bandwidth limit in bytes per second
MaxConcurrent int // Maximum concurrent operations
BatchSize int // Size of operation batches
BatchTimeout time.Duration // Maximum time to wait for batch completion
}
ThrottleConfig configura o comportamento do throttling
func DefaultThrottleConfig ¶
func DefaultThrottleConfig() *ThrottleConfig
DefaultThrottleConfig retorna uma configuração padrão para throttling
type Throttler ¶
type Throttler struct {
// contains filtered or unexported fields
}
Throttler gerencia o throttling de operações SMB
func NewThrottler ¶
func NewThrottler(config *ThrottleConfig) *Throttler
NewThrottler cria um novo throttler
func (*Throttler) Acquire ¶
func (t *Throttler) Acquire()
Acquire adquire uma vaga no semáforo de operações concorrentes
func (*Throttler) AddOperation ¶
AddOperation adiciona uma operação ao batch
func (*Throttler) ProcessBatch ¶
func (t *Throttler) ProcessBatch()
ProcessBatch processa um lote de operações
func (*Throttler) Release ¶
func (t *Throttler) Release()
Release libera uma vaga no semáforo de operações concorrentes
func (*Throttler) StartBatchProcessor ¶
StartBatchProcessor inicia o processador de batches em background