mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
4f0d95fa6e
Signed-off-by: Daniel Nephin <dnephin@docker.com>
31 lines
799 B
Go
31 lines
799 B
Go
package distribution // import "github.com/docker/docker/api/server/router/distribution"
|
|
|
|
import "github.com/docker/docker/api/server/router"
|
|
|
|
// distributionRouter is a router to talk with the registry
|
|
type distributionRouter struct {
|
|
backend Backend
|
|
routes []router.Route
|
|
}
|
|
|
|
// NewRouter initializes a new distribution router
|
|
func NewRouter(backend Backend) router.Router {
|
|
r := &distributionRouter{
|
|
backend: backend,
|
|
}
|
|
r.initRoutes()
|
|
return r
|
|
}
|
|
|
|
// Routes returns the available routes
|
|
func (r *distributionRouter) Routes() []router.Route {
|
|
return r.routes
|
|
}
|
|
|
|
// initRoutes initializes the routes in the distribution router
|
|
func (r *distributionRouter) initRoutes() {
|
|
r.routes = []router.Route{
|
|
// GET
|
|
router.NewGetRoute("/distribution/{name:.*}/json", r.getDistributionInfo),
|
|
}
|
|
}
|