Clash.Meta/hub/route/external.go
2023-12-03 09:39:34 +08:00

22 lines
380 B
Go

package route
import "github.com/go-chi/chi/v5"
type externalRouter func(r chi.Router)
var externalRouters = make([]externalRouter, 0)
func Register(route ...externalRouter) {
externalRouters = append(externalRouters, route...)
}
func addExternalRouters(r chi.Router) {
if len(externalRouters) == 0 {
return
}
for _, caller := range externalRouters {
caller(r)
}
}