Documentation
¶
Index ¶
- func EnsureUnique(dir, name string) (string, error)
- func ReceiveSideChannel(ctx context.Context, ip net.IP, port int, size int64, dest string, ...) error
- func SanitizeFilename(name string) string
- func SendSideChannel(ctx context.Context, filePath string, tlsConfig *tls.Config, ...) (int, error)
- type ShareBody
- type SharePlugin
- func (p *SharePlugin) Handle(ctx context.Context, dev device.Sender, pkt *protocol.Packet) error
- func (p *SharePlugin) IncomingTypes() []string
- func (p *SharePlugin) Name() string
- func (p *SharePlugin) OnConnect(dev device.Sender)
- func (p *SharePlugin) OnDisconnect(dev device.Sender)
- func (p *SharePlugin) OutgoingTypes() []string
- func (p *SharePlugin) SendFile(ctx context.Context, dev device.Sender, filePath string) error
- func (p *SharePlugin) Timeout() time.Duration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureUnique ¶
EnsureUnique finds a non-conflicting filename in the destination directory.
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
ReceiveSideChannel connects to the peer's TLS port and streams the payload to a local file. It ensures no memory is buffered by using io.Copy with an io.LimitReader. KDE Connect requires TLS for file transfers using the same certificates as the main connection.
func SanitizeFilename ¶
SanitizeFilename strips path components and prevents traversal.
func SendSideChannel ¶
func SendSideChannel(ctx context.Context, filePath string, tlsConfig *tls.Config, expectedDeviceID string, onProgress func(int64, int64), logger *zap.Logger) (int, error)
SendSideChannel starts a TLS listener on a random port and streams a file to the first connecting peer. KDE Connect requires TLS for file transfers using the same certificates as the main connection.
Types ¶
type ShareBody ¶
type ShareBody struct {
}
ShareBody represents the body of a kdeconnect.share.request packet.
type SharePlugin ¶
type SharePlugin struct {
// contains filtered or unexported fields
}
SharePlugin handles file transfers.
func NewSharePlugin ¶
func NewSharePlugin(downloadDir string, tlsConfig *tls.Config, bus *events.Bus, logger *zap.Logger) *SharePlugin
NewSharePlugin creates a new SharePlugin instance.
func (*SharePlugin) Handle ¶
Handle processes incoming share requests by initiating a side-channel transfer.
func (*SharePlugin) IncomingTypes ¶
func (p *SharePlugin) IncomingTypes() []string
IncomingTypes returns the packet types this plugin handles.
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
OutgoingTypes returns the packet types this plugin may send.
func (*SharePlugin) Timeout ¶
func (p *SharePlugin) Timeout() time.Duration