Update: add config route

This commit is contained in:
Dreamacro
2018-07-15 22:23:20 +08:00
parent 0eef9bbf5d
commit 3cacfb8a7f
12 changed files with 319 additions and 77 deletions

View File

@@ -61,7 +61,7 @@ type GetProxysResponse struct {
}
func getProxys(w http.ResponseWriter, r *http.Request) {
_, rawProxys := tun.Config()
_, rawProxys := tunnel.Config()
proxys := make(map[string]interface{})
for name, proxy := range rawProxys {
proxys[name] = transformProxy(proxy)
@@ -71,7 +71,7 @@ func getProxys(w http.ResponseWriter, r *http.Request) {
func getProxy(w http.ResponseWriter, r *http.Request) {
name := chi.URLParam(r, "name")
_, proxys := tun.Config()
_, proxys := tunnel.Config()
proxy, exist := proxys[name]
if !exist {
w.WriteHeader(http.StatusNotFound)
@@ -98,7 +98,7 @@ func updateProxy(w http.ResponseWriter, r *http.Request) {
}
name := chi.URLParam(r, "name")
_, proxys := tun.Config()
_, proxys := tunnel.Config()
proxy, exist := proxys[name]
if !exist {
w.WriteHeader(http.StatusNotFound)