services

package
v0.5.10 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveFile

type ActiveFile struct {
	Dto   model.FileDto
	Token string
}

ActiveFile represents a file in an active session.

type ActiveReceiveSession

type ActiveReceiveSession struct {
	SessionID string
	Sender    model.DeviceInfo
	Files     map[string]ActiveFile
	CreatedAt time.Time
	Progress  *cli.MultiProgress
}

ActiveReceiveSession represents an active file receiving session.

type ActiveSendSession

type ActiveSendSession struct {
	SessionID string
	Files     map[string]model.FileDto
	FilePaths map[string]string // Maps fileID to local absolute path
}

ActiveSendSession represents an active file sending session.

type ReceiveService

type ReceiveService struct {
	// contains filtered or unexported fields
}

ReceiveService manages file receiving sessions.

func NewReceiveService

func NewReceiveService() *ReceiveService

NewReceiveService creates a new ReceiveService.

func (*ReceiveService) CloseSession

func (s *ReceiveService) CloseSession(sessionID string)

CloseSession closes a specific session.

func (*ReceiveService) CreateSession

func (s *ReceiveService) CreateSession(sender model.DeviceInfo, files map[string]model.FileDto) (*ActiveReceiveSession, error)

CreateSession creates a new receive session.

func (*ReceiveService) GetSession

func (s *ReceiveService) GetSession() *ActiveReceiveSession

GetSession returns a legacy session if one exists (for backward compatibility). This is mostly deprecated and GetSessionByID should be used instead. Returns the first active session found or nil.

func (*ReceiveService) GetSessionByID

func (s *ReceiveService) GetSessionByID(sessionID string) *ActiveReceiveSession

GetSessionByID returns the session if the ID matches. Returns a shallow copy of the session to prevent map data races during read.

func (*ReceiveService) RemoveFileFromSession

func (s *ReceiveService) RemoveFileFromSession(sessionID, fileID string)

RemoveFileFromSession removes a file from the current session.

type RegistryService added in v0.2.0

type RegistryService struct {
	// contains filtered or unexported fields
}

RegistryService manages a list of known peer devices.

func NewRegistryService added in v0.2.0

func NewRegistryService() *RegistryService

NewRegistryService creates a new RegistryService.

func (*RegistryService) CleanupStaleDevices added in v0.2.0

func (s *RegistryService) CleanupStaleDevices(staleThreshold time.Duration)

CleanupStaleDevices removes devices that haven't been seen recently.

func (*RegistryService) GetDevices added in v0.2.0

func (s *RegistryService) GetDevices() []*model.Device

GetDevices returns a list of all registered devices.

func (*RegistryService) RegisterDevice added in v0.2.0

func (s *RegistryService) RegisterDevice(device *model.Device)

RegisterDevice adds or updates a device in the registry.

type SendService

type SendService struct {
	// contains filtered or unexported fields
}

SendService manages file sending sessions.

func NewSendService

func NewSendService() *SendService

NewSendService creates a new SendService.

func (*SendService) CloseSession

func (s *SendService) CloseSession()

CloseSession closes the current session.

func (*SendService) CreateSession

func (s *SendService) CreateSession(files map[string]model.FileDto, filePaths map[string]string) (*ActiveSendSession, error)

CreateSession creates a new send session.

func (*SendService) GetSession

func (s *SendService) GetSession() *ActiveSendSession

GetSession returns the current active session. Returns a shallow copy to prevent map races

func (*SendService) GetSessionByID

func (s *SendService) GetSessionByID(sessionID string) *ActiveSendSession

GetSessionByID returns the session if the ID matches. Returns a shallow copy to prevent map races

Jump to

Keyboard shortcuts

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