mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-14 05:11:17 +08:00
22 lines
380 B
Go
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)
|
|
}
|
|
}
|