libdrop

package
v0.0.0-...-851e5e8 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: GPL-3.0 Imports: 11 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(
	eventFunc func(string),
	eventsDbPath string,
	appVersion string,
	isProd bool,
	pubkeyFunc func(string) []byte,
	privKey string,
	storagePath string,
) *Fileshare

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) Cancel

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

Cancel file transfer.

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) GetTransfersSince

func (f *Fileshare) GetTransfersSince(t time.Time) ([]fileshare.LibdropTransfer, error)

GetTransfersSince provided time 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