Documentation ¶
Index ¶
- Variables
- func EasyRequest(method, route string, headers map[string]string, body map[string]interface{}) (int, []byte, error)
- func EnableConfigs(path string) error
- func EnableGeo() error
- func GetLogs(level LogLevel) (chan *Log, error)
- func GetMemory(handler func(memory *Memory) (stop bool)) error
- func GetProxies() (map[string]*Proxies, error)
- func GetTraffic(handler func(traffic *Traffic) (stop bool)) error
- func HandleStreamResp(resp *http.Response, handler func(line []byte) (stop bool))
- func IsTunEnabled(raw RawConfigs) (bool, error)
- func Request(method, route string, headers map[string]string, body io.Reader) (*http.Response, error)
- func Restart() error
- func SetConfigs(raw RawConfigs) error
- func SetSecret(secret string)
- func SetSecretFromEnv(name string) error
- func SetSecretFromFile(file string) error
- func SetSecrete(secret string)
- func SetSecreteFromEnv(name string) error
- func SetSecreteFromFile(file string) error
- func SetTunEnable(enable bool) error
- func SetURL(url string)
- func Shutdown() error
- func SwitchProxy(selector, name string) error
- func UnmarshalRequest(method, route string, headers map[string]string, body map[string]interface{}, ...) error
- type History
- type Log
- type LogLevel
- type LogMessage
- type Memory
- type Ports
- type Proxies
- type Proxy
- type ProxyDelay
- type RawConfigs
- type Rule
- type Traffic
- type Version
Constants ¶
This section is empty.
Variables ¶
View Source
var Secret = ""
View Source
var Url = "http://127.0.0.1:9090"
Functions ¶
func EasyRequest ¶
func EnableConfigs ¶ added in v0.0.2
EnableConfigs 这个接口不会影响 external-controller 和 secret 的值
func GetProxies ¶
func GetTraffic ¶
func HandleStreamResp ¶
func IsTunEnabled ¶ added in v0.0.4
func IsTunEnabled(raw RawConfigs) (bool, error)
func SetConfigs ¶ added in v0.0.2
func SetConfigs(raw RawConfigs) error
SetConfigs 更新基本配置,只传入需要修改的配置即可,传入的数据需以 json 格式传入
命令行调用示例:curl ${controller-api}/configs -X PATCH -d '{"mixed-port": 7890}' 参数示例:
raw := RawConfigs{ "port": 2333, "socks-port": 2334, }
func SetSecretFromEnv ¶ added in v0.0.2
func SetSecretFromFile ¶ added in v0.0.2
func SetSecrete ¶
func SetSecrete(secret string)
func SetSecreteFromEnv ¶
func SetSecreteFromFile ¶
func SetTunEnable ¶ added in v0.0.4
func SwitchProxy ¶
Types ¶
type LogMessage ¶
func (*LogMessage) ToLog ¶
func (msg *LogMessage) ToLog() *Log
type Ports ¶ added in v0.0.6
type Proxy ¶
type Proxy struct { History []*History `json:"history"` Name string `json:"name"` Type string `json:"type"` UDP bool `json:"udp"` }
func GetProxyMessage ¶
type ProxyDelay ¶
type ProxyDelay struct { Delay int `json:"delay"` MeanDelay int `json:"meanDelay"` Error string `json:"error"` Message string `json:"message"` }
func GetProxyDelay ¶
func GetProxyDelay(name string, url string, timeout int) (*ProxyDelay, error)
type RawConfigs ¶ added in v0.0.4
type RawConfigs map[string]interface{}
RawConfigs (map 指针)存储 GetConfigs() 获取的 Clash 配置
func GetConfigs ¶ added in v0.0.2
func GetConfigs() (RawConfigs, error)
Click to show internal directories.
Click to hide internal directories.