From 9c35bc1bf253b9234c1b5871ecd14239c633ab9a Mon Sep 17 00:00:00 2001 From: Zephyruso <176294927+Zephyruso@users.noreply.github.com> Date: Sat, 23 Nov 2024 22:37:03 +0800 Subject: [PATCH] clashapi: Add mode list --- experimental/clashapi/configs.go | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/experimental/clashapi/configs.go b/experimental/clashapi/configs.go index 9d1e6109..8ae1d258 100644 --- a/experimental/clashapi/configs.go +++ b/experimental/clashapi/configs.go @@ -18,17 +18,19 @@ func configRouter(server *Server, logFactory log.Factory) http.Handler { } type configSchema struct { - Port int `json:"port"` - SocksPort int `json:"socks-port"` - RedirPort int `json:"redir-port"` - TProxyPort int `json:"tproxy-port"` - MixedPort int `json:"mixed-port"` - AllowLan bool `json:"allow-lan"` - BindAddress string `json:"bind-address"` - Mode string `json:"mode"` - LogLevel string `json:"log-level"` - IPv6 bool `json:"ipv6"` - Tun map[string]any `json:"tun"` + Port int `json:"port"` + SocksPort int `json:"socks-port"` + RedirPort int `json:"redir-port"` + TProxyPort int `json:"tproxy-port"` + MixedPort int `json:"mixed-port"` + AllowLan bool `json:"allow-lan"` + BindAddress string `json:"bind-address"` + Mode string `json:"mode"` + // sing-box added + ModeList []string `json:"mode-list"` + LogLevel string `json:"log-level"` + IPv6 bool `json:"ipv6"` + Tun map[string]any `json:"tun"` } func getConfigs(server *Server, logFactory log.Factory) func(w http.ResponseWriter, r *http.Request) { @@ -41,6 +43,7 @@ func getConfigs(server *Server, logFactory log.Factory) func(w http.ResponseWrit } render.JSON(w, r, &configSchema{ Mode: server.mode, + ModeList: server.modeList, BindAddress: "*", LogLevel: log.FormatLevel(logLevel), })