alkasir: github.com/alkasir/alkasir/pkg/client/internal/config Index | Files

package clientconfig

import "github.com/alkasir/alkasir/pkg/client/internal/config"

Configuration file access

This is currently the placs for the registry of blocked urls

Index

Package Files

config.go hostsfile.go updates.go util.go

func ConfigPath Uses

func ConfigPath(file ...string) string

ConfigPath returns a location for a file or path settings directory

func Update Uses

func Update(f func(conf *Config) error) error

ModifyConfig wraps a function which modifies the current configuration

func UpgradeConfig Uses

func UpgradeConfig() (bool, error)

UpgradeConfig updates the config, if needed.

func Write Uses

func Write() error

Write delegates write to everything that is persisted below this level.

type Config Uses

type Config struct {
    Settings            Settings  // main config file
    BlockedHostsCentral HostsFile // config file with all host that must be proxied which are received from the central database
    BlockedHosts        HostsFile // config file with all host that must be proxied
    DirectHosts         HostsFile // config file with all hosts that must not be proxied
    // contains filtered or unexported fields
}

Config is the central configuration holding data type. Ususally there will be one configuration instance per app instance.

func Get Uses

func Get() Config

GetConfig returns the current config

func Read Uses

func Read() (*Config, error)

ReadConfig read all app settings from available config files and/or defalts.

type HostsFile Uses

type HostsFile struct {
    Name        string
    Hosts       []string
    CountryCode string
}

HostsFile represents a text file with one url per line.

func (*HostsFile) Add Uses

func (h *HostsFile) Add(host string)

Add an entry to a HostsFile

func (*HostsFile) Read Uses

func (h *HostsFile) Read(basedir string) (err error)

Read the HostList from file

func (*HostsFile) Remove Uses

func (h *HostsFile) Remove(host string)

Remove an entry from an HostsFile

func (*HostsFile) Write Uses

func (h *HostsFile) Write(basedir string) (err error)

Write the HostList to file

type Settings Uses

type Settings struct {
    Version     int // settings version
    LastID      int // last (week numbr % 3 ) + 1 an id counter was sent.
    Local       localSettings
    Connections []shared.Connection
    Transports  map[string]shared.Transport
}

Settings is the in memory representation of the settings file which usually is loaded/saved from disk.

Package clientconfig imports 18 packages (graph) and is imported by 1 packages. Updated 2016-07-24. Refresh now. Tools for package owners.