configuration

package
v0.5.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddProxies

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

func DeleteAllProxies() error

func DeleteProxy

func DeleteProxy(id string) error

func DeleteRule

func DeleteRule(id string) error

func GetClasYamlUrl

func GetClasYamlUrl() (string, error)

func GetConfigFilePath

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

func SetClasYamlUrl(url string) error

func SetConfigFilePath

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

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

type Config

type Config struct {
	ClashYamlUrl string                   `json:"clashYamlUrl"`
	Proxy        []map[string]interface{} `json:"proxy"`
	Rules        []RuleCfg                `json:"rules"`

	Selected struct {
		Proxy string `json:"proxy"`
		Rule  string `json:"rule"`
	} `json:"selected"`
	Setting SettingCfg `json:"setting"`
}

func Read

func Read() (Config, error)

type DnsItem

type DnsItem struct {
	Domains  dnsRule `json:"domains"`
	GeoSites dnsRule `json:"geoSites"`
}

type DnsServer

type DnsServer struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

type IpItem

type IpItem struct {
	DefaultProxy bool   `json:"defaultProxy"`
	GeoIps       IpRule `json:"geoIps"`
	Subnet       IpRule `json:"subnet"`
}

type IpRule

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

type LocalServer

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

type RuleCfg

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

type SettingCfg struct {
	DefaultInterface string `json:"defaultInterface"`
	TrueProxyServer  string `json:"trueProxyServer"`
	LocalServer      `json:"localServer"`
	AutoMode         `json:"autoMode"`
	Dns              struct {
		Boost  DnsServer `json:"boost"`
		Remote DnsServer `json:"remote"`
		Local  DnsServer `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