Documentation ¶
Index ¶
- Variables
- type Config
- func (c *Config) AddFilterList(list FilterList) string
- func (c *Config) AddFilterLists(lists []FilterList) error
- func (c *Config) GetCAInstalled() bool
- func (c *Config) GetFilterLists() []FilterList
- func (c *Config) GetIgnoredHosts() []string
- func (c *Config) GetMyRules() []string
- func (c *Config) GetPort() int
- func (c *Config) GetTargetTypeFilterLists(targetType FilterListType) []FilterList
- func (c *Config) GetVersion() string
- func (c *Config) RemoveFilterList(url string) string
- func (c *Config) RunMigrations()
- func (c *Config) Save() error
- func (c *Config) SetCAInstalled(caInstalled bool)
- func (c *Config) SetIgnoredHosts(hosts []string) error
- func (c *Config) SetMyRules(rules []string) error
- func (c *Config) SetPort(port int) string
- func (c *Config) ToggleFilterList(url string, enabled bool) string
- type FilterList
- type FilterListType
Constants ¶
This section is empty.
Variables ¶
var ( // ConfigDir is the path to the directory storing the application configuration. ConfigDir string // DataDir is the path to the directory storing the application data. DataDir string // Version is the current version of the application. Set at compile time for production builds using ldflags (see tasks in the /tasks/build directory). Version = "development" )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { sync.RWMutex Filter struct { FilterLists []FilterList `json:"filterLists"` MyRules []string `json:"myRules"` } `json:"filter"` Certmanager struct { CAInstalled bool `json:"caInstalled"` } `json:"certmanager"` Proxy struct { Port int `json:"port"` IgnoredHosts []string `json:"ignoredHosts"` } `json:"proxy"` // contains filtered or unexported fields }
Config stores and manages the configuration for the application. Although all fields are public, this is only for use by the JSON marshaller. All access to the Config should be done through the exported methods.
func (*Config) AddFilterList ¶
func (c *Config) AddFilterList(list FilterList) string
AddFilterList adds a new filter list to the list of enabled filter lists.
func (*Config) AddFilterLists ¶ added in v0.6.0
func (c *Config) AddFilterLists(lists []FilterList) error
func (*Config) GetCAInstalled ¶
GetCAInstalled returns whether the CA is installed.
func (*Config) GetFilterLists ¶
func (c *Config) GetFilterLists() []FilterList
GetFilterLists returns the list of enabled filter lists.
func (*Config) GetIgnoredHosts ¶
GetIgnoredHosts returns the list of ignored hosts.
func (*Config) GetMyRules ¶ added in v0.6.0
func (*Config) GetTargetTypeFilterLists ¶ added in v0.6.0
func (c *Config) GetTargetTypeFilterLists(targetType FilterListType) []FilterList
GetTargetTypeFilterLists returns the list of filter lists with particular type.
func (*Config) GetVersion ¶
func (*Config) RemoveFilterList ¶
RemoveFilterList removes a filter list from the list of enabled filter lists.
func (*Config) RunMigrations ¶
func (c *Config) RunMigrations()
RunMigrations runs the version-to-version migrations.
func (*Config) Save ¶
Save saves the config to disk. It is not thread-safe, and should only be called if the caller has a lock on the config.
func (*Config) SetCAInstalled ¶
SetCAInstalled sets whether the CA is installed.
func (*Config) SetIgnoredHosts ¶
SetIgnoredHosts sets the list of ignored hosts.
func (*Config) SetMyRules ¶ added in v0.6.0
type FilterList ¶
type FilterList struct { Name string `json:"name"` Type FilterListType `json:"type"` URL string `json:"url"` Enabled bool `json:"enabled"` }
func (*FilterList) UnmarshalJSON ¶ added in v0.6.0
func (f *FilterList) UnmarshalJSON(data []byte) error
type FilterListType ¶ added in v0.6.0
type FilterListType string
const (
FilterListTypeCustom FilterListType = "custom"
)