github.com/cookieai-jar/moby@v17.12.1-ce-rc2+incompatible/api/server/router/distribution/distribution.go (about)

     1  package distribution
     2  
     3  import "github.com/docker/docker/api/server/router"
     4  
     5  // distributionRouter is a router to talk with the registry
     6  type distributionRouter struct {
     7  	backend Backend
     8  	routes  []router.Route
     9  }
    10  
    11  // NewRouter initializes a new distribution router
    12  func NewRouter(backend Backend) router.Router {
    13  	r := &distributionRouter{
    14  		backend: backend,
    15  	}
    16  	r.initRoutes()
    17  	return r
    18  }
    19  
    20  // Routes returns the available routes
    21  func (r *distributionRouter) Routes() []router.Route {
    22  	return r.routes
    23  }
    24  
    25  // initRoutes initializes the routes in the distribution router
    26  func (r *distributionRouter) initRoutes() {
    27  	r.routes = []router.Route{
    28  		// GET
    29  		router.NewGetRoute("/distribution/{name:.*}/json", r.getDistributionInfo),
    30  	}
    31  }