github.com/kelleygo/clashcore@v1.0.2/hub/route/external.go (about) 1 package route 2 3 import "github.com/go-chi/chi/v5" 4 5 type externalRouter func(r chi.Router) 6 7 var externalRouters = make([]externalRouter, 0) 8 9 func Register(route ...externalRouter) { 10 externalRouters = append(externalRouters, route...) 11 } 12 13 func addExternalRouters(r chi.Router) { 14 if len(externalRouters) == 0 { 15 return 16 } 17 18 for _, caller := range externalRouters { 19 caller(r) 20 } 21 }