configuration

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 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

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

func AddProxy

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

func DeleteAllProxies

func DeleteAllProxies() error

func DeleteProxies added in v0.10.0

func DeleteProxies(ids []string) error

func GetBuiltInRules added in v0.8.1

func GetBuiltInRules(id string) ([]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 GetRuleIds added in v0.8.1

func GetRuleIds() ([]string, error)

func GetRules

func GetRules() ([]string, error)

func GetSelectedId

func GetSelectedId(bucket string) (string, error)

func GetSelectedProxy

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

func GetSelectedRule

func GetSelectedRule() (string, error)

func Reset added in v0.10.0

func Reset() error

func SetClasYamlUrl

func SetClasYamlUrl(url string) error

func SetConfigFilePath

func SetConfigFilePath(path string)

func SetRules added in v0.8.1

func SetRules(rules []string) 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 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"`
	Selected     struct {
		Proxy string `json:"proxy"`
		Rule  string `json:"rule"`
	} `json:"selected"`
	Setting SettingCfg `json:"setting"`
	Rules   []string
}

func Read

func Read() (Config, error)

type DnsServer

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

type HijackDns added in v0.6.8

type HijackDns struct {
	Enabled        bool   `json:"enabled"`
	NetworkService string `json:"networkService"`
}

type LocalServer

type LocalServer struct {
	Port     int  `json:"port"`
	AllowLan bool `json:"allowLan"`
}

type SettingCfg

type SettingCfg struct {
	Mode             string `json:"mode"`
	DefaultInterface string `json:"defaultInterface"`
	LocalServer      `json:"localServer"`
	AutoMode         `json:"autoMode"`
	HijackDns        `json:"hijackDns"`
	Dns              struct {
		Boost  DnsServer `json:"boost"`
		Remote DnsServer `json:"remote"`
		Local  DnsServer `json:"local"`
	} `json:"dns"`
	Language string `json:"language,omitempty"`
}

func GetSetting

func GetSetting() (SettingCfg, error)

Jump to

Keyboard shortcuts

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