configuration

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddProxies added in v0.2.1

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

func AddProxy

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

func AddRule

func AddRule(rule RuleCfg) (string, error)

func DeleteAllProxies added in v0.2.1

func DeleteAllProxies() error

func DeleteProxy

func DeleteProxy(id string) error

func DeleteRule

func DeleteRule(id string) error

func GetClasYamlUrl added in v0.2.2

func GetClasYamlUrl() (string, error)

func GetConfigFilePath added in v0.2.7

func GetConfigFilePath() (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 SetClasYamlUrl added in v0.2.2

func SetClasYamlUrl(url string) error

func SetConfigFilePath added in v0.2.2

func SetConfigFilePath(path string)

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 AutoMode added in v0.2.6

type AutoMode struct {
	Enabled bool   `json:"enabled"`
	Type    string `json:"type"`
	Url     string `json:"url"`
}

type Config added in v0.1.5

type Config struct {
	ClashYamlUrl string                   `json:"clashYamlUrl"`
	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 {
	Domains  dnsRule `json:"domains"`
	GeoSites dnsRule `json:"geoSites"`
}

type IpItem added in v0.1.5

type IpItem struct {
	DefaultProxy bool   `json:"defaultProxy"`
	GeoIps       IpRule `json:"geoIps"`
	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      `json:"localServer"`
	AutoMode         `json:"autoMode"`
	Dns              struct {
		Boost  string `json:"boost"`
		Remote string `json:"remote"`
		Local  string `json:"local"`
	} `json:"dns"`
}

func GetSetting

func GetSetting() (SettingCfg, error)

Jump to

Keyboard shortcuts

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