resource

package
v1.19.33-clash.2 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: GPL-3.0 Imports: 20 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultHttpTimeout = time.Second * 20
)

Variables

View Source
var DefaultRemoteSizeLimit int64
View Source
var DeferRemoteInitialFetch bool
View Source
var ErrRemoteFetchDeferred = errors.New("remote fetch deferred to the background")

Functions

func ETag

func ETag() bool

func FirstLoadConcurrency

func FirstLoadConcurrency() int

func SetAtomicCacheDirectory

func SetAtomicCacheDirectory(directory string) error

func SetDeferredFileDirectory

func SetDeferredFileDirectory(directory string)

func SetETag

func SetETag(b bool)

func SetFirstLoadConcurrency

func SetFirstLoadConcurrency(n int)

Types

type BundleFile

type BundleFile func() (fs.File, error)

type Fetcher

type Fetcher[V any] struct {
	// contains filtered or unexported fields
}

func NewFetcher

func NewFetcher[V any](name string, interval time.Duration, vehicle P.Vehicle, bundleFile BundleFile, parser Parser[V], onUpdate func(V)) *Fetcher[V]

func (*Fetcher[V]) Close

func (f *Fetcher[V]) Close() error

func (*Fetcher[V]) Initial

func (f *Fetcher[V]) Initial() (V, error)

func (*Fetcher[V]) LoadedContentHash

func (f *Fetcher[V]) LoadedContentHash() string

func (*Fetcher[V]) Name

func (f *Fetcher[V]) Name() string

func (*Fetcher[V]) Parse

func (f *Fetcher[V]) Parse(buf []byte) (V, error)

func (*Fetcher[V]) ReadLoadedContent

func (f *Fetcher[V]) ReadLoadedContent(read func(string, time.Time))

func (*Fetcher[V]) SetUpdatedAt

func (f *Fetcher[V]) SetUpdatedAt(t time.Time)

func (*Fetcher[V]) SideUpdate

func (f *Fetcher[V]) SideUpdate(buf []byte) (V, bool, error)

func (*Fetcher[V]) Update

func (f *Fetcher[V]) Update() (V, bool, error)

func (*Fetcher[V]) UpdatedAt

func (f *Fetcher[V]) UpdatedAt() time.Time

func (*Fetcher[V]) Vehicle

func (f *Fetcher[V]) Vehicle() P.Vehicle

func (*Fetcher[V]) VehicleType

func (f *Fetcher[V]) VehicleType() P.VehicleType

type FileVehicle

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

func NewFileVehicle

func NewFileVehicle(path string) *FileVehicle

func (*FileVehicle) Path

func (f *FileVehicle) Path() string

func (*FileVehicle) Proxy

func (f *FileVehicle) Proxy() string

func (*FileVehicle) Read

func (f *FileVehicle) Read(ctx context.Context, oldHash utils.HashType) (buf []byte, hash utils.HashType, err error)

func (*FileVehicle) Type

func (f *FileVehicle) Type() P.VehicleType

func (*FileVehicle) Url

func (f *FileVehicle) Url() string

func (*FileVehicle) Write

func (f *FileVehicle) Write(buf []byte) error

type HTTPVehicle

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

func NewHTTPVehicle

func NewHTTPVehicle(url string, path string, proxy string, header http.Header, timeout time.Duration, sizeLimit int64) *HTTPVehicle

func (*HTTPVehicle) Path

func (h *HTTPVehicle) Path() string

func (*HTTPVehicle) Proxy

func (h *HTTPVehicle) Proxy() string

func (*HTTPVehicle) Read

func (h *HTTPVehicle) Read(ctx context.Context, oldHash utils.HashType) (buf []byte, hash utils.HashType, err error)

func (*HTTPVehicle) SetInRead

func (h *HTTPVehicle) SetInRead(fn func(response *http.Response))

func (*HTTPVehicle) Type

func (h *HTTPVehicle) Type() P.VehicleType

func (*HTTPVehicle) Url

func (h *HTTPVehicle) Url() string

func (*HTTPVehicle) Write

func (h *HTTPVehicle) Write(buf []byte) error

type Parser

type Parser[V any] func([]byte) (V, error)

Jump to

Keyboard shortcuts

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