share

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcceptAndSend added in v1.10.0

func AcceptAndSend(ln net.Listener, filePath string, tlsConfig *tls.Config, expectedDeviceID string, timeout time.Duration, onProgress func(int64, int64), logger *zap.Logger) error

AcceptAndSend waits for the phone to connect, performs the TLS handshake, and streams the file.

func EnsureUnique

func EnsureUnique(dir, name string) (string, error)

EnsureUnique finds a non-conflicting filename in the destination directory.

func ListenSideChannel added in v1.10.0

func ListenSideChannel(ctx context.Context, cfg config.ShareConfig, tlsConfig *tls.Config) (net.Listener, int, error)

ListenSideChannel binds to an available TCP port in the KDE Connect side-channel range.

func ReceiveSideChannel

func ReceiveSideChannel(ctx context.Context, ip net.IP, port int, size int64, dest string, tlsConfig *tls.Config, onProgress func(int64, int64), logger *zap.Logger) error

func SanitizeFilename

func SanitizeFilename(name string) string

SanitizeFilename strips path components and prevents traversal.

Types

type ShareBody

type ShareBody struct {
	Filename         string `json:"filename"`
	NumberOfFiles    int    `json:"numberOfFiles,omitempty"`
	TotalPayloadSize int64  `json:"totalPayloadSize,omitempty"`
	LastModified     int64  `json:"lastModified,omitempty"`
	CreationTime     int64  `json:"creationTime,omitempty"`
	Text             string `json:"text,omitempty"`
	Url              string `json:"url,omitempty"`
}

ShareBody includes the missing Android metadata (LastModified/CreationTime)

type SharePlugin

type SharePlugin struct {
	DownloadDir string

	TLSConfig *tls.Config
	Logger    *zap.Logger
	// contains filtered or unexported fields
}

func NewSharePlugin

func NewSharePlugin(downloadDir string, cfg config.ShareConfig, tlsConfig *tls.Config, bus *events.Bus, logger *zap.Logger) *SharePlugin

func (*SharePlugin) Handle

func (p *SharePlugin) Handle(ctx context.Context, dev device.Sender, pkt *protocol.Packet) error

func (*SharePlugin) IncomingTypes

func (p *SharePlugin) IncomingTypes() []string

func (*SharePlugin) Name

func (p *SharePlugin) Name() string

func (*SharePlugin) OnConnect

func (p *SharePlugin) OnConnect(dev device.Sender)

func (*SharePlugin) OnDisconnect

func (p *SharePlugin) OnDisconnect(dev device.Sender)

func (*SharePlugin) OutgoingTypes

func (p *SharePlugin) OutgoingTypes() []string

func (*SharePlugin) SendFile

func (p *SharePlugin) SendFile(ctx context.Context, dev device.Sender, filePath string) error

func (*SharePlugin) Timeout

func (p *SharePlugin) Timeout() time.Duration

Jump to

Keyboard shortcuts

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