github.com/sagernet/sing-box@v1.2.7/experimental/clashapi/cache.go (about)

     1  package clashapi
     2  
     3  import (
     4  	"net/http"
     5  
     6  	"github.com/go-chi/chi/v5"
     7  	"github.com/go-chi/render"
     8  )
     9  
    10  func cacheRouter() http.Handler {
    11  	r := chi.NewRouter()
    12  	r.Post("/fakeip/flush", flushFakeip)
    13  	return r
    14  }
    15  
    16  func flushFakeip(w http.ResponseWriter, r *http.Request) {
    17  	/*if err := cachefile.Cache().FlushFakeip(); err != nil {
    18  		render.Status(r, http.StatusInternalServerError)
    19  		render.JSON(w, r, newError(err.Error()))
    20  		return
    21  	}*/
    22  	render.NoContent(w, r)
    23  }