mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-14 21:31:16 +08:00
feat: support -ext-ctl-unix
cmdline to override external controller unix address
This commit is contained in:
parent
3566542d0e
commit
a878254662
@ -21,6 +21,12 @@ func WithExternalController(externalController string) Option {
|
||||
}
|
||||
}
|
||||
|
||||
func WithExternalControllerUnix(externalControllerUnix string) Option {
|
||||
return func(cfg *config.Config) {
|
||||
cfg.General.ExternalControllerUnix = externalControllerUnix
|
||||
}
|
||||
}
|
||||
|
||||
func WithSecret(secret string) Option {
|
||||
return func(cfg *config.Config) {
|
||||
cfg.General.Secret = secret
|
||||
|
5
main.go
5
main.go
@ -30,6 +30,7 @@ var (
|
||||
configFile string
|
||||
externalUI string
|
||||
externalController string
|
||||
externalControllerUnix string
|
||||
secret string
|
||||
updateGeoMux sync.Mutex
|
||||
updatingGeo = false
|
||||
@ -40,6 +41,7 @@ func init() {
|
||||
flag.StringVar(&configFile, "f", os.Getenv("CLASH_CONFIG_FILE"), "specify configuration file")
|
||||
flag.StringVar(&externalUI, "ext-ui", os.Getenv("CLASH_OVERRIDE_EXTERNAL_UI_DIR"), "override external ui directory")
|
||||
flag.StringVar(&externalController, "ext-ctl", os.Getenv("CLASH_OVERRIDE_EXTERNAL_CONTROLLER"), "override external controller address")
|
||||
flag.StringVar(&externalControllerUnix, "ext-ctl-unix", os.Getenv("CLASH_OVERRIDE_EXTERNAL_CONTROLLER_UNIX"), "override external controller unix address")
|
||||
flag.StringVar(&secret, "secret", os.Getenv("CLASH_OVERRIDE_SECRET"), "override secret for RESTful API")
|
||||
flag.BoolVar(&geodataMode, "m", false, "set geodata mode")
|
||||
flag.BoolVar(&version, "v", false, "show current version of mihomo")
|
||||
@ -102,6 +104,9 @@ func main() {
|
||||
if externalController != "" {
|
||||
options = append(options, hub.WithExternalController(externalController))
|
||||
}
|
||||
if externalControllerUnix != "" {
|
||||
options = append(options, hub.WithExternalControllerUnix(externalControllerUnix))
|
||||
}
|
||||
if secret != "" {
|
||||
options = append(options, hub.WithSecret(secret))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user