provider: add store_providers cache_file option to gate subscription caching

This commit is contained in:
Shtorm
2026-09-04 05:19:05 +03:00
parent de3c7ff37e
commit 102330f968
5 changed files with 17 additions and 3 deletions
+6
View File
@@ -51,6 +51,7 @@ type CacheFile struct {
storeDNS bool
storeWARPConfig bool
storeMASQUEConfig bool
storeProviders bool
disableExpire bool
rdrcTimeout time.Duration
optimisticTimeout time.Duration
@@ -115,6 +116,7 @@ func New(ctx context.Context, logger logger.Logger, options option.CacheFileOpti
storeDNS: options.StoreDNS,
storeWARPConfig: options.StoreWARPConfig,
storeMASQUEConfig: options.StoreMASQUEConfig,
storeProviders: options.StoreProviders,
rdrcTimeout: rdrcTimeout,
saveDomain: make(map[netip.Addr]string),
saveAddress4: make(map[string]netip.Addr),
@@ -485,6 +487,10 @@ func (c *CacheFile) StoreMASQUEConfig() bool {
return c.storeMASQUEConfig
}
func (c *CacheFile) StoreProviders() bool {
return c.storeProviders
}
func (c *CacheFile) LoadWARPConfig(tag string) *adapter.SavedBinary {
var savedConfig adapter.SavedBinary
err := c.DB.View(func(t *bbolt.Tx) error {