From 376516c7afe4c618c4d8b32787fdb4377ba20262 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Fri, 13 Sep 2019 17:44:30 +0800 Subject: [PATCH] Feature: add version api --- hub/route/server.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hub/route/server.go b/hub/route/server.go index a309944e..a1bbcde9 100644 --- a/hub/route/server.go +++ b/hub/route/server.go @@ -7,6 +7,7 @@ import ( "strings" "time" + C "github.com/Dreamacro/clash/constant" "github.com/Dreamacro/clash/log" T "github.com/Dreamacro/clash/tunnel" @@ -57,6 +58,7 @@ func Start(addr string, secret string) { r.Get("/logs", getLogs) r.Get("/traffic", traffic) + r.Get("/version", version) r.Mount("/configs", configRouter()) r.Mount("/proxies", proxyRouter()) r.Mount("/rules", ruleRouter()) @@ -209,3 +211,7 @@ func getLogs(w http.ResponseWriter, r *http.Request) { } } } + +func version(w http.ResponseWriter, r *http.Request) { + render.JSON(w, r, render.M{"version": C.Version}) +}