mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-15 13:41:23 +08:00
27 lines
492 B
Go
27 lines
492 B
Go
package route
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/metacubex/mihomo/component/resolver"
|
|
|
|
"github.com/go-chi/chi/v5"
|
|
"github.com/go-chi/render"
|
|
)
|
|
|
|
func cacheRouter() http.Handler {
|
|
r := chi.NewRouter()
|
|
r.Post("/fakeip/flush", flushFakeIPPool)
|
|
return r
|
|
}
|
|
|
|
func flushFakeIPPool(w http.ResponseWriter, r *http.Request) {
|
|
err := resolver.FlushFakeIP()
|
|
if err != nil {
|
|
render.Status(r, http.StatusBadRequest)
|
|
render.JSON(w, r, newError(err.Error()))
|
|
return
|
|
}
|
|
render.NoContent(w, r)
|
|
}
|