norddrop

package module
v8.0.0-...-6707875 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: GPL-3.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLibdropErrorAddrInUse = fmt.Errorf("LibdropErrorAddrInUse")
View Source
var ErrLibdropErrorBadInput = fmt.Errorf("LibdropErrorBadInput")
View Source
var ErrLibdropErrorDbError = fmt.Errorf("LibdropErrorDbError")
View Source
var ErrLibdropErrorInstanceStart = fmt.Errorf("LibdropErrorInstanceStart")
View Source
var ErrLibdropErrorInstanceStop = fmt.Errorf("LibdropErrorInstanceStop")
View Source
var ErrLibdropErrorInvalidPrivkey = fmt.Errorf("LibdropErrorInvalidPrivkey")
View Source
var ErrLibdropErrorInvalidString = fmt.Errorf("LibdropErrorInvalidString")
View Source
var ErrLibdropErrorNotStarted = fmt.Errorf("LibdropErrorNotStarted")
View Source
var ErrLibdropErrorTransferCreate = fmt.Errorf("LibdropErrorTransferCreate")
View Source
var ErrLibdropErrorUnknown = fmt.Errorf("LibdropErrorUnknown")

Err* are used for checking error type with `errors.Is`

View Source
var FfiConverterBoolINSTANCE = FfiConverterBool{}
View Source
var FfiConverterBytesINSTANCE = FfiConverterBytes{}
View Source
var FfiConverterCallbackInterfaceEventCallbackINSTANCE = &FfiConverterCallbackInterfaceEventCallback{
	FfiConverterCallbackInterface: FfiConverterCallbackInterface[EventCallback]{
		handleMap: newConcurrentHandleMap[EventCallback](),
	},
}
View Source
var FfiConverterCallbackInterfaceFdResolverINSTANCE = &FfiConverterCallbackInterfaceFdResolver{
	FfiConverterCallbackInterface: FfiConverterCallbackInterface[FdResolver]{
		handleMap: newConcurrentHandleMap[FdResolver](),
	},
}
View Source
var FfiConverterCallbackInterfaceKeyStoreINSTANCE = &FfiConverterCallbackInterfaceKeyStore{
	FfiConverterCallbackInterface: FfiConverterCallbackInterface[KeyStore]{
		handleMap: newConcurrentHandleMap[KeyStore](),
	},
}
View Source
var FfiConverterCallbackInterfaceLoggerINSTANCE = &FfiConverterCallbackInterfaceLogger{
	FfiConverterCallbackInterface: FfiConverterCallbackInterface[Logger]{
		handleMap: newConcurrentHandleMap[Logger](),
	},
}
View Source
var FfiConverterInt32INSTANCE = FfiConverterInt32{}
View Source
var FfiConverterInt64INSTANCE = FfiConverterInt64{}
View Source
var FfiConverterNordDropINSTANCE = FfiConverterNordDrop{}
View Source
var FfiConverterOptionalBytesINSTANCE = FfiConverterOptionalBytes{}
View Source
var FfiConverterOptionalInt32INSTANCE = FfiConverterOptionalInt32{}
View Source
var FfiConverterOptionalStringINSTANCE = FfiConverterOptionalString{}
View Source
var FfiConverterOptionalUint32INSTANCE = FfiConverterOptionalUint32{}
View Source
var FfiConverterOptionalUint64INSTANCE = FfiConverterOptionalUint64{}
View Source
var FfiConverterSequenceStringINSTANCE = FfiConverterSequenceString{}
View Source
var FfiConverterSequenceTypeIncomingPathINSTANCE = FfiConverterSequenceTypeIncomingPath{}
View Source
var FfiConverterSequenceTypeIncomingPathStateINSTANCE = FfiConverterSequenceTypeIncomingPathState{}
View Source
var FfiConverterSequenceTypeOutgoingPathINSTANCE = FfiConverterSequenceTypeOutgoingPath{}
View Source
var FfiConverterSequenceTypeOutgoingPathStateINSTANCE = FfiConverterSequenceTypeOutgoingPathState{}
View Source
var FfiConverterSequenceTypeQueuedFileINSTANCE = FfiConverterSequenceTypeQueuedFile{}
View Source
var FfiConverterSequenceTypeReceivedFileINSTANCE = FfiConverterSequenceTypeReceivedFile{}
View Source
var FfiConverterSequenceTypeTransferDescriptorINSTANCE = FfiConverterSequenceTypeTransferDescriptor{}
View Source
var FfiConverterSequenceTypeTransferInfoINSTANCE = FfiConverterSequenceTypeTransferInfo{}
View Source
var FfiConverterSequenceTypeTransferStateINSTANCE = FfiConverterSequenceTypeTransferState{}
View Source
var FfiConverterStringINSTANCE = FfiConverterString{}
View Source
var FfiConverterTypeConfigINSTANCE = FfiConverterTypeConfig{}
View Source
var FfiConverterTypeEventINSTANCE = FfiConverterTypeEvent{}
View Source
var FfiConverterTypeEventKindINSTANCE = FfiConverterTypeEventKind{}
View Source
var FfiConverterTypeIncomingPathINSTANCE = FfiConverterTypeIncomingPath{}
View Source
var FfiConverterTypeIncomingPathStateINSTANCE = FfiConverterTypeIncomingPathState{}
View Source
var FfiConverterTypeIncomingPathStateKindINSTANCE = FfiConverterTypeIncomingPathStateKind{}
View Source
var FfiConverterTypeLibdropErrorINSTANCE = FfiConverterTypeLibdropError{}
View Source
var FfiConverterTypeLogLevelINSTANCE = FfiConverterTypeLogLevel{}
View Source
var FfiConverterTypeOutgoingFileSourceINSTANCE = FfiConverterTypeOutgoingFileSource{}
View Source
var FfiConverterTypeOutgoingPathINSTANCE = FfiConverterTypeOutgoingPath{}
View Source
var FfiConverterTypeOutgoingPathStateINSTANCE = FfiConverterTypeOutgoingPathState{}
View Source
var FfiConverterTypeOutgoingPathStateKindINSTANCE = FfiConverterTypeOutgoingPathStateKind{}
View Source
var FfiConverterTypeQueuedFileINSTANCE = FfiConverterTypeQueuedFile{}
View Source
var FfiConverterTypeReceivedFileINSTANCE = FfiConverterTypeReceivedFile{}
View Source
var FfiConverterTypeStatusCodeINSTANCE = FfiConverterTypeStatusCode{}
View Source
var FfiConverterTypeStatusINSTANCE = FfiConverterTypeStatus{}
View Source
var FfiConverterTypeTransferDescriptorINSTANCE = FfiConverterTypeTransferDescriptor{}
View Source
var FfiConverterTypeTransferInfoINSTANCE = FfiConverterTypeTransferInfo{}
View Source
var FfiConverterTypeTransferKindINSTANCE = FfiConverterTypeTransferKind{}
View Source
var FfiConverterTypeTransferStateINSTANCE = FfiConverterTypeTransferState{}
View Source
var FfiConverterTypeTransferStateKindINSTANCE = FfiConverterTypeTransferStateKind{}
View Source
var FfiConverterUint32INSTANCE = FfiConverterUint32{}
View Source
var FfiConverterUint64INSTANCE = FfiConverterUint64{}

Functions

func LiftFromRustBuffer

func LiftFromRustBuffer[GoType any](bufReader BufReader[GoType], rbuf RustBufferI) GoType

func Version

func Version() string

Returs the libdrop version

Types

type BufLifter

type BufLifter[GoType any] interface {
	Lift(value RustBufferI) GoType
}

type BufLowerer

type BufLowerer[GoType any] interface {
	Lower(value GoType) RustBuffer
}

type BufReader

type BufReader[GoType any] interface {
	Read(reader io.Reader) GoType
}

type BufWriter

type BufWriter[GoType any] interface {
	Write(writer io.Writer, value GoType)
}

type Config

type Config struct {
	// If the transfer directory tree contains more levels then the error is
	// returned.
	DirDepthLimit uint64
	// When aggregating files from the path, if this limit is reached, an error
	// is returned.
	TransferFileLimit uint64
	// Moose database path
	MooseEventPath string
	// Moose production flag
	MooseProd bool
	// Storage path for persistence engine
	StoragePath string
	// Emit checksum events only if file is equal or greater than this size.
	// If omited, no checksumming events are emited.
	ChecksumEventsSizeThreshold *uint64
	// Emit checksum events at set granularity
	ChecksumEventsGranularity *uint64
	// Limits the number of burst connection retries after the
	// `network_refresh()` call. Setting this to `0` or `1` gives an effect of
	// only one retry after `network_refresh()` call.
	// When set to `n > 1` the retry happens in a burst of `n` times and the
	// interval between burst retries is increased by the power of 2 starting
	// from 1-second interval. For example for `n = 5` the retries happen
	// * 1st burst retry immediately
	// * 2nd burst retry after 1s the previous burst retry
	// * 3rd burst retry after 2s the previous burst retry
	// * 4th burst retry after 4s the previous burst retry
	// * 5th burst retry after 8s the previous burst retry
	// When set to `null` the default of 5 burst retries is used.
	ConnectionRetries *uint32
	// Enable auto retry loop inside libdrop. Conceptually this means that
	// libdrop is calling `network_refresh()` automatically with the given
	// period in milliseconds. When set to `null` the feature is disabled and
	// the application needs to call  `network_refresh()` manually.
	// Note the setting `connection_retries` still applies, meaning the retry
	// is executed in burst with this number of counts.
	// For example for a single retry every 5 seconds the application needs to
	// set `connection_retries` to `1` or `0` and `auto_retry_interval_ms = 5000`.
	AutoRetryIntervalMs *uint32
}

The configuration structure

func (*Config) Destroy

func (r *Config) Destroy()

type Event

type Event struct {
	// Creation timestamp
	Timestamp int64
	// A type of event
	Kind EventKind
}

The event type emited by the library

func (*Event) Destroy

func (r *Event) Destroy()

type EventCallback

type EventCallback interface {

	// Method called whenever event occurs
	OnEvent(event Event)
}

The event callback

type EventKind

type EventKind interface {
	Destroy()
}

Possible types of events

type EventKindFileDownloaded

type EventKindFileDownloaded struct {
	TransferId string
	FileId     string
	FinalPath  string
}

The file has been successfully downloaded.

func (EventKindFileDownloaded) Destroy

func (e EventKindFileDownloaded) Destroy()

type EventKindFileFailed

type EventKindFileFailed struct {
	TransferId string
	FileId     string
	Status     Status
}

File transfer has failed.

func (EventKindFileFailed) Destroy

func (e EventKindFileFailed) Destroy()

type EventKindFilePaused

type EventKindFilePaused struct {
	TransferId string
	FileId     string
}

Emited automatically for each file in flight in case the peer goes offline but the transfer will be resumed.

func (EventKindFilePaused) Destroy

func (e EventKindFilePaused) Destroy()

type EventKindFilePending

type EventKindFilePending struct {
	TransferId string
	FileId     string
	BaseDir    string
}

Indicates that the file transfer is registered and ready. It is emitted as a response to the `download()` call.

func (EventKindFilePending) Destroy

func (e EventKindFilePending) Destroy()

type EventKindFileProgress

type EventKindFileProgress struct {
	TransferId  string
	FileId      string
	Transferred uint64
}

Emitted whenever an amount of data for a single file is transferred between peers. Valid for both sending and receiving peers.

func (EventKindFileProgress) Destroy

func (e EventKindFileProgress) Destroy()

type EventKindFileRejected

type EventKindFileRejected struct {
	TransferId string
	FileId     string
	ByPeer     bool
}

The file was rejected.

func (EventKindFileRejected) Destroy

func (e EventKindFileRejected) Destroy()

type EventKindFileStarted

type EventKindFileStarted struct {
	TransferId  string
	FileId      string
	Transferred uint64
}

Emitted when a file transfer is started. Valid for both sending and receiving peers.

func (EventKindFileStarted) Destroy

func (e EventKindFileStarted) Destroy()

type EventKindFileThrottled

type EventKindFileThrottled struct {
	TransferId  string
	FileId      string
	Transferred uint64
}

The event may be emitted before the outgoing file is started. It’s an indication of a delayed transfer because of too many active outgoing files in flight. Whenever the number of active files decreases the file will proceed with the TransferStarted event. Valid for sending peers.

func (EventKindFileThrottled) Destroy

func (e EventKindFileThrottled) Destroy()

type EventKindFileUploaded

type EventKindFileUploaded struct {
	TransferId string
	FileId     string
}

The file has been successfully uploaded.

func (EventKindFileUploaded) Destroy

func (e EventKindFileUploaded) Destroy()

type EventKindFinalizeChecksumFinished

type EventKindFinalizeChecksumFinished struct {
	TransferId string
	FileId     string
}

Reports finalize checksum finished(downloader side only).

func (EventKindFinalizeChecksumFinished) Destroy

type EventKindFinalizeChecksumProgress

type EventKindFinalizeChecksumProgress struct {
	TransferId       string
	FileId           string
	BytesChecksummed uint64
}

Reports finalize checksumming progress(downloader side only).

func (EventKindFinalizeChecksumProgress) Destroy

type EventKindFinalizeChecksumStarted

type EventKindFinalizeChecksumStarted struct {
	TransferId string
	FileId     string
	Size       uint64
}

On the downloader side is emitted when the checksum calculation starts. It happens after the download.

func (EventKindFinalizeChecksumStarted) Destroy

type EventKindRequestQueued

type EventKindRequestQueued struct {
	Peer       string
	TransferId string
	Files      []QueuedFile
}

Emitted when the application creates a transfer.

func (EventKindRequestQueued) Destroy

func (e EventKindRequestQueued) Destroy()

type EventKindRequestReceived

type EventKindRequestReceived struct {
	Peer       string
	TransferId string
	Files      []ReceivedFile
}

Emitted when the application receives a transfer request from the peer. It contains the peer IP address, transfer ID, and file list.

func (EventKindRequestReceived) Destroy

func (e EventKindRequestReceived) Destroy()

type EventKindRuntimeError

type EventKindRuntimeError struct {
	Status StatusCode
}

This event is used to indicate some runtime error that is not related to the transfer. For example database errors due to automatic retries.

func (EventKindRuntimeError) Destroy

func (e EventKindRuntimeError) Destroy()

type EventKindTransferDeferred

type EventKindTransferDeferred struct {
	TransferId string
	Peer       string
	Status     Status
}

Indicates that the connection made towards the peer was unsuccessful. It might be emitted as a response to the `network_refresh()` call.

func (EventKindTransferDeferred) Destroy

func (e EventKindTransferDeferred) Destroy()

type EventKindTransferFailed

type EventKindTransferFailed struct {
	TransferId string
	Status     Status
}

The whole transfer has failed.

func (EventKindTransferFailed) Destroy

func (e EventKindTransferFailed) Destroy()

type EventKindTransferFinalized

type EventKindTransferFinalized struct {
	TransferId string
	ByPeer     bool
}

Transfer is finalized and no further action on the transfer are possible.

func (EventKindTransferFinalized) Destroy

func (e EventKindTransferFinalized) Destroy()

type EventKindVerifyChecksumFinished

type EventKindVerifyChecksumFinished struct {
	TransferId string
	FileId     string
}

Reports verify checksum finished(downloader side only).

func (EventKindVerifyChecksumFinished) Destroy

func (e EventKindVerifyChecksumFinished) Destroy()

type EventKindVerifyChecksumProgress

type EventKindVerifyChecksumProgress struct {
	TransferId       string
	FileId           string
	BytesChecksummed uint64
}

Reports verify checksumming progress(downloader side only).

func (EventKindVerifyChecksumProgress) Destroy

func (e EventKindVerifyChecksumProgress) Destroy()

type EventKindVerifyChecksumStarted

type EventKindVerifyChecksumStarted struct {
	TransferId string
	FileId     string
	Size       uint64
}

On the downloader side is emitted when the checksum calculation starts. It happens when resuming the download.

func (EventKindVerifyChecksumStarted) Destroy

func (e EventKindVerifyChecksumStarted) Destroy()

type FdResolver

type FdResolver interface {
	OnFd(contentUri string) *int32
}

Profides the file descriptor based on the content URI

# Warning Can be used only on UNIX systems

type FfiConverter

type FfiConverter[GoType any, FfiType any] interface {
	Lift(value FfiType) GoType
	Lower(value GoType) FfiType
}

type FfiConverterBool

type FfiConverterBool struct{}

func (FfiConverterBool) Lift

func (FfiConverterBool) Lift(value C.int8_t) bool

func (FfiConverterBool) Lower

func (FfiConverterBool) Lower(value bool) C.int8_t

func (FfiConverterBool) Read

func (FfiConverterBool) Read(reader io.Reader) bool

func (FfiConverterBool) Write

func (FfiConverterBool) Write(writer io.Writer, value bool)

type FfiConverterBytes

type FfiConverterBytes struct{}

func (FfiConverterBytes) Lift

func (c FfiConverterBytes) Lift(rb RustBufferI) []byte

func (FfiConverterBytes) Lower

func (c FfiConverterBytes) Lower(value []byte) RustBuffer

func (FfiConverterBytes) Read

func (c FfiConverterBytes) Read(reader io.Reader) []byte

func (FfiConverterBytes) Write

func (c FfiConverterBytes) Write(writer io.Writer, value []byte)

type FfiConverterCallbackInterface

type FfiConverterCallbackInterface[CallbackInterface any] struct {
	// contains filtered or unexported fields
}

func (*FfiConverterCallbackInterface[CallbackInterface]) Lift

func (c *FfiConverterCallbackInterface[CallbackInterface]) Lift(handle uint64) CallbackInterface

func (*FfiConverterCallbackInterface[CallbackInterface]) Lower

func (c *FfiConverterCallbackInterface[CallbackInterface]) Lower(value CallbackInterface) C.uint64_t

func (*FfiConverterCallbackInterface[CallbackInterface]) Read

func (c *FfiConverterCallbackInterface[CallbackInterface]) Read(reader io.Reader) CallbackInterface

func (*FfiConverterCallbackInterface[CallbackInterface]) Write

func (c *FfiConverterCallbackInterface[CallbackInterface]) Write(writer io.Writer, value CallbackInterface)

type FfiConverterCallbackInterfaceEventCallback

type FfiConverterCallbackInterfaceEventCallback struct {
	FfiConverterCallbackInterface[EventCallback]
}

type FfiConverterCallbackInterfaceFdResolver

type FfiConverterCallbackInterfaceFdResolver struct {
	FfiConverterCallbackInterface[FdResolver]
}

type FfiConverterCallbackInterfaceKeyStore

type FfiConverterCallbackInterfaceKeyStore struct {
	FfiConverterCallbackInterface[KeyStore]
}

type FfiConverterCallbackInterfaceLogger

type FfiConverterCallbackInterfaceLogger struct {
	FfiConverterCallbackInterface[Logger]
}

type FfiConverterInt32

type FfiConverterInt32 struct{}

func (FfiConverterInt32) Lift

func (FfiConverterInt32) Lift(value C.int32_t) int32

func (FfiConverterInt32) Lower

func (FfiConverterInt32) Lower(value int32) C.int32_t

func (FfiConverterInt32) Read

func (FfiConverterInt32) Read(reader io.Reader) int32

func (FfiConverterInt32) Write

func (FfiConverterInt32) Write(writer io.Writer, value int32)

type FfiConverterInt64

type FfiConverterInt64 struct{}

func (FfiConverterInt64) Lift

func (FfiConverterInt64) Lift(value C.int64_t) int64

func (FfiConverterInt64) Lower

func (FfiConverterInt64) Lower(value int64) C.int64_t

func (FfiConverterInt64) Read

func (FfiConverterInt64) Read(reader io.Reader) int64

func (FfiConverterInt64) Write

func (FfiConverterInt64) Write(writer io.Writer, value int64)

type FfiConverterNordDrop

type FfiConverterNordDrop struct{}

func (FfiConverterNordDrop) Lift

func (c FfiConverterNordDrop) Lift(pointer unsafe.Pointer) *NordDrop

func (FfiConverterNordDrop) Lower

func (c FfiConverterNordDrop) Lower(value *NordDrop) unsafe.Pointer

func (FfiConverterNordDrop) Read

func (c FfiConverterNordDrop) Read(reader io.Reader) *NordDrop

func (FfiConverterNordDrop) Write

func (c FfiConverterNordDrop) Write(writer io.Writer, value *NordDrop)

type FfiConverterOptionalBytes

type FfiConverterOptionalBytes struct{}

func (FfiConverterOptionalBytes) Lift

func (FfiConverterOptionalBytes) Lower

func (c FfiConverterOptionalBytes) Lower(value *[]byte) RustBuffer

func (FfiConverterOptionalBytes) Read

func (_ FfiConverterOptionalBytes) Read(reader io.Reader) *[]byte

func (FfiConverterOptionalBytes) Write

func (_ FfiConverterOptionalBytes) Write(writer io.Writer, value *[]byte)

type FfiConverterOptionalInt32

type FfiConverterOptionalInt32 struct{}

func (FfiConverterOptionalInt32) Lift

func (FfiConverterOptionalInt32) Lower

func (c FfiConverterOptionalInt32) Lower(value *int32) RustBuffer

func (FfiConverterOptionalInt32) Read

func (_ FfiConverterOptionalInt32) Read(reader io.Reader) *int32

func (FfiConverterOptionalInt32) Write

func (_ FfiConverterOptionalInt32) Write(writer io.Writer, value *int32)

type FfiConverterOptionalString

type FfiConverterOptionalString struct{}

func (FfiConverterOptionalString) Lift

func (FfiConverterOptionalString) Lower

func (FfiConverterOptionalString) Read

func (_ FfiConverterOptionalString) Read(reader io.Reader) *string

func (FfiConverterOptionalString) Write

func (_ FfiConverterOptionalString) Write(writer io.Writer, value *string)

type FfiConverterOptionalUint32

type FfiConverterOptionalUint32 struct{}

func (FfiConverterOptionalUint32) Lift

func (FfiConverterOptionalUint32) Lower

func (FfiConverterOptionalUint32) Read

func (_ FfiConverterOptionalUint32) Read(reader io.Reader) *uint32

func (FfiConverterOptionalUint32) Write

func (_ FfiConverterOptionalUint32) Write(writer io.Writer, value *uint32)

type FfiConverterOptionalUint64

type FfiConverterOptionalUint64 struct{}

func (FfiConverterOptionalUint64) Lift

func (FfiConverterOptionalUint64) Lower

func (FfiConverterOptionalUint64) Read

func (_ FfiConverterOptionalUint64) Read(reader io.Reader) *uint64

func (FfiConverterOptionalUint64) Write

func (_ FfiConverterOptionalUint64) Write(writer io.Writer, value *uint64)

type FfiConverterSequenceString

type FfiConverterSequenceString struct{}

func (FfiConverterSequenceString) Lift

func (FfiConverterSequenceString) Lower

func (c FfiConverterSequenceString) Lower(value []string) RustBuffer

func (FfiConverterSequenceString) Read

func (c FfiConverterSequenceString) Read(reader io.Reader) []string

func (FfiConverterSequenceString) Write

func (c FfiConverterSequenceString) Write(writer io.Writer, value []string)

type FfiConverterSequenceTypeIncomingPath

type FfiConverterSequenceTypeIncomingPath struct{}

func (FfiConverterSequenceTypeIncomingPath) Lift

func (FfiConverterSequenceTypeIncomingPath) Lower

func (FfiConverterSequenceTypeIncomingPath) Read

func (FfiConverterSequenceTypeIncomingPath) Write

type FfiConverterSequenceTypeIncomingPathState

type FfiConverterSequenceTypeIncomingPathState struct{}

func (FfiConverterSequenceTypeIncomingPathState) Lift

func (FfiConverterSequenceTypeIncomingPathState) Lower

func (FfiConverterSequenceTypeIncomingPathState) Read

func (FfiConverterSequenceTypeIncomingPathState) Write

type FfiConverterSequenceTypeOutgoingPath

type FfiConverterSequenceTypeOutgoingPath struct{}

func (FfiConverterSequenceTypeOutgoingPath) Lift

func (FfiConverterSequenceTypeOutgoingPath) Lower

func (FfiConverterSequenceTypeOutgoingPath) Read

func (FfiConverterSequenceTypeOutgoingPath) Write

type FfiConverterSequenceTypeOutgoingPathState

type FfiConverterSequenceTypeOutgoingPathState struct{}

func (FfiConverterSequenceTypeOutgoingPathState) Lift

func (FfiConverterSequenceTypeOutgoingPathState) Lower

func (FfiConverterSequenceTypeOutgoingPathState) Read

func (FfiConverterSequenceTypeOutgoingPathState) Write

type FfiConverterSequenceTypeQueuedFile

type FfiConverterSequenceTypeQueuedFile struct{}

func (FfiConverterSequenceTypeQueuedFile) Lift

func (FfiConverterSequenceTypeQueuedFile) Lower

func (FfiConverterSequenceTypeQueuedFile) Read

func (FfiConverterSequenceTypeQueuedFile) Write

func (c FfiConverterSequenceTypeQueuedFile) Write(writer io.Writer, value []QueuedFile)

type FfiConverterSequenceTypeReceivedFile

type FfiConverterSequenceTypeReceivedFile struct{}

func (FfiConverterSequenceTypeReceivedFile) Lift

func (FfiConverterSequenceTypeReceivedFile) Lower

func (FfiConverterSequenceTypeReceivedFile) Read

func (FfiConverterSequenceTypeReceivedFile) Write

type FfiConverterSequenceTypeTransferDescriptor

type FfiConverterSequenceTypeTransferDescriptor struct{}

func (FfiConverterSequenceTypeTransferDescriptor) Lift

func (FfiConverterSequenceTypeTransferDescriptor) Lower

func (FfiConverterSequenceTypeTransferDescriptor) Read

func (FfiConverterSequenceTypeTransferDescriptor) Write

type FfiConverterSequenceTypeTransferInfo

type FfiConverterSequenceTypeTransferInfo struct{}

func (FfiConverterSequenceTypeTransferInfo) Lift

func (FfiConverterSequenceTypeTransferInfo) Lower

func (FfiConverterSequenceTypeTransferInfo) Read

func (FfiConverterSequenceTypeTransferInfo) Write

type FfiConverterSequenceTypeTransferState

type FfiConverterSequenceTypeTransferState struct{}

func (FfiConverterSequenceTypeTransferState) Lift

func (FfiConverterSequenceTypeTransferState) Lower

func (FfiConverterSequenceTypeTransferState) Read

func (FfiConverterSequenceTypeTransferState) Write

type FfiConverterString

type FfiConverterString struct{}

func (FfiConverterString) Lift

func (FfiConverterString) Lower

func (FfiConverterString) Lower(value string) RustBuffer

func (FfiConverterString) Read

func (FfiConverterString) Read(reader io.Reader) string

func (FfiConverterString) Write

func (FfiConverterString) Write(writer io.Writer, value string)

type FfiConverterTypeConfig

type FfiConverterTypeConfig struct{}

func (FfiConverterTypeConfig) Lift

func (FfiConverterTypeConfig) Lower

func (c FfiConverterTypeConfig) Lower(value Config) RustBuffer

func (FfiConverterTypeConfig) Read

func (c FfiConverterTypeConfig) Read(reader io.Reader) Config

func (FfiConverterTypeConfig) Write

func (c FfiConverterTypeConfig) Write(writer io.Writer, value Config)

type FfiConverterTypeEvent

type FfiConverterTypeEvent struct{}

func (FfiConverterTypeEvent) Lift

func (FfiConverterTypeEvent) Lower

func (c FfiConverterTypeEvent) Lower(value Event) RustBuffer

func (FfiConverterTypeEvent) Read

func (c FfiConverterTypeEvent) Read(reader io.Reader) Event

func (FfiConverterTypeEvent) Write

func (c FfiConverterTypeEvent) Write(writer io.Writer, value Event)

type FfiConverterTypeEventKind

type FfiConverterTypeEventKind struct{}

func (FfiConverterTypeEventKind) Lift

func (FfiConverterTypeEventKind) Lower

func (FfiConverterTypeEventKind) Read

func (FfiConverterTypeEventKind) Write

func (FfiConverterTypeEventKind) Write(writer io.Writer, value EventKind)

type FfiConverterTypeIncomingPath

type FfiConverterTypeIncomingPath struct{}

func (FfiConverterTypeIncomingPath) Lift

func (FfiConverterTypeIncomingPath) Lower

func (FfiConverterTypeIncomingPath) Read

func (FfiConverterTypeIncomingPath) Write

func (c FfiConverterTypeIncomingPath) Write(writer io.Writer, value IncomingPath)

type FfiConverterTypeIncomingPathState

type FfiConverterTypeIncomingPathState struct{}

func (FfiConverterTypeIncomingPathState) Lift

func (FfiConverterTypeIncomingPathState) Lower

func (FfiConverterTypeIncomingPathState) Read

func (FfiConverterTypeIncomingPathState) Write

type FfiConverterTypeIncomingPathStateKind

type FfiConverterTypeIncomingPathStateKind struct{}

func (FfiConverterTypeIncomingPathStateKind) Lift

func (FfiConverterTypeIncomingPathStateKind) Lower

func (FfiConverterTypeIncomingPathStateKind) Read

func (FfiConverterTypeIncomingPathStateKind) Write

type FfiConverterTypeLibdropError

type FfiConverterTypeLibdropError struct{}

func (FfiConverterTypeLibdropError) Lift

func (FfiConverterTypeLibdropError) Lower

func (FfiConverterTypeLibdropError) Read

func (FfiConverterTypeLibdropError) Write

func (c FfiConverterTypeLibdropError) Write(writer io.Writer, value *LibdropError)

type FfiConverterTypeLogLevel

type FfiConverterTypeLogLevel struct{}

func (FfiConverterTypeLogLevel) Lift

func (FfiConverterTypeLogLevel) Lower

func (FfiConverterTypeLogLevel) Read

func (FfiConverterTypeLogLevel) Write

func (FfiConverterTypeLogLevel) Write(writer io.Writer, value LogLevel)

type FfiConverterTypeOutgoingFileSource

type FfiConverterTypeOutgoingFileSource struct{}

func (FfiConverterTypeOutgoingFileSource) Lift

func (FfiConverterTypeOutgoingFileSource) Lower

func (FfiConverterTypeOutgoingFileSource) Read

func (FfiConverterTypeOutgoingFileSource) Write

type FfiConverterTypeOutgoingPath

type FfiConverterTypeOutgoingPath struct{}

func (FfiConverterTypeOutgoingPath) Lift

func (FfiConverterTypeOutgoingPath) Lower

func (FfiConverterTypeOutgoingPath) Read

func (FfiConverterTypeOutgoingPath) Write

func (c FfiConverterTypeOutgoingPath) Write(writer io.Writer, value OutgoingPath)

type FfiConverterTypeOutgoingPathState

type FfiConverterTypeOutgoingPathState struct{}

func (FfiConverterTypeOutgoingPathState) Lift

func (FfiConverterTypeOutgoingPathState) Lower

func (FfiConverterTypeOutgoingPathState) Read

func (FfiConverterTypeOutgoingPathState) Write

type FfiConverterTypeOutgoingPathStateKind

type FfiConverterTypeOutgoingPathStateKind struct{}

func (FfiConverterTypeOutgoingPathStateKind) Lift

func (FfiConverterTypeOutgoingPathStateKind) Lower

func (FfiConverterTypeOutgoingPathStateKind) Read

func (FfiConverterTypeOutgoingPathStateKind) Write

type FfiConverterTypeQueuedFile

type FfiConverterTypeQueuedFile struct{}

func (FfiConverterTypeQueuedFile) Lift

func (FfiConverterTypeQueuedFile) Lower

func (FfiConverterTypeQueuedFile) Read

func (FfiConverterTypeQueuedFile) Write

func (c FfiConverterTypeQueuedFile) Write(writer io.Writer, value QueuedFile)

type FfiConverterTypeReceivedFile

type FfiConverterTypeReceivedFile struct{}

func (FfiConverterTypeReceivedFile) Lift

func (FfiConverterTypeReceivedFile) Lower

func (FfiConverterTypeReceivedFile) Read

func (FfiConverterTypeReceivedFile) Write

func (c FfiConverterTypeReceivedFile) Write(writer io.Writer, value ReceivedFile)

type FfiConverterTypeStatus

type FfiConverterTypeStatus struct{}

func (FfiConverterTypeStatus) Lift

func (FfiConverterTypeStatus) Lower

func (c FfiConverterTypeStatus) Lower(value Status) RustBuffer

func (FfiConverterTypeStatus) Read

func (c FfiConverterTypeStatus) Read(reader io.Reader) Status

func (FfiConverterTypeStatus) Write

func (c FfiConverterTypeStatus) Write(writer io.Writer, value Status)

type FfiConverterTypeStatusCode

type FfiConverterTypeStatusCode struct{}

func (FfiConverterTypeStatusCode) Lift

func (FfiConverterTypeStatusCode) Lower

func (FfiConverterTypeStatusCode) Read

func (FfiConverterTypeStatusCode) Write

func (FfiConverterTypeStatusCode) Write(writer io.Writer, value StatusCode)

type FfiConverterTypeTransferDescriptor

type FfiConverterTypeTransferDescriptor struct{}

func (FfiConverterTypeTransferDescriptor) Lift

func (FfiConverterTypeTransferDescriptor) Lower

func (FfiConverterTypeTransferDescriptor) Read

func (FfiConverterTypeTransferDescriptor) Write

type FfiConverterTypeTransferInfo

type FfiConverterTypeTransferInfo struct{}

func (FfiConverterTypeTransferInfo) Lift

func (FfiConverterTypeTransferInfo) Lower

func (FfiConverterTypeTransferInfo) Read

func (FfiConverterTypeTransferInfo) Write

func (c FfiConverterTypeTransferInfo) Write(writer io.Writer, value TransferInfo)

type FfiConverterTypeTransferKind

type FfiConverterTypeTransferKind struct{}

func (FfiConverterTypeTransferKind) Lift

func (FfiConverterTypeTransferKind) Lower

func (FfiConverterTypeTransferKind) Read

func (FfiConverterTypeTransferKind) Write

func (FfiConverterTypeTransferKind) Write(writer io.Writer, value TransferKind)

type FfiConverterTypeTransferState

type FfiConverterTypeTransferState struct{}

func (FfiConverterTypeTransferState) Lift

func (FfiConverterTypeTransferState) Lower

func (FfiConverterTypeTransferState) Read

func (FfiConverterTypeTransferState) Write

func (c FfiConverterTypeTransferState) Write(writer io.Writer, value TransferState)

type FfiConverterTypeTransferStateKind

type FfiConverterTypeTransferStateKind struct{}

func (FfiConverterTypeTransferStateKind) Lift

func (FfiConverterTypeTransferStateKind) Lower

func (FfiConverterTypeTransferStateKind) Read

func (FfiConverterTypeTransferStateKind) Write

type FfiConverterUint32

type FfiConverterUint32 struct{}

func (FfiConverterUint32) Lift

func (FfiConverterUint32) Lift(value C.uint32_t) uint32

func (FfiConverterUint32) Lower

func (FfiConverterUint32) Lower(value uint32) C.uint32_t

func (FfiConverterUint32) Read

func (FfiConverterUint32) Read(reader io.Reader) uint32

func (FfiConverterUint32) Write

func (FfiConverterUint32) Write(writer io.Writer, value uint32)

type FfiConverterUint64

type FfiConverterUint64 struct{}

func (FfiConverterUint64) Lift

func (FfiConverterUint64) Lift(value C.uint64_t) uint64

func (FfiConverterUint64) Lower

func (FfiConverterUint64) Lower(value uint64) C.uint64_t

func (FfiConverterUint64) Read

func (FfiConverterUint64) Read(reader io.Reader) uint64

func (FfiConverterUint64) Write

func (FfiConverterUint64) Write(writer io.Writer, value uint64)

type FfiDestroyerBool

type FfiDestroyerBool struct{}

func (FfiDestroyerBool) Destroy

func (FfiDestroyerBool) Destroy(_ bool)

type FfiDestroyerBytes

type FfiDestroyerBytes struct{}

func (FfiDestroyerBytes) Destroy

func (FfiDestroyerBytes) Destroy(_ []byte)

type FfiDestroyerCallbackInterfaceEventCallback

type FfiDestroyerCallbackInterfaceEventCallback struct{}

func (FfiDestroyerCallbackInterfaceEventCallback) Destroy

type FfiDestroyerCallbackInterfaceFdResolver

type FfiDestroyerCallbackInterfaceFdResolver struct{}

func (FfiDestroyerCallbackInterfaceFdResolver) Destroy

type FfiDestroyerCallbackInterfaceKeyStore

type FfiDestroyerCallbackInterfaceKeyStore struct{}

func (FfiDestroyerCallbackInterfaceKeyStore) Destroy

type FfiDestroyerCallbackInterfaceLogger

type FfiDestroyerCallbackInterfaceLogger struct{}

func (FfiDestroyerCallbackInterfaceLogger) Destroy

type FfiDestroyerInt32

type FfiDestroyerInt32 struct{}

func (FfiDestroyerInt32) Destroy

func (FfiDestroyerInt32) Destroy(_ int32)

type FfiDestroyerInt64

type FfiDestroyerInt64 struct{}

func (FfiDestroyerInt64) Destroy

func (FfiDestroyerInt64) Destroy(_ int64)

type FfiDestroyerNordDrop

type FfiDestroyerNordDrop struct{}

func (FfiDestroyerNordDrop) Destroy

func (_ FfiDestroyerNordDrop) Destroy(value *NordDrop)

type FfiDestroyerOptionalBytes

type FfiDestroyerOptionalBytes struct{}

func (FfiDestroyerOptionalBytes) Destroy

func (_ FfiDestroyerOptionalBytes) Destroy(value *[]byte)

type FfiDestroyerOptionalInt32

type FfiDestroyerOptionalInt32 struct{}

func (FfiDestroyerOptionalInt32) Destroy

func (_ FfiDestroyerOptionalInt32) Destroy(value *int32)

type FfiDestroyerOptionalString

type FfiDestroyerOptionalString struct{}

func (FfiDestroyerOptionalString) Destroy

func (_ FfiDestroyerOptionalString) Destroy(value *string)

type FfiDestroyerOptionalUint32

type FfiDestroyerOptionalUint32 struct{}

func (FfiDestroyerOptionalUint32) Destroy

func (_ FfiDestroyerOptionalUint32) Destroy(value *uint32)

type FfiDestroyerOptionalUint64

type FfiDestroyerOptionalUint64 struct{}

func (FfiDestroyerOptionalUint64) Destroy

func (_ FfiDestroyerOptionalUint64) Destroy(value *uint64)

type FfiDestroyerSequenceString

type FfiDestroyerSequenceString struct{}

func (FfiDestroyerSequenceString) Destroy

func (FfiDestroyerSequenceString) Destroy(sequence []string)

type FfiDestroyerSequenceTypeIncomingPath

type FfiDestroyerSequenceTypeIncomingPath struct{}

func (FfiDestroyerSequenceTypeIncomingPath) Destroy

type FfiDestroyerSequenceTypeIncomingPathState

type FfiDestroyerSequenceTypeIncomingPathState struct{}

func (FfiDestroyerSequenceTypeIncomingPathState) Destroy

type FfiDestroyerSequenceTypeOutgoingPath

type FfiDestroyerSequenceTypeOutgoingPath struct{}

func (FfiDestroyerSequenceTypeOutgoingPath) Destroy

type FfiDestroyerSequenceTypeOutgoingPathState

type FfiDestroyerSequenceTypeOutgoingPathState struct{}

func (FfiDestroyerSequenceTypeOutgoingPathState) Destroy

type FfiDestroyerSequenceTypeQueuedFile

type FfiDestroyerSequenceTypeQueuedFile struct{}

func (FfiDestroyerSequenceTypeQueuedFile) Destroy

func (FfiDestroyerSequenceTypeQueuedFile) Destroy(sequence []QueuedFile)

type FfiDestroyerSequenceTypeReceivedFile

type FfiDestroyerSequenceTypeReceivedFile struct{}

func (FfiDestroyerSequenceTypeReceivedFile) Destroy

type FfiDestroyerSequenceTypeTransferDescriptor

type FfiDestroyerSequenceTypeTransferDescriptor struct{}

func (FfiDestroyerSequenceTypeTransferDescriptor) Destroy

type FfiDestroyerSequenceTypeTransferInfo

type FfiDestroyerSequenceTypeTransferInfo struct{}

func (FfiDestroyerSequenceTypeTransferInfo) Destroy

type FfiDestroyerSequenceTypeTransferState

type FfiDestroyerSequenceTypeTransferState struct{}

func (FfiDestroyerSequenceTypeTransferState) Destroy

type FfiDestroyerString

type FfiDestroyerString struct{}

func (FfiDestroyerString) Destroy

func (FfiDestroyerString) Destroy(_ string)

type FfiDestroyerTypeConfig

type FfiDestroyerTypeConfig struct{}

func (FfiDestroyerTypeConfig) Destroy

func (_ FfiDestroyerTypeConfig) Destroy(value Config)

type FfiDestroyerTypeEvent

type FfiDestroyerTypeEvent struct{}

func (FfiDestroyerTypeEvent) Destroy

func (_ FfiDestroyerTypeEvent) Destroy(value Event)

type FfiDestroyerTypeEventKind

type FfiDestroyerTypeEventKind struct{}

func (FfiDestroyerTypeEventKind) Destroy

func (_ FfiDestroyerTypeEventKind) Destroy(value EventKind)

type FfiDestroyerTypeIncomingPath

type FfiDestroyerTypeIncomingPath struct{}

func (FfiDestroyerTypeIncomingPath) Destroy

func (_ FfiDestroyerTypeIncomingPath) Destroy(value IncomingPath)

type FfiDestroyerTypeIncomingPathState

type FfiDestroyerTypeIncomingPathState struct{}

func (FfiDestroyerTypeIncomingPathState) Destroy

type FfiDestroyerTypeIncomingPathStateKind

type FfiDestroyerTypeIncomingPathStateKind struct{}

func (FfiDestroyerTypeIncomingPathStateKind) Destroy

type FfiDestroyerTypeLogLevel

type FfiDestroyerTypeLogLevel struct{}

func (FfiDestroyerTypeLogLevel) Destroy

func (_ FfiDestroyerTypeLogLevel) Destroy(value LogLevel)

type FfiDestroyerTypeOutgoingFileSource

type FfiDestroyerTypeOutgoingFileSource struct{}

func (FfiDestroyerTypeOutgoingFileSource) Destroy

type FfiDestroyerTypeOutgoingPath

type FfiDestroyerTypeOutgoingPath struct{}

func (FfiDestroyerTypeOutgoingPath) Destroy

func (_ FfiDestroyerTypeOutgoingPath) Destroy(value OutgoingPath)

type FfiDestroyerTypeOutgoingPathState

type FfiDestroyerTypeOutgoingPathState struct{}

func (FfiDestroyerTypeOutgoingPathState) Destroy

type FfiDestroyerTypeOutgoingPathStateKind

type FfiDestroyerTypeOutgoingPathStateKind struct{}

func (FfiDestroyerTypeOutgoingPathStateKind) Destroy

type FfiDestroyerTypeQueuedFile

type FfiDestroyerTypeQueuedFile struct{}

func (FfiDestroyerTypeQueuedFile) Destroy

func (_ FfiDestroyerTypeQueuedFile) Destroy(value QueuedFile)

type FfiDestroyerTypeReceivedFile

type FfiDestroyerTypeReceivedFile struct{}

func (FfiDestroyerTypeReceivedFile) Destroy

func (_ FfiDestroyerTypeReceivedFile) Destroy(value ReceivedFile)

type FfiDestroyerTypeStatus

type FfiDestroyerTypeStatus struct{}

func (FfiDestroyerTypeStatus) Destroy

func (_ FfiDestroyerTypeStatus) Destroy(value Status)

type FfiDestroyerTypeStatusCode

type FfiDestroyerTypeStatusCode struct{}

func (FfiDestroyerTypeStatusCode) Destroy

func (_ FfiDestroyerTypeStatusCode) Destroy(value StatusCode)

type FfiDestroyerTypeTransferDescriptor

type FfiDestroyerTypeTransferDescriptor struct{}

func (FfiDestroyerTypeTransferDescriptor) Destroy

type FfiDestroyerTypeTransferInfo

type FfiDestroyerTypeTransferInfo struct{}

func (FfiDestroyerTypeTransferInfo) Destroy

func (_ FfiDestroyerTypeTransferInfo) Destroy(value TransferInfo)

type FfiDestroyerTypeTransferKind

type FfiDestroyerTypeTransferKind struct{}

func (FfiDestroyerTypeTransferKind) Destroy

func (_ FfiDestroyerTypeTransferKind) Destroy(value TransferKind)

type FfiDestroyerTypeTransferState

type FfiDestroyerTypeTransferState struct{}

func (FfiDestroyerTypeTransferState) Destroy

type FfiDestroyerTypeTransferStateKind

type FfiDestroyerTypeTransferStateKind struct{}

func (FfiDestroyerTypeTransferStateKind) Destroy

type FfiDestroyerUint32

type FfiDestroyerUint32 struct{}

func (FfiDestroyerUint32) Destroy

func (FfiDestroyerUint32) Destroy(_ uint32)

type FfiDestroyerUint64

type FfiDestroyerUint64 struct{}

func (FfiDestroyerUint64) Destroy

func (FfiDestroyerUint64) Destroy(_ uint64)

type FfiObject

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

type FfiRustBufConverter

type FfiRustBufConverter[GoType any, FfiType any] interface {
	FfiConverter[GoType, FfiType]
	BufReader[GoType]
}

type IncomingPath

type IncomingPath struct {
	// File ID
	FileId string
	// File path relative to the transfer's root directory
	RelativePath string
	// File size
	Bytes uint64
	// Curently received file bytes
	BytesReceived uint64
	// History of the file state chagnes
	States []IncomingPathState
}

The description and history of a signle incoming file

func (*IncomingPath) Destroy

func (r *IncomingPath) Destroy()

type IncomingPathState

type IncomingPathState struct {
	// The creation time as a UNIX timestamp in milliseconds.
	CreatedAt int64
	// The type of the state change.
	Kind IncomingPathStateKind
}

A single change in the incoming file state

func (*IncomingPathState) Destroy

func (r *IncomingPathState) Destroy()

type IncomingPathStateKind

type IncomingPathStateKind interface {
	Destroy()
}

Description of incoming file states. Some states are considered **terminal**. Terminal states appear once and it is the final state. Other states might appear multiple times.

type IncomingPathStateKindCompleted

type IncomingPathStateKindCompleted struct {
	FinalPath string
}

The file was successfully received and saved to the disk. Contains the final path of the file. This is a **terminal** state.

func (IncomingPathStateKindCompleted) Destroy

func (e IncomingPathStateKindCompleted) Destroy()

type IncomingPathStateKindFailed

type IncomingPathStateKindFailed struct {
	Status        StatusCode
	BytesReceived uint64
}

Contains status code of failure. This is a **terminal** state.

func (IncomingPathStateKindFailed) Destroy

func (e IncomingPathStateKindFailed) Destroy()

type IncomingPathStateKindPaused

type IncomingPathStateKindPaused struct {
	BytesReceived uint64
}

The file was paused due to recoverable errors. Most probably due to network availability.

func (IncomingPathStateKindPaused) Destroy

func (e IncomingPathStateKindPaused) Destroy()

type IncomingPathStateKindPending

type IncomingPathStateKindPending struct {
	BaseDir string
}

The download was issued for this file and it will proceed when possible.

func (IncomingPathStateKindPending) Destroy

func (e IncomingPathStateKindPending) Destroy()

type IncomingPathStateKindRejected

type IncomingPathStateKindRejected struct {
	ByPeer        bool
	BytesReceived uint64
}

The file was rejected by the receiver. Contains indicator of who rejected the file. This is a **terminal** state.

func (IncomingPathStateKindRejected) Destroy

func (e IncomingPathStateKindRejected) Destroy()

type IncomingPathStateKindStarted

type IncomingPathStateKindStarted struct {
	BytesReceived uint64
}

The file was started to be received. Contains the base directory of the file.

func (IncomingPathStateKindStarted) Destroy

func (e IncomingPathStateKindStarted) Destroy()

type KeyStore

type KeyStore interface {

	// It is used to request
	// the app to provide the peer’s public key or the node itself.
	//
	// # Arguments
	// * `peer` - peer's IP address
	//
	// # Returns
	// 32bytes private key. Note that it’s not BASE64, it must
	// be decoded if it is beforehand.
	// The `null` value is used to indicate that the key could not be
	// provided.
	OnPubkey(peer string) *[]byte

	// 32bytes private key
	//
	// # Warning
	// This it’s not BASE64, it must
	// be decoded if it is beforehand.
	Privkey() []byte
}

The interface for providing crypto keys

type LibdropError

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

The commmon error type thrown from functions

func NewLibdropErrorAddrInUse

func NewLibdropErrorAddrInUse() *LibdropError

Address already in use

func NewLibdropErrorBadInput

func NewLibdropErrorBadInput() *LibdropError

One of the arguments provided is invalid

func NewLibdropErrorDbError

func NewLibdropErrorDbError() *LibdropError

Database error

func NewLibdropErrorInstanceStart

func NewLibdropErrorInstanceStart() *LibdropError

Failed to start the libdrop instance

func NewLibdropErrorInstanceStop

func NewLibdropErrorInstanceStop() *LibdropError

Failed to stop the libdrop instance

func NewLibdropErrorInvalidPrivkey

func NewLibdropErrorInvalidPrivkey() *LibdropError

Invalid private key provided

func NewLibdropErrorInvalidString

func NewLibdropErrorInvalidString() *LibdropError

The string provided is not valid UTF8

func NewLibdropErrorNotStarted

func NewLibdropErrorNotStarted() *LibdropError

The libdrop instance is not started yet

func NewLibdropErrorTransferCreate

func NewLibdropErrorTransferCreate() *LibdropError

Failed to create transfer based on arguments provided

func NewLibdropErrorUnknown

func NewLibdropErrorUnknown() *LibdropError

Operation resulted to unknown error.

func (LibdropError) Error

func (err LibdropError) Error() string

func (LibdropError) Unwrap

func (err LibdropError) Unwrap() error

type LibdropErrorAddrInUse

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

Address already in use

func (LibdropErrorAddrInUse) Error

func (err LibdropErrorAddrInUse) Error() string

func (LibdropErrorAddrInUse) Is

func (self LibdropErrorAddrInUse) Is(target error) bool

type LibdropErrorBadInput

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

One of the arguments provided is invalid

func (LibdropErrorBadInput) Error

func (err LibdropErrorBadInput) Error() string

func (LibdropErrorBadInput) Is

func (self LibdropErrorBadInput) Is(target error) bool

type LibdropErrorDbError

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

Database error

func (LibdropErrorDbError) Error

func (err LibdropErrorDbError) Error() string

func (LibdropErrorDbError) Is

func (self LibdropErrorDbError) Is(target error) bool

type LibdropErrorInstanceStart

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

Failed to start the libdrop instance

func (LibdropErrorInstanceStart) Error

func (err LibdropErrorInstanceStart) Error() string

func (LibdropErrorInstanceStart) Is

func (self LibdropErrorInstanceStart) Is(target error) bool

type LibdropErrorInstanceStop

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

Failed to stop the libdrop instance

func (LibdropErrorInstanceStop) Error

func (err LibdropErrorInstanceStop) Error() string

func (LibdropErrorInstanceStop) Is

func (self LibdropErrorInstanceStop) Is(target error) bool

type LibdropErrorInvalidPrivkey

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

Invalid private key provided

func (LibdropErrorInvalidPrivkey) Error

func (err LibdropErrorInvalidPrivkey) Error() string

func (LibdropErrorInvalidPrivkey) Is

func (self LibdropErrorInvalidPrivkey) Is(target error) bool

type LibdropErrorInvalidString

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

The string provided is not valid UTF8

func (LibdropErrorInvalidString) Error

func (err LibdropErrorInvalidString) Error() string

func (LibdropErrorInvalidString) Is

func (self LibdropErrorInvalidString) Is(target error) bool

type LibdropErrorNotStarted

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

The libdrop instance is not started yet

func (LibdropErrorNotStarted) Error

func (err LibdropErrorNotStarted) Error() string

func (LibdropErrorNotStarted) Is

func (self LibdropErrorNotStarted) Is(target error) bool

type LibdropErrorTransferCreate

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

Failed to create transfer based on arguments provided

func (LibdropErrorTransferCreate) Error

func (err LibdropErrorTransferCreate) Error() string

func (LibdropErrorTransferCreate) Is

func (self LibdropErrorTransferCreate) Is(target error) bool

type LibdropErrorUnknown

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

Variant structs Operation resulted to unknown error.

func (LibdropErrorUnknown) Error

func (err LibdropErrorUnknown) Error() string

func (LibdropErrorUnknown) Is

func (self LibdropErrorUnknown) Is(target error) bool

type LogLevel

type LogLevel uint

Posible log levels.

const (
	LogLevelCritical LogLevel = 1
	LogLevelError    LogLevel = 2
	LogLevelWarning  LogLevel = 3
	LogLevelInfo     LogLevel = 4
	LogLevelDebug    LogLevel = 5
	LogLevelTrace    LogLevel = 6
)

type Logger

type Logger interface {

	// Function called when log message occurs
	OnLog(level LogLevel, msg string)

	// Maximum log level
	Level() LogLevel
}

The logger callback interface

type NordDrop

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

func NewNordDrop

func NewNordDrop(eventCb EventCallback, keyStore KeyStore, logger Logger) (*NordDrop, error)

Create a new instance of norddrop. This is a required step to work with API further

# Arguments * `event_cb` - Event callback * `logger` - Logger callback * `key_store` - Fetches peer's public key and provides own private key.

func (*NordDrop) Destroy

func (object *NordDrop) Destroy()

func (*NordDrop) DownloadFile

func (_self *NordDrop) DownloadFile(transferId string, fileId string, destination string) error

Download a file from the peer

# Arguments * `transfer_id` - Transfer UUID * `file_id` - File ID * `destination` - Destination path

func (*NordDrop) FinalizeTransfer

func (_self *NordDrop) FinalizeTransfer(transferId string) error

Finalizes the transfer from either side

# Arguments * `transfer_id`: Transfer UUID

func (*NordDrop) NetworkRefresh

func (_self *NordDrop) NetworkRefresh() error

Refresh connections. Should be called when anything about the network changes that might affect connections. Also when peer availability has changed. This will kick-start the automated retries for all transfers.

func (*NordDrop) NewTransfer

func (_self *NordDrop) NewTransfer(peer string, descriptors []TransferDescriptor) (string, error)

Initialize a new transfer with the provided peer and descriptors

# Arguments * `peer` - Peer address. * `descriptors` - transfer file descriptors.

# Returns A String containing the transfer UUID.

func (*NordDrop) PurgeTransfers

func (_self *NordDrop) PurgeTransfers(transferIds []string) error

Purge transfers from the database

# Arguments * `transfer_ids` - array of transfer UUIDs

func (*NordDrop) PurgeTransfersUntil

func (_self *NordDrop) PurgeTransfersUntil(until int64) error

Purge transfers from the database until the given timestamp

# Arguments * `until` - Unix timestamp in milliseconds

func (*NordDrop) RejectFile

func (_self *NordDrop) RejectFile(transferId string, fileId string) error

Reject a file from either side

# Arguments * `transfer_id`: Transfer UUID * `file_id`: File ID

func (*NordDrop) RemoveFile

func (_self *NordDrop) RemoveFile(transferId string, fileId string) error

Removes a single transfer file from the database. The file must be in the **terminal** state beforehand, otherwise the error is returned.

# Arguments

* `transfer_id`: Transfer UUID * `file_id`: File ID

func (*NordDrop) SetFdResolver

func (_self *NordDrop) SetFdResolver(resolver FdResolver) error

Set a file descriptor (FD) resolver callback. The callback provides FDs based on URI. This function should be called before `start()`, otherwise it will return an error.

# Arguments * `resolver`: The resolver structure

# Warning This function is intended to be called only on UNIX platforms

func (*NordDrop) Start

func (_self *NordDrop) Start(addr string, config Config) error

Starts libdrop

# Arguments * `addr` - Address to listen on * `config` - configuration

Configuration Parameters

* `dir_depth_limit` - if the tree contains more levels then the error is returned.

* `transfer_file_limit` - when aggregating files from the path, if this limit is reached, an error is returned.

* `moose_event_path` - moose database path.

* `moose_prod` - moose production flag.

* `storage_path` - storage path for persistence engine.

  • `checksum_events_size_threshold_bytes` - emit checksum events only if file is equal or greater than this size. If omited, no checksumming events are emited.

# Safety The pointers provided must be valid

func (*NordDrop) Stop

func (_self *NordDrop) Stop() error

Stop norddrop instance

func (*NordDrop) TransfersSince

func (_self *NordDrop) TransfersSince(since int64) ([]TransferInfo, error)

Get transfers from the database

# Arguments * `since_timestamp` - UNIX timestamp in milliseconds

type OutgoingFileSource

type OutgoingFileSource interface {
	Destroy()
}

The outgoing file data source

type OutgoingFileSourceBasePath

type OutgoingFileSourceBasePath struct {
	BasePath string
}

The file is read from disk, from the given path

func (OutgoingFileSourceBasePath) Destroy

func (e OutgoingFileSourceBasePath) Destroy()

type OutgoingFileSourceContentUri

type OutgoingFileSourceContentUri struct {
	Uri string
}

The file descriptor is retrieved with the FD resolver

# Warning This mechanism can only be used on UNIX systems

func (OutgoingFileSourceContentUri) Destroy

func (e OutgoingFileSourceContentUri) Destroy()

type OutgoingPath

type OutgoingPath struct {
	// File ID
	FileId string
	// File path relative to the transfer's root directory
	RelativePath string
	// File size
	Bytes uint64
	// Curently transferred file bytes
	BytesSent uint64
	// The source of the file data
	Source OutgoingFileSource
	// History of the file state chagnes
	States []OutgoingPathState
}

The description and history of a signle outgoing file

func (*OutgoingPath) Destroy

func (r *OutgoingPath) Destroy()

type OutgoingPathState

type OutgoingPathState struct {
	// The creation time as a UNIX timestamp in milliseconds.
	CreatedAt int64
	// The type of the state change.
	Kind OutgoingPathStateKind
}

The description and history of a signle outgoing file

func (*OutgoingPathState) Destroy

func (r *OutgoingPathState) Destroy()

type OutgoingPathStateKind

type OutgoingPathStateKind interface {
	Destroy()
}

Description of outgoing file states. Some states are considered **terminal**. Terminal states appear once and it is the final state. Other states might appear multiple times.

type OutgoingPathStateKindCompleted

type OutgoingPathStateKindCompleted struct {
}

The file was successfully received and saved to the disk. Contains the final path of the file. This is a **terminal** state.

func (OutgoingPathStateKindCompleted) Destroy

func (e OutgoingPathStateKindCompleted) Destroy()

type OutgoingPathStateKindFailed

type OutgoingPathStateKindFailed struct {
	Status    StatusCode
	BytesSent uint64
}

Contains status code of failure. This is a **terminal** state.

func (OutgoingPathStateKindFailed) Destroy

func (e OutgoingPathStateKindFailed) Destroy()

type OutgoingPathStateKindPaused

type OutgoingPathStateKindPaused struct {
	BytesSent uint64
}

The file was paused due to recoverable errors. Most probably due to network availability.

func (OutgoingPathStateKindPaused) Destroy

func (e OutgoingPathStateKindPaused) Destroy()

type OutgoingPathStateKindRejected

type OutgoingPathStateKindRejected struct {
	ByPeer    bool
	BytesSent uint64
}

The file was rejected by the receiver. Contains indicator of who rejected the file. This is a **terminal** state.

func (OutgoingPathStateKindRejected) Destroy

func (e OutgoingPathStateKindRejected) Destroy()

type OutgoingPathStateKindStarted

type OutgoingPathStateKindStarted struct {
	BytesSent uint64
}

The file was started to be received. Contains the base directory of the file.

func (OutgoingPathStateKindStarted) Destroy

func (e OutgoingPathStateKindStarted) Destroy()

type QueuedFile

type QueuedFile struct {
	// File ID
	Id string
	// File path
	Path string
	// File size
	Size uint64
	// File base directory
	BaseDir *string
}

The outgoing transfer file structure

func (*QueuedFile) Destroy

func (r *QueuedFile) Destroy()

type ReceivedFile

type ReceivedFile struct {
	// File ID
	Id string
	// File path
	Path string
	// File size
	Size uint64
}

The incoming transfer file structure

func (*ReceivedFile) Destroy

func (r *ReceivedFile) Destroy()

type RustBuffer

type RustBuffer = C.RustBuffer

func LowerIntoRustBuffer

func LowerIntoRustBuffer[GoType any](bufWriter BufWriter[GoType], value GoType) RustBuffer

func RustBufferFromExternal

func RustBufferFromExternal(b RustBufferI) RustBuffer

func (RustBuffer) AsReader

func (cb RustBuffer) AsReader() *bytes.Reader

func (RustBuffer) Capacity

func (cb RustBuffer) Capacity() int

func (RustBuffer) Data

func (cb RustBuffer) Data() unsafe.Pointer

func (RustBuffer) Free

func (cb RustBuffer) Free()

func (RustBuffer) Len

func (cb RustBuffer) Len() int

func (RustBuffer) ToGoBytes

func (cb RustBuffer) ToGoBytes() []byte

type RustBufferI

type RustBufferI interface {
	AsReader() *bytes.Reader
	Free()
	ToGoBytes() []byte
	Data() unsafe.Pointer
	Len() int
	Capacity() int
}

type Status

type Status struct {
	// Status code
	Status StatusCode
	// OS error number if available
	OsErrorCode *int32
}

The common state structure

func (*Status) Destroy

func (r *Status) Destroy()

type StatusCode

type StatusCode uint

Status codes returend by the events

const (
	// Not an error per se; indicates finalized transfers.
	StatusCodeFinalized StatusCode = 1
	// An invalid path was provided.
	// File path contains invalid components (e.g. parent `..`).
	StatusCodeBadPath StatusCode = 2
	// Failed to open the file or file doesn’t exist when asked to download. Might
	// indicate bad API usage. For Unix platforms using file descriptors, it might
	// indicate invalid FD being passed to libdrop.
	StatusCodeBadFile StatusCode = 3
	// Invalid input transfer ID passed.
	StatusCodeBadTransfer StatusCode = 4
	// An error occurred during the transfer and it cannot continue. The most probable
	// reason is the error occurred on the peer’s device or other error that cannot be
	// categorize elsewhere.
	StatusCodeBadTransferState StatusCode = 5
	// Invalid input file ID passed when.
	StatusCodeBadFileId StatusCode = 6
	// General IO error. Check the logs and contact libdrop team.
	StatusCodeIoError StatusCode = 7
	// Transfer limits exceeded. Limit is in terms of depth and breadth for
	// directories.
	StatusCodeTransferLimitsExceeded StatusCode = 8
	// The file size has changed since adding it to the transfer. The original file was
	// modified while not in flight in such a way that its size changed.
	StatusCodeMismatchedSize StatusCode = 9
	// An invalid argument was provided either as a function argument or
	// invalid config value.
	StatusCodeInvalidArgument StatusCode = 10
	// The WebSocket server failed to bind because of an address collision.
	StatusCodeAddrInUse StatusCode = 11
	// The file was modified while being uploaded.
	StatusCodeFileModified StatusCode = 12
	// The filename is too long which might be due to the fact the sender uses
	// a filesystem supporting longer filenames than the one which’s downloading the
	// file.
	StatusCodeFilenameTooLong StatusCode = 13
	// A peer couldn’t validate our authentication request.
	StatusCodeAuthenticationFailed StatusCode = 14
	// Persistence error.
	StatusCodeStorageError StatusCode = 15
	// The persistence database is lost. A new database will be created.
	StatusCodeDbLost StatusCode = 16
	// Downloaded file checksum differs from the advertised one. The downloaded
	// file is deleted by libdrop.
	StatusCodeFileChecksumMismatch StatusCode = 17
	// Download is impossible of the rejected file.
	StatusCodeFileRejected StatusCode = 18
	// Action is blocked because the failed condition has been reached.
	StatusCodeFileFailed StatusCode = 19
	// Action is blocked because the file is already transferred.
	StatusCodeFileFinished StatusCode = 20
	// Transfer requested with empty file list.
	StatusCodeEmptyTransfer StatusCode = 21
	// Transfer resume attempt was closed by peer for no reason. It might indicate
	// temporary issues on the peer’s side. It is safe to continue to resume the
	// transfer.
	StatusCodeConnectionClosedByPeer StatusCode = 22
	// Peer’s DDoS protection kicked in.
	// Transfer should be resumed after some cooldown period.
	StatusCodeTooManyRequests StatusCode = 23
	// This error code is intercepted from the OS errors. Indicate lack of
	// privileges to do certain operation.
	StatusCodePermissionDenied StatusCode = 24
)

type TransferDescriptor

type TransferDescriptor interface {
	Destroy()
}

The transfer file description

type TransferDescriptorFd

type TransferDescriptorFd struct {
	Filename   string
	ContentUri string
	Fd         *int32
}

File descriptor with the given URI (used for the `FdResolver`)

func (TransferDescriptorFd) Destroy

func (e TransferDescriptorFd) Destroy()

type TransferDescriptorPath

type TransferDescriptorPath struct {
	Path string
}

Disk file with the given path

func (TransferDescriptorPath) Destroy

func (e TransferDescriptorPath) Destroy()

type TransferInfo

type TransferInfo struct {
	// Transfer UUID
	Id string
	// The creation time as a UNIX timestamp in milliseconds.
	CreatedAt int64
	// Peer's IP address
	Peer string
	// History of transfer states
	States []TransferState
	// The transfer type description
	Kind TransferKind
}

Transfer and files in it contain history of states that can be used to replay what happened and the last state denotes the current state of the transfer.

func (*TransferInfo) Destroy

func (r *TransferInfo) Destroy()

type TransferKind

type TransferKind interface {
	Destroy()
}

A type of the transfer

type TransferKindIncoming

type TransferKindIncoming struct {
	Paths []IncomingPath
}

The transfer is incoming, meaning we are the one who receives the files

func (TransferKindIncoming) Destroy

func (e TransferKindIncoming) Destroy()

type TransferKindOutgoing

type TransferKindOutgoing struct {
	Paths []OutgoingPath
}

The transfer is incoming, meaning we are the one who sends the files

func (TransferKindOutgoing) Destroy

func (e TransferKindOutgoing) Destroy()

type TransferState

type TransferState struct {
	// The creation time as a UNIX timestamp in milliseconds.
	CreatedAt int64
	// The type of the state change.
	Kind TransferStateKind
}

A single change in the transfer state

func (*TransferState) Destroy

func (r *TransferState) Destroy()

type TransferStateKind

type TransferStateKind interface {
	Destroy()
}

Description of the transfer state

type TransferStateKindCancel

type TransferStateKindCancel struct {
	ByPeer bool
}

The transfer was successfully canceled by either peer. Contains indicator of who canceled the transfer.

func (TransferStateKindCancel) Destroy

func (e TransferStateKindCancel) Destroy()

type TransferStateKindFailed

type TransferStateKindFailed struct {
	Status StatusCode
}

Contains status code of failure.

func (TransferStateKindFailed) Destroy

func (e TransferStateKindFailed) Destroy()

Jump to

Keyboard shortcuts

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