clash-api: Add Clash.Meta APIs

This commit is contained in:
世界
2023-04-11 16:43:45 +08:00
parent 750f87bb0a
commit 542612129d
7 changed files with 250 additions and 5 deletions

View File

@@ -109,6 +109,8 @@ func NewServer(router adapter.Router, logFactory log.ObservableFactory, options
r.Mount("/profile", profileRouter())
r.Mount("/cache", cacheRouter(router))
r.Mount("/dns", dnsRouter(router))
server.setupMetaAPI(r)
})
if options.ExternalUI != "" {
server.externalUI = C.BasePath(os.ExpandEnv(options.ExternalUI))
@@ -406,5 +408,5 @@ func getLogs(logFactory log.ObservableFactory) func(w http.ResponseWriter, r *ht
}
func version(w http.ResponseWriter, r *http.Request) {
render.JSON(w, r, render.M{"version": "sing-box " + C.Version, "premium": true})
render.JSON(w, r, render.M{"version": "sing-box " + C.Version, "premium": true, "meta": true})
}