forwarder

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidMode = fmt.Errorf("not a valid Mode, try [%s]", strings.Join(_ModeNames, ", "))

Functions

func ModeNames

func ModeNames() []string

ModeNames returns a list of possible string values of Mode.

Types

type Elem

type Elem interface {
	Mode() Mode

	From() peers.Peer
	Msg() *tg.Message
	To() peers.Peer
	Thread() int // reply to message/topic

	AsSilent() bool
	AsDryRun() bool
	AsGrouped() bool // detect and forward grouped messages
}

type Forwarder

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

func New

func New(opts Options) *Forwarder

func (*Forwarder) Forward

func (f *Forwarder) Forward(ctx context.Context) error

type Iter

type Iter interface {
	Next(ctx context.Context) bool
	Value() Elem
	Err() error
}

type Mode

type Mode int

Mode ENUM(direct, clone)

const (
	// ModeDirect is a Mode of type Direct.
	ModeDirect Mode = iota
	// ModeClone is a Mode of type Clone.
	ModeClone
)

func ModeValues

func ModeValues() []Mode

ModeValues returns a list of the values for Mode

func ParseMode

func ParseMode(name string) (Mode, error)

ParseMode attempts to convert a string to a Mode.

func (*Mode) Get

func (x *Mode) Get() interface{}

Get implements the Golang flag.Getter interface func.

func (Mode) IsValid

func (x Mode) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (*Mode) Set

func (x *Mode) Set(val string) error

Set implements the Golang flag.Value interface func.

func (Mode) String

func (x Mode) String() string

String implements the Stringer interface.

func (*Mode) Type

func (x *Mode) Type() string

Type implements the github.com/spf13/pFlag Value interface.

type Options

type Options struct {
	Pool     dcpool.Pool
	PartSize int
	Threads  int
	Iter     Iter
	Progress Progress
}

type Progress

type Progress interface {
	OnAdd(elem Elem)
	ProgressClone
	OnDone(elem Elem, err error)
}

type ProgressClone added in v0.13.3

type ProgressClone interface {
	OnClone(elem Elem, state ProgressState)
}

type ProgressState

type ProgressState struct {
	Done  int64
	Total int64
}

Jump to

Keyboard shortcuts

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