fix; standalone issue and add secret

This commit is contained in:
Hiddify
2024-03-18 20:38:09 +01:00
parent 3c8c2d4aa5
commit cd07df9b8f
7 changed files with 54 additions and 37 deletions

View File

@@ -73,7 +73,9 @@ func BuildConfig(opt ConfigOptions, input option.Options) (*option.Options, erro
options.Experimental = &option.ExperimentalOptions{
ClashAPI: &option.ClashAPIOptions{
ExternalController: fmt.Sprintf("%s:%d", "127.0.0.1", opt.ClashApiPort),
Secret: opt.ClashApiSecret,
},
CacheFile: &option.CacheFileOptions{
Enabled: true,
Path: "clash.db",

View File

@@ -9,6 +9,7 @@ type ConfigOptions struct {
LogLevel string `json:"log-level"`
EnableClashApi bool `json:"enable-clash-api"`
ClashApiPort uint16 `json:"clash-api-port"`
ClashApiSecret string `json:"clash-api-secret"`
GeoIPPath string `json:"geoip-path"`
GeoSitePath string `json:"geosite-path"`
Rules []Rule `json:"rules"`
@@ -117,9 +118,10 @@ func DefaultConfigOptions() *ConfigOptions {
BypassLAN: false,
AllowConnectionFromLAN: false,
},
LogLevel: "info",
LogLevel: "warn",
EnableClashApi: true,
ClashApiPort: 6756,
ClashApiSecret: "hiddify",
GeoIPPath: "geoip.db",
GeoSitePath: "geosite.db",
Rules: []Rule{},