Documentation
¶
Index ¶
- Constants
- func Due(catalog Catalog, now time.Time) []string
- func Generate(base Document, overrides map[string]any, settings config.Settings) ([]byte, error)
- func GeoResourceID(kind GeoResourceKind) (string, error)
- func GeoResourcePath(kind GeoResourceKind) (string, error)
- func ProviderResourceID(subscriptionID string, generation uint64, kind, name string) (string, error)
- func RetryDelay(failures int, minimum, maximum time.Duration) time.Duration
- func Save(path string, catalog Catalog) error
- func ValidProxyMode(mode string) bool
- func VerifyGeoDigest(kind GeoResourceKind, digest string) error
- type Catalog
- type CatalogActivation
- type Document
- type Downloader
- type DownloaderOptions
- type FetchRequest
- type FetchResult
- type Fetcher
- type GeoDownloader
- type GeoResourceKind
- type GeoResourceSpec
- type PolicyBuilder
- type PolicyError
- type PolicyInput
- type PolicyOutput
- type PolicyRequirements
- type PreparedProvider
- type PreparedProviderRefresh
- type PreparedRefresh
- type PreparedResources
- func (p *PreparedResources) Activate(ctx context.Context) (*ResourceActivation, error)
- func (p *PreparedResources) Close(ctx context.Context) error
- func (p *PreparedResources) CommitCachedOutputs(ctx context.Context) error
- func (p *PreparedResources) Identity() (string, uint64)
- func (p *PreparedResources) PolicyInput() PolicyInput
- func (p *PreparedResources) Recheck(ctx context.Context) error
- func (p *PreparedResources) StageOnboarding(ctx context.Context, update *onboarding.PreparedUpdate) error
- func (p *PreparedResources) StageSettings(ctx context.Context, path string, before, after config.Settings) error
- type Profile
- type ProviderDownloader
- type ProviderSpec
- type ProviderStore
- type PublicCatalog
- type PublicProfile
- type Receipt
- type ResourceActivation
- func (a *ResourceActivation) Committed() bool
- func (a *ResourceActivation) Finish(ctx context.Context) error
- func (a *ResourceActivation) PublishConfig(ctx context.Context, expected [32]byte) error
- func (a *ResourceActivation) PublishState(ctx context.Context) error
- func (a *ResourceActivation) Recheck(ctx context.Context) error
- func (a *ResourceActivation) Restore(ctx context.Context) error
- func (a *ResourceActivation) StoreBinding() (string, string, error)
- func (a *ResourceActivation) ValidationConfig(ctx context.Context) ([]byte, [32]byte, string, string, error)
- type ResourceGraph
- type ResourcePreparer
- func (p *ResourcePreparer) OfflineInput(ctx context.Context, input PolicyInput, graph *ResourceGraph) (PolicyInput, error)
- func (p *ResourcePreparer) Prepare(ctx context.Context, input PolicyInput, mode string, graph *ResourceGraph) (result *PreparedResources, err error)
- func (p *ResourcePreparer) PrepareOffline(ctx context.Context, input PolicyInput, graph *ResourceGraph) (*PreparedResources, error)
- func (p *ResourcePreparer) PrepareProvider(ctx context.Context, input PolicyInput, mode string, graph *ResourceGraph, ...) (*PreparedProviderRefresh, error)
- func (p *ResourcePreparer) PrepareProviderRefresh(ctx context.Context, input PolicyInput, mode string, graph *ResourceGraph, ...) (*PreparedProviderRefresh, error)
- func (p *ResourcePreparer) Recover(ctx context.Context) error
- func (p *ResourcePreparer) RecoverState(ctx context.Context) (*config.Settings, error)
- func (p *ResourcePreparer) SnapshotResources(ctx context.Context, input PolicyInput) (*ResourceGraph, error)
- type RootConfigPolicy
- type Scheduler
- type SchedulerOptions
- type Service
- func (s *Service) Add(name, rawURL, proxyMode string) (Profile, error)
- func (s *Service) CachePath(id string) string
- func (s *Service) CommitRefresh(prepared PreparedRefresh) (Receipt, error)
- func (s *Service) Mutate(mutate func(*Catalog) error) (Catalog, Catalog, error)
- func (s *Service) PrepareRefresh(ctx context.Context, id string) (PreparedRefresh, error)
- func (s *Service) ReadCache(id string) ([]byte, Document, error)
- func (s *Service) Restore(catalog Catalog) error
- func (s *Service) Rollback(receipt Receipt) error
- func (s *Service) Snapshot() Catalog
- func (s *Service) StageRefresh(ctx context.Context, resources *PreparedResources, prepared PreparedRefresh, ...) (*CatalogActivation, error)
- func (s *Service) StageUse(ctx context.Context, resources *PreparedResources, id string, ...) (*CatalogActivation, error)
- type ServiceOptions
- type UserInfo
Constants ¶
const ( ProxyModeDirect = "" // fetch the provider directly ProxyModeProxy = "proxy" // fetch only through the configured mihomo mixed-port ProxyModeAuto = "auto" // proxy first, fall back to direct on network failure )
Per-subscription proxy modes select how a refresh fetch reaches its provider. The zero value (ProxyModeDirect) is backward compatible: catalogs persisted before this field existed fetch directly, matching the old behavior.
const CatalogSchema = "mihari.subscriptions/v1"
const RootPolicyID = "mihari.root-config/v1/mihomo-v1.19.30"
RootPolicyID identifies the immutable configuration semantics for the supported core.
Variables ¶
This section is empty.
Functions ¶
func GeoResourceID ¶
func GeoResourceID(kind GeoResourceKind) (string, error)
GeoResourceID returns a reserved key outside the provider SHA256 namespace.
func GeoResourcePath ¶ added in v0.9.3
func GeoResourcePath(kind GeoResourceKind) (string, error)
GeoResourcePath returns the only permitted core-home relative asset basename.
func ProviderResourceID ¶ added in v0.9.3
func ProviderResourceID(subscriptionID string, generation uint64, kind, name string) (string, error)
ProviderResourceID returns the versioned identity hash used for every provider source kind. Names remain data and never become filesystem components.
func ValidProxyMode ¶ added in v0.4.0
ValidProxyMode reports whether mode is a recognized per-subscription proxy mode.
func VerifyGeoDigest ¶ added in v0.9.3
func VerifyGeoDigest(kind GeoResourceKind, digest string) error
These fixed identities were approved from the retained artifact catalog. Country/ASN preserve the existing release lock. DAT orphan commits may become unavailable; failure retains old resources and never selects a mutable fallback. VerifyGeoDigest checks a digest against the compiled Geo artifact catalog.
Types ¶
type Catalog ¶
type Catalog struct {
Schema string `yaml:"schema"`
GlobalInterval string `yaml:"global-interval"`
ActiveID string `yaml:"active-id,omitempty"`
Profiles []Profile `yaml:"profiles,omitempty"`
}
func Load ¶
Catalog loading pipeline (Load) runs these stages after decode:
migrate — forward schema migrations (no-op for current schema);
extension point for future vN→vN+1 reshapes.
Normalize — validates schema and fields, repairs invariants. Reports
errors; does NOT fill defaults.
fillDefaults — fills zero values with intended defaults. Pure filling,
never validates. Runs last so cleared values get a default.
Contract: any caller that Normalize()s an in-memory catalog (Load, Save, service.Mutate, service.CommitRefresh) MUST follow with fillDefaults(). Add new "zero ≠ default" fields to fillDefaults; keep Normalize about validation and invariant repair only.
func LoadOrCreate ¶
func (Catalog) EffectiveInterval ¶
func (Catalog) Public ¶
func (c Catalog) Public() PublicCatalog
type CatalogActivation ¶
type CatalogActivation struct {
// contains filtered or unexported fields
}
CatalogActivation carries only a service-owned before/after catalog and the staged data-root participants. Publish updates memory after WAL completion.
func (*CatalogActivation) Cancel ¶
func (a *CatalogActivation) Cancel()
Cancel releases the participant reservation only after the shared WAL has restored disk, or before that WAL began. It never performs its own writes.
func (*CatalogActivation) Publish ¶
func (a *CatalogActivation) Publish() Catalog
Publish installs the committed catalog in memory without another disk write.
func (*CatalogActivation) Recheck ¶
func (a *CatalogActivation) Recheck() error
Recheck rejects changes to the captured catalog before durable completion.
type Document ¶
func ParseDocument ¶
type Downloader ¶
type Downloader struct {
MaxBytes int64
// contains filtered or unexported fields
}
Downloader fetches subscription documents over HTTP. The direct client is always present; the proxy client is optional and backs proxy/auto modes.
func NewDownloader ¶
func NewDownloader(opts DownloaderOptions) *Downloader
func (*Downloader) Download ¶
func (d *Downloader) Download(ctx context.Context, spec ProviderSpec, mode string) ([]byte, error)
Download retrieves a provider source with its managed limits and headers.
func (*Downloader) DownloadGeo ¶
func (d *Downloader) DownloadGeo(ctx context.Context, kind GeoResourceKind, mode string) ([]byte, error)
DownloadGeo retrieves a pinned Geo artifact with a separate 128 MiB budget.
func (*Downloader) Fetch ¶
func (d *Downloader) Fetch(ctx context.Context, input FetchRequest) (FetchResult, error)
type DownloaderOptions ¶ added in v0.4.0
DownloaderOptions configures a Downloader. Client is the direct transport; a default 30s client is used when nil. ProxyURL enables proxy/auto modes by routing fetches through the mihomo mixed-port.
type FetchRequest ¶
type FetchResult ¶
type FetchResult struct {
Content []byte
ETag string
LastModified string
// Userinfo is the raw subscription-userinfo response header when present.
Userinfo string
NotModified bool
// FellBack is true when the result came from a non-preferred client: in auto
// mode the proxy failed at the network layer and the direct client succeeded.
FellBack bool
}
type Fetcher ¶
type Fetcher interface {
Fetch(context.Context, FetchRequest) (FetchResult, error)
}
type GeoDownloader ¶
type GeoDownloader interface {
DownloadGeo(context.Context, GeoResourceKind, string) ([]byte, error)
}
GeoDownloader retrieves one compiled kind; the preparer independently verifies its digest.
type GeoResourceKind ¶ added in v0.9.3
type GeoResourceKind string
GeoResourceKind selects one compiled global Geo asset; it is never a path.
const ( // GeoCountryMMDB contains country address classification data. GeoCountryMMDB GeoResourceKind = "country-mmdb" // GeoASNMMDB contains autonomous system address classification data. GeoASNMMDB GeoResourceKind = "asn-mmdb" // GeoIPDAT contains named IP category lists used in geodata mode. GeoIPDAT GeoResourceKind = "geoip-dat" // GeoSiteDAT contains named domain category lists and attributes. GeoSiteDAT GeoResourceKind = "geosite-dat" )
type GeoResourceSpec ¶
type GeoResourceSpec struct {
Kind GeoResourceKind
SHA256 string
Bytes []byte
}
GeoResourceSpec contains validated bytes copied for one fixed core-home asset. SHA256 records the digest of Bytes; trusted source authentication belongs to T08.
type PolicyBuilder ¶
type PolicyBuilder interface {
Build(context.Context, PolicyInput) (PolicyOutput, error)
}
PolicyBuilder validates raw candidate bytes and prepares managed resources.
type PolicyError ¶
PolicyError reports a registered field path without disclosing candidate values.
func (PolicyError) Error ¶
func (e PolicyError) Error() string
type PolicyInput ¶
type PolicyInput struct {
YAML []byte
SubscriptionID string
Generation uint64
CoreTag, OS, Arch string
Settings config.Settings
Resources map[string][]byte
}
PolicyInput contains a subscription candidate and already verified resource bytes. Resources uses target/source provider IDs or compiled GeoResourceID keys, never local filesystem paths. Source authentication belongs to the caller; Build and Inspect independently validate every supplied resource's structure.
type PolicyOutput ¶
type PolicyOutput struct {
YAML []byte
Providers []ProviderSpec
Geo []GeoResourceSpec
}
PolicyOutput contains freshly generated core YAML and validated provider resources.
func GenerateWithPolicy ¶
func GenerateWithPolicy(ctx context.Context, input PolicyInput, builder PolicyBuilder) (PolicyOutput, error)
GenerateWithPolicy is the opt-in root generation boundary. Legacy Generate remains the default until system-mode wiring is installed separately.
type PolicyRequirements ¶
type PolicyRequirements struct {
Providers []ProviderSpec
Geo []GeoResourceKind
}
PolicyRequirements describes resources needed before producing executable YAML.
type PreparedProvider ¶
type PreparedProvider struct {
// contains filtered or unexported fields
}
PreparedProvider binds validated bytes to the exact previous resource object.
type PreparedProviderRefresh ¶
type PreparedProviderRefresh struct {
// contains filtered or unexported fields
}
PreparedProviderRefresh owns one unpublished provider candidate after the complete current configuration and every retained resource were validated.
func (*PreparedProviderRefresh) Close ¶
func (p *PreparedProviderRefresh) Close(ctx context.Context) error
type PreparedRefresh ¶
type PreparedRefresh struct {
// contains filtered or unexported fields
}
func (PreparedRefresh) AdvancesGeneration ¶ added in v0.9.3
func (p PreparedRefresh) AdvancesGeneration() bool
func (PreparedRefresh) Document ¶
func (p PreparedRefresh) Document() Document
func (PreparedRefresh) ProfileID ¶
func (p PreparedRefresh) ProfileID() string
type PreparedResources ¶
type PreparedResources struct {
// contains filtered or unexported fields
}
PreparedResources owns unpublished private candidates and their complete policy result.
func (*PreparedResources) Activate ¶
func (p *PreparedResources) Activate(ctx context.Context) (*ResourceActivation, error)
Activate atomically owns the prepared set and journals every old/new rename. No running core or validator may use H until Finish or Restore converges.
func (*PreparedResources) Close ¶
func (p *PreparedResources) Close(ctx context.Context) error
Close removes only owned, unpublished candidate files. Recovery journals take precedence and retain their objects until recovery finishes.
func (*PreparedResources) CommitCachedOutputs ¶
func (p *PreparedResources) CommitCachedOutputs(ctx context.Context) error
CommitCachedOutputs publishes identity-specific provider files and missing Geo objects without replacing the live runtime configuration.
func (*PreparedResources) Identity ¶
func (p *PreparedResources) Identity() (string, uint64)
Identity returns the immutable subscription identity without copying the potentially large prepared resource byte graph.
func (*PreparedResources) PolicyInput ¶
func (p *PreparedResources) PolicyInput() PolicyInput
PolicyInput returns a deep resource snapshot for the immutable policy's final Manager-side Build. It conveys bytes, not write authority or mutable handles.
func (*PreparedResources) Recheck ¶
func (p *PreparedResources) Recheck(ctx context.Context) error
Recheck verifies all authorized source objects and privately staged targets. Manager must also recheck active ID/generation/configGeneration under mutation.
func (*PreparedResources) StageOnboarding ¶
func (p *PreparedResources) StageOnboarding(ctx context.Context, update *onboarding.PreparedUpdate) error
StageOnboarding includes the service-owned completion update in the WAL.
func (*PreparedResources) StageSettings ¶
func (p *PreparedResources) StageSettings(ctx context.Context, path string, before, after config.Settings) error
StageSettings binds the exact pre-update settings and candidate to this data root. A stale settings candidate cannot be resealed against newer disk state.
type Profile ¶
type Profile struct {
ID string `yaml:"id"`
Name string `yaml:"name"`
URL string `yaml:"url"`
Enabled bool `yaml:"enabled"`
AutoRefresh bool `yaml:"auto-refresh"`
Interval string `yaml:"interval,omitempty"`
// ProxyMode controls how refresh fetches reach this provider. Empty = direct.
ProxyMode string `yaml:"proxy-mode,omitempty"`
Version uint64 `yaml:"version,omitempty"`
Generation uint64 `yaml:"generation,omitempty"`
UpdatedAt time.Time `yaml:"updated-at,omitempty"`
ETag string `yaml:"etag,omitempty"`
LastModified string `yaml:"last-modified,omitempty"`
LastError string `yaml:"last-error,omitempty"`
// Traffic quota from subscription-userinfo (bytes). Zero means unknown.
Upload int64 `yaml:"upload,omitempty"`
Download int64 `yaml:"download,omitempty"`
Total int64 `yaml:"total,omitempty"`
Expire int64 `yaml:"expire,omitempty"` // unix seconds
}
type ProviderDownloader ¶
type ProviderDownloader interface {
Download(context.Context, ProviderSpec, string) ([]byte, error)
}
ProviderDownloader retrieves a typed source through the subscription transport policy.
type ProviderSpec ¶
type ProviderSpec struct {
SubscriptionID string
Generation uint64
Kind, Name, Format, Behavior, URL, ResourceID string
SourceResourceID string
Interval time.Duration
Inline []byte
Header map[string][]string
MaxBytes int64
}
ProviderSpec carries a validated provider source to the daemon-owned lifecycle. Inline holds generated, validated bytes for all source kinds.
type ProviderStore ¶ added in v0.9.3
type ProviderStore struct {
// contains filtered or unexported fields
}
ProviderStore holds daemon-owned fixed provider files and their recovery journal. Its only production constructor borrows a trusted Unix data root.
func NewProviderStore ¶ added in v0.9.3
func NewProviderStore(ctx context.Context, data *platform.TrustedRoot) (*ProviderStore, error)
NewProviderStore borrows a root-owned private D capability. The daemon or installer retains its lifecycle lease and D until all resource users close. Recover must finish before any core recovery, validation or execution.
func (*ProviderStore) Prepare ¶
func (s *ProviderStore) Prepare(ctx context.Context, spec ProviderSpec) (*PreparedProvider, error)
Prepare stages policy-generated bytes privately, retaining the prior identity.
func (*ProviderStore) Recover ¶ added in v0.9.3
func (s *ProviderStore) Recover(ctx context.Context) error
Recover restores unfinished replacements before workers, core recovery or execution. A durable done record accepts only the reloaded new file.
func (*ProviderStore) SnapshotResources ¶
func (s *ProviderStore) SnapshotResources(ctx context.Context, current PolicyInput) (*ResourceGraph, error)
SnapshotResources validates current daemon-owned cached definitions and their exact target files. Source IDs in a new candidate confer no authority; only this sealed graph can authorize reuse. The caller owns the current config snapshot and must recheck its subscription identity/generation at commit.
type PublicCatalog ¶
type PublicCatalog struct {
ActiveID string `json:"active_id,omitempty"`
GlobalInterval string `json:"global_interval"`
Profiles []PublicProfile `json:"profiles"`
}
type PublicProfile ¶
type PublicProfile struct {
ID string `json:"id"`
Name string `json:"name"`
Enabled bool `json:"enabled"`
AutoRefresh bool `json:"auto_refresh"`
Interval string `json:"interval"`
Cached bool `json:"cached"`
Generation uint64 `json:"generation"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
LastError string `json:"last_error,omitempty"`
// Traffic from subscription-userinfo (bytes). Omitted when unknown.
Upload int64 `json:"upload,omitempty"`
Download int64 `json:"download,omitempty"`
Total int64 `json:"total,omitempty"`
Expire int64 `json:"expire,omitempty"`
// ProxyMode is the per-subscription refresh transport (direct/proxy/auto).
ProxyMode string `json:"proxy_mode,omitempty"`
}
type ResourceActivation ¶
type ResourceActivation struct {
// contains filtered or unexported fields
}
ResourceActivation retains the whole fixed-resource rollback set. Its caller owns stopped-core execution and Manager activation ownership until settlement. The store gate is acquired only for short filesystem operations, never -t.
func (*ResourceActivation) Committed ¶
func (a *ResourceActivation) Committed() bool
Committed reports irreversible new-set authority, including cleanup failures.
func (*ResourceActivation) Finish ¶
func (a *ResourceActivation) Finish(ctx context.Context) error
Finish makes the whole new set authoritative only after config publication. A durable done is irreversible: ambiguous cleanup retains new authority.
func (*ResourceActivation) PublishConfig ¶
func (a *ResourceActivation) PublishConfig(ctx context.Context, expected [32]byte) error
PublishConfig publishes only the policy-generated final WAL entry. Core calls this after validating the exact hash under its execution capability.
func (*ResourceActivation) PublishState ¶
func (a *ResourceActivation) PublishState(ctx context.Context) error
PublishState swaps only the sealed daemon state participants, after the generated configuration has been validated and published. Memory publication must wait for Finish and its durable done authority.
func (*ResourceActivation) Recheck ¶
func (a *ResourceActivation) Recheck(ctx context.Context) error
Recheck confirms the exact swapped objects before config publication.
func (*ResourceActivation) Restore ¶
func (a *ResourceActivation) Restore(ctx context.Context) error
Restore ignores caller cancellation once rollback ownership is accepted.
func (*ResourceActivation) StoreBinding ¶
func (a *ResourceActivation) StoreBinding() (string, string, error)
StoreBinding identifies the sealed data root that owns this activation. It conveys no path operation or callback authority.
func (*ResourceActivation) ValidationConfig ¶
func (a *ResourceActivation) ValidationConfig(ctx context.Context) ([]byte, [32]byte, string, string, error)
ValidationConfig returns a copy of the policy-generated bytes and their fixed data-root binding. Core uses this typed activation to validate the exact candidate against the already-swapped fixed resource home.
type ResourceGraph ¶
type ResourceGraph struct {
// contains filtered or unexported fields
}
ResourceGraph is an immutable authorization snapshot of the current private resource graph. It is made from daemon-owned source definitions, never from a public candidate.
type ResourcePreparer ¶
type ResourcePreparer struct {
// contains filtered or unexported fields
}
ResourcePreparer closes the provider and Geo graph before producing config. Constructors cannot replace the compiled Geo catalog or source authorization.
func NewResourcePreparer ¶
func NewResourcePreparer(store *ProviderStore, providers ProviderDownloader, geo GeoDownloader) *ResourcePreparer
NewResourcePreparer creates the managed resource boundary. Callers retain store lifetime.
func (*ResourcePreparer) OfflineInput ¶
func (p *ResourcePreparer) OfflineInput(ctx context.Context, input PolicyInput, graph *ResourceGraph) (PolicyInput, error)
PrepareOffline reconstructs a complete resource candidate from the sealed current cache without performing network IO.
func (*ResourcePreparer) Prepare ¶
func (p *ResourcePreparer) Prepare(ctx context.Context, input PolicyInput, mode string, graph *ResourceGraph) (result *PreparedResources, err error)
Prepare resolves a candidate through Inspect, managed fetch/import, Geo closure and Build outside Manager mutation. Supplied PolicyInput.Resources is rejected: source authentication cannot be replaced by caller-provided byte maps.
func (*ResourcePreparer) PrepareOffline ¶
func (p *ResourcePreparer) PrepareOffline(ctx context.Context, input PolicyInput, graph *ResourceGraph) (*PreparedResources, error)
func (*ResourcePreparer) PrepareProvider ¶
func (p *ResourcePreparer) PrepareProvider(ctx context.Context, input PolicyInput, mode string, graph *ResourceGraph, kind, name string) (*PreparedProviderRefresh, error)
PrepareProvider prepares one proxy or rule provider while validating the complete retained resource graph.
func (*ResourcePreparer) PrepareProviderRefresh ¶
func (p *ResourcePreparer) PrepareProviderRefresh(ctx context.Context, input PolicyInput, mode string, graph *ResourceGraph, name string) (*PreparedProviderRefresh, error)
PrepareProviderRefresh refreshes one registered rule provider while using the sealed graph for every retained provider and Geo resource.
func (*ResourcePreparer) Recover ¶
func (p *ResourcePreparer) Recover(ctx context.Context) error
Recover converges provider and whole-resource journals before any core IO.
func (*ResourcePreparer) RecoverState ¶
RecoverState settles the whole WAL before stores load. A pending settings participant invalidates any settings value loaded by an upstream caller.
func (*ResourcePreparer) SnapshotResources ¶
func (p *ResourcePreparer) SnapshotResources(ctx context.Context, input PolicyInput) (*ResourceGraph, error)
SnapshotResources seals the daemon-owned current cached graph.
type RootConfigPolicy ¶
type RootConfigPolicy struct{}
RootConfigPolicy constructs candidates using the compiled, versioned field registry.
func NewRootConfigPolicy ¶
func NewRootConfigPolicy() *RootConfigPolicy
NewRootConfigPolicy constructs an immutable configuration policy.
func (*RootConfigPolicy) Build ¶
func (p *RootConfigPolicy) Build(ctx context.Context, input PolicyInput) (PolicyOutput, error)
Build validates the complete candidate before emitting a fresh configuration.
func (*RootConfigPolicy) Inspect ¶
func (p *RootConfigPolicy) Inspect(ctx context.Context, input PolicyInput) (PolicyRequirements, error)
Inspect validates a candidate and discovers resources without executable YAML.
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
func NewScheduler ¶
func NewScheduler(options SchedulerOptions) *Scheduler
type SchedulerOptions ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func Open ¶
func Open(options ServiceOptions) (*Service, error)
func (*Service) CommitRefresh ¶
func (s *Service) CommitRefresh(prepared PreparedRefresh) (Receipt, error)
func (*Service) PrepareRefresh ¶
func (*Service) StageRefresh ¶
func (s *Service) StageRefresh(ctx context.Context, resources *PreparedResources, prepared PreparedRefresh, id string, generation uint64) (*CatalogActivation, error)
StageRefresh seals the source cache and catalog into the same resource WAL.
func (*Service) StageUse ¶
func (s *Service) StageUse(ctx context.Context, resources *PreparedResources, id string, generation uint64) (*CatalogActivation, error)
StageUse prepares catalog activation without publishing disk or memory.
type ServiceOptions ¶
type UserInfo ¶
type UserInfo struct {
Upload int64
Download int64
Total int64
Expire int64 // unix seconds; 0 if unknown
}
UserInfo is traffic/quota metadata from a provider's subscription-userinfo header. Values are bytes unless noted.
func ParseUserInfo ¶
ParseUserInfo parses headers like:
upload=123; download=456; total=789; expire=1710000000
Source Files
¶
- catalog.go
- document.go
- downloader.go
- generator.go
- model.go
- provider.go
- provider_geo_catalog.go
- provider_journal.go
- provider_resources.go
- provider_store_linux.go
- provider_store_unix.go
- resource_activation.go
- resource_state.go
- rootpolicy.go
- rootpolicy_awg.go
- rootpolicy_decode.go
- rootpolicy_dns.go
- rootpolicy_dns_graph.go
- rootpolicy_geo.go
- rootpolicy_geo_prepare.go
- rootpolicy_groups.go
- rootpolicy_hosts.go
- rootpolicy_hysteria.go
- rootpolicy_hysteria2.go
- rootpolicy_ipstack.go
- rootpolicy_logic.go
- rootpolicy_managed.go
- rootpolicy_masque.go
- rootpolicy_mieru.go
- rootpolicy_mmdb.go
- rootpolicy_mux.go
- rootpolicy_openvpn.go
- rootpolicy_provider.go
- rootpolicy_provider_bytes.go
- rootpolicy_provider_override.go
- rootpolicy_provider_prepare.go
- rootpolicy_proxies.go
- rootpolicy_proxygraph.go
- rootpolicy_proxygraph_members.go
- rootpolicy_quic.go
- rootpolicy_registry.go
- rootpolicy_resourcegraph.go
- rootpolicy_resources.go
- rootpolicy_rulegraph.go
- rootpolicy_ruleprovider.go
- rootpolicy_rules.go
- rootpolicy_security.go
- rootpolicy_shadowsocks.go
- rootpolicy_snell.go
- rootpolicy_sniffer.go
- rootpolicy_ss.go
- rootpolicy_ssh.go
- rootpolicy_sudoku.go
- rootpolicy_tls.go
- rootpolicy_tlsmirror.go
- rootpolicy_transports.go
- rootpolicy_vless.go
- rootpolicy_vmess.go
- rootpolicy_wire.go
- rootpolicy_wireguard.go
- rootpolicy_xhttp.go
- scheduler.go
- service.go
- userinfo.go