libdrop

package
v0.0.0-...-4b094ef Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package libdrop wraps libdrop fileshare implementation.

Index

Constants

This section is empty.

Variables

View Source
var ErrLAddressAlreadyInUse = errors.New("address already in use")

Functions

This section is empty.

Types

type Fileshare

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

Fileshare is the main functional filesharing implementation using norddrop library. Thread safe.

func New

func New(
	eventCb fileshare.EventCallback,
	eventsDbPath string,
	isProd bool,
	pubkeyFunc func(string) []byte,
	privKey string,
	storagePath string,
) (*Fileshare, error)

New initializes norddrop library.

func (*Fileshare) Accept

func (f *Fileshare) Accept(transferID, dstPath string, fileID string) error

Accept starts downloading provided files into dstPath. dstPath must be absolute.

func (*Fileshare) CancelFile

func (f *Fileshare) CancelFile(transferID string, fileID string) error

CancelFile id in a transfer

func (*Fileshare) Disable

func (f *Fileshare) Disable() error

Disable executes Stop in norddrop library. Other Fileshare methods can't be called until after Enable is called again.

func (*Fileshare) Enable

func (f *Fileshare) Enable(listenAddr netip.Addr) (err error)

Enable executes Start in norddrop library. Has to be called before using other Fileshare methods.

func (*Fileshare) Finalize

func (f *Fileshare) Finalize(transferID string) error

Finalize file transfer.

func (*Fileshare) Load

func (f *Fileshare) Load() (map[string]*pb.Transfer, error)

Load transfers from fileshare implementation storage

func (*Fileshare) PurgeTransfersUntil

func (f *Fileshare) PurgeTransfersUntil(until time.Time) error

PurgeTransfersUntil provided time from fileshare implementation storage

func (*Fileshare) Send

func (f *Fileshare) Send(peer netip.Addr, paths []string) (string, error)

Send file or dir to peer. Path must be absolute. Returns transfer ID.

Jump to

Keyboard shortcuts

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