subscription

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UpdateSubscription

func UpdateSubscription(subscription *xsqlite.Subscription, db *gorm.DB, downloader downloader) (int, []string, error)

return success parsed nodes, failed parsed nodes, error error means cannot get data from server

Types

type FetchSubscriptionResult added in v1.2.1

type FetchSubscriptionResult struct {
	Configs     []*outbound.OutboundHandlerConfig
	FailedNodes []string
	Description string
}

func FetchSubscription added in v1.2.1

func FetchSubscription(ctx context.Context, link string, downloader downloader) (*FetchSubscriptionResult, error)

type SubscriptionManager

type SubscriptionManager struct {
	Running           bool
	Timer             *time.Timer
	Interval          time.Duration
	Downloader        downloader
	Db                *gorm.DB
	OnUpdatedCallback func()
	AutoUpdate        bool
}

func NewSubscriptionManager

func NewSubscriptionManager(config *SubscriptionManagerConfig) *SubscriptionManager

func (*SubscriptionManager) Close

func (s *SubscriptionManager) Close() error

func (*SubscriptionManager) GetLastUpdate

func (s *SubscriptionManager) GetLastUpdate() time.Time

func (*SubscriptionManager) SetAutoUpdate

func (s *SubscriptionManager) SetAutoUpdate(autoUpdate bool)

func (*SubscriptionManager) SetInterval

func (s *SubscriptionManager) SetInterval(interval time.Duration)

just set interval, not start or stop

func (*SubscriptionManager) Start

func (s *SubscriptionManager) Start() error

func (*SubscriptionManager) UpdateSubscriptions

func (s *SubscriptionManager) UpdateSubscriptions() error

type SubscriptionManagerConfig added in v1.2.1

type SubscriptionManagerConfig struct {
	Interval          time.Duration
	Db                *gorm.DB
	Downloader        downloader
	OnUpdatedCallback func()
	AutoUpdate        bool
}

type SubscriptionOption

type SubscriptionOption func(*SubscriptionManager)

type UpdateSubscriptionResult

type UpdateSubscriptionResult struct {
	SuccessSub   int
	SuccessNodes int
	FailedSub    int
	FailedNodes  []string
	ErrorReasons map[string]string
}

func UpdateSubscriptions

func UpdateSubscriptions(db *gorm.DB, downloader downloader) UpdateSubscriptionResult

Jump to

Keyboard shortcuts

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