2014-12-15 20:42:52 +00:00
|
|
|
package v2
|
|
|
|
|
|
|
|
import "regexp"
|
|
|
|
|
|
|
|
// This file defines regular expressions for use in route definition. These
|
|
|
|
// are also defined in the registry code base. Until they are in a common,
|
|
|
|
// shared location, and exported, they must be repeated here.
|
|
|
|
|
|
|
|
// RepositoryNameComponentRegexp restricts registtry path components names to
|
|
|
|
// start with at least two letters or numbers, with following parts able to
|
|
|
|
// separated by one period, dash or underscore.
|
|
|
|
var RepositoryNameComponentRegexp = regexp.MustCompile(`[a-z0-9]+(?:[._-][a-z0-9]+)*`)
|
|
|
|
|
2015-01-28 22:44:09 +00:00
|
|
|
// RepositoryNameRegexp builds on RepositoryNameComponentRegexp to allow 1 to
|
2014-12-15 20:42:52 +00:00
|
|
|
// 5 path components, separated by a forward slash.
|
2015-01-28 22:44:09 +00:00
|
|
|
var RepositoryNameRegexp = regexp.MustCompile(`(?:` + RepositoryNameComponentRegexp.String() + `/){0,4}` + RepositoryNameComponentRegexp.String())
|
2014-12-15 20:42:52 +00:00
|
|
|
|
|
|
|
// TagNameRegexp matches valid tag names. From docker/docker:graph/tags.go.
|
|
|
|
var TagNameRegexp = regexp.MustCompile(`[\w][\w.-]{0,127}`)
|
2015-02-27 02:23:50 +00:00
|
|
|
|
|
|
|
// DigestRegexp matches valid digest types.
|
|
|
|
var DigestRegexp = regexp.MustCompile(`[a-zA-Z0-9-_+.]+:[a-zA-Z0-9-_+.=]+`)
|