mirror of
https://github.com/moby/moby.git
synced 2025-08-08 13:22:22 +03:00
Network remote APIs using new router, --net=<user-defined-network> changes
* Moving Network Remote APIs out of experimental * --net can now accept user created networks using network drivers/plugins * Removed the experimental services concept and --default-network option * Neccessary backend changes to accomodate multiple networks per container * Integration Tests Signed-off-by: David Calavera <david.calavera@gmail.com> Signed-off-by: Madhu Venugopal <madhu@docker.com>
This commit is contained in:
@@ -19,6 +19,10 @@ import (
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// versionMatcher defines a variable matcher to be parsed by the router
|
||||
// when a request is about to be served.
|
||||
const versionMatcher = "/v{version:[0-9.]+}"
|
||||
|
||||
// Config provides the configuration for the API server
|
||||
type Config struct {
|
||||
Logging bool
|
||||
@@ -177,10 +181,13 @@ func (s *Server) CreateMux() *mux.Router {
|
||||
}
|
||||
|
||||
logrus.Debugf("Registering routers")
|
||||
for _, router := range s.routers {
|
||||
for _, r := range router.Routes() {
|
||||
for _, apiRouter := range s.routers {
|
||||
for _, r := range apiRouter.Routes() {
|
||||
f := s.makeHTTPHandler(r.Handler())
|
||||
r.Register(m, f)
|
||||
|
||||
logrus.Debugf("Registering %s, %s", r.Method(), r.Path())
|
||||
m.Path(versionMatcher + r.Path()).Methods(r.Method()).Handler(f)
|
||||
m.Path(r.Path()).Methods(r.Method()).Handler(f)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user