configuration

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigFilePath = atomic.NewString("")

Functions

func AddProxy

func AddProxy(proxy map[string]interface{}) (string, error)

func AddRule

func AddRule(rule RuleCfg) (string, error)

func DeleteProxy

func DeleteProxy(id string) error

func DeleteRule

func DeleteRule(id string) error

func GetProxies

func GetProxies() ([]map[string]interface{}, error)

func GetProxy

func GetProxy(id string) (map[string]interface{}, error)

func GetSelectedId

func GetSelectedId(bucket string) (string, error)

func GetSelectedProxy

func GetSelectedProxy() (map[string]interface{}, error)

func SetSelectedId

func SetSelectedId(bucket, id string) error

func SetSetting

func SetSetting(data SettingCfg) error

func UpdateProxy

func UpdateProxy(id string, proxy map[string]interface{}) error

func UpdateRule

func UpdateRule(id string, rule RuleCfg) error

func Write

func Write(c Config) error

Types

type Config added in v0.1.5

type Config struct {
	Proxy    []map[string]interface{} `json:"proxy"`
	Rule     []RuleCfg                `json:"rule"`
	Selected struct {
		Proxy string `json:"proxy"`
		Rule  string `json:"rule"`
	} `json:"selected"`
	Setting SettingCfg `json:"setting"`
}

func Read

func Read() (Config, error)

type DnsItem added in v0.1.5

type DnsItem struct {
	Local  dnsRule `json:"local"`
	Remote dnsRule `json:"remote"`
}

type IpItem added in v0.1.5

type IpItem struct {
	Name         string `json:"name"`
	DefaultProxy bool   `json:"defaultProxy"`
	GeoIps       IpRule `json:"geoIps"`
	GeoSites     IpRule `json:"geoSites"`
	Subnet       IpRule `json:"subnet"`
}

type IpRule added in v0.1.5

type IpRule struct {
	Bypass []string `json:"bypass"`
	Proxy  []string `json:"proxy"`
}

type LocalServer added in v0.1.5

type LocalServer struct {
	Http struct {
		Port    int  `json:"port"`
		Enabled bool `json:"enabled"`
	} `json:"http"`
}

type RuleCfg added in v0.1.5

type RuleCfg struct {
	Id   string  `json:"id"`
	Name string  `json:"name"`
	Dns  DnsItem `json:"dns"`
	Ip   IpItem  `json:"ip"`
}

func GetRules

func GetRules() ([]RuleCfg, error)

func GetSelectedRule

func GetSelectedRule() (RuleCfg, error)

type SettingCfg added in v0.1.5

type SettingCfg struct {
	DefaultInterface string      `json:"defaultInterface"`
	TrueProxyServer  string      `json:"trueProxyServer"`
	LocalServer      LocalServer `json:"localServer"`
}

func GetSetting

func GetSetting() (SettingCfg, error)

Jump to

Keyboard shortcuts

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