├── Godeps ├── _workspace │ ├── .gitignore │ └── src │ │ ├── github.com │ │ ├── Sirupsen │ │ │ └── logrus │ │ │ │ ├── .gitignore │ │ │ │ ├── .travis.yml │ │ │ │ ├── terminal_openbsd.go │ │ │ │ ├── CHANGELOG.md │ │ │ │ ├── terminal_linux.go │ │ │ │ ├── terminal_darwin.go │ │ │ │ ├── terminal_freebsd.go │ │ │ │ ├── hooks │ │ │ │ ├── syslog │ │ │ │ │ ├── README.md │ │ │ │ │ ├── syslog_test.go │ │ │ │ │ └── syslog.go │ │ │ │ ├── papertrail │ │ │ │ │ ├── papertrail_test.go │ │ │ │ │ ├── papertrail.go │ │ │ │ │ └── README.md │ │ │ │ ├── airbrake │ │ │ │ │ └── airbrake.go │ │ │ │ └── bugsnag │ │ │ │ │ └── bugsnag_test.go │ │ │ │ ├── terminal_notwindows.go │ │ │ │ ├── writer.go │ │ │ │ ├── terminal_windows.go │ │ │ │ ├── examples │ │ │ │ ├── hook │ │ │ │ │ └── hook.go │ │ │ │ └── basic │ │ │ │ │ └── basic.go │ │ │ │ ├── json_formatter.go │ │ │ │ ├── LICENSE │ │ │ │ ├── hooks.go │ │ │ │ ├── entry_test.go │ │ │ │ ├── formatters │ │ │ │ └── logstash │ │ │ │ │ ├── logstash_test.go │ │ │ │ │ └── logstash.go │ │ │ │ └── formatter.go │ │ ├── yvasiyarov │ │ │ ├── gorelic │ │ │ │ ├── .travis.yml │ │ │ │ ├── .gitignore │ │ │ │ ├── doc.go │ │ │ │ ├── nut.json │ │ │ │ ├── examples │ │ │ │ │ ├── example1.go │ │ │ │ │ └── example_web.go │ │ │ │ └── LICENSE │ │ │ ├── newrelic_platform_go │ │ │ │ ├── .travis.yml │ │ │ │ ├── doc.go │ │ │ │ ├── nut.json │ │ │ │ ├── README.md │ │ │ │ ├── agent.go │ │ │ │ ├── metrica.go │ │ │ │ └── LICENSE │ │ │ └── go-metrics │ │ │ │ ├── runtime_no_cgo.go │ │ │ │ ├── runtime_cgo.go │ │ │ │ ├── .gitignore │ │ │ │ ├── writer_test.go │ │ │ │ ├── cmd │ │ │ │ ├── never-read │ │ │ │ │ └── never-read.go │ │ │ │ └── metrics-bench │ │ │ │ │ └── metrics-bench.go │ │ │ │ ├── metrics.go │ │ │ │ ├── opentsdb_test.go │ │ │ │ ├── graphite_test.go │ │ │ │ ├── json_test.go │ │ │ │ ├── gauge_test.go │ │ │ │ ├── gauge_float64_test.go │ │ │ │ ├── debug_test.go │ │ │ │ ├── meter_test.go │ │ │ │ └── LICENSE │ │ ├── ncw │ │ │ └── swift │ │ │ │ ├── .gitignore │ │ │ │ ├── .travis.yml │ │ │ │ ├── compatibility_1_1.go │ │ │ │ ├── compatibility_1_0.go │ │ │ │ ├── watchdog_reader.go │ │ │ │ ├── COPYING │ │ │ │ ├── doc.go │ │ │ │ ├── timeout_reader.go │ │ │ │ ├── notes.txt │ │ │ │ └── watchdog_reader_test.go │ │ ├── gorilla │ │ │ ├── context │ │ │ │ ├── .travis.yml │ │ │ │ ├── README.md │ │ │ │ └── LICENSE │ │ │ ├── mux │ │ │ │ ├── .travis.yml │ │ │ │ ├── README.md │ │ │ │ ├── bench_test.go │ │ │ │ └── LICENSE │ │ │ └── handlers │ │ │ │ ├── .travis.yml │ │ │ │ └── README.md │ │ ├── noahdesu │ │ │ └── go-ceph │ │ │ │ └── rados │ │ │ │ ├── doc.go │ │ │ │ └── rados.go │ │ ├── codegangsta │ │ │ └── cli │ │ │ │ ├── .travis.yml │ │ │ │ ├── autocomplete │ │ │ │ ├── zsh_autocomplete │ │ │ │ └── bash_autocomplete │ │ │ │ ├── helpers_test.go │ │ │ │ ├── cli.go │ │ │ │ ├── LICENSE │ │ │ │ └── command_test.go │ │ ├── mitchellh │ │ │ └── mapstructure │ │ │ │ ├── .travis.yml │ │ │ │ ├── mapstructure_bugs_test.go │ │ │ │ ├── LICENSE │ │ │ │ └── error.go │ │ ├── docker │ │ │ ├── libtrust │ │ │ │ ├── MAINTAINERS │ │ │ │ ├── doc.go │ │ │ │ ├── CONTRIBUTING.md │ │ │ │ ├── util_test.go │ │ │ │ ├── README.md │ │ │ │ ├── filter.go │ │ │ │ ├── hash.go │ │ │ │ └── tlsdemo │ │ │ │ │ ├── gencert.go │ │ │ │ │ └── genkeys.go │ │ │ └── docker │ │ │ │ └── pkg │ │ │ │ └── tarsum │ │ │ │ ├── testdata │ │ │ │ ├── xattr │ │ │ │ │ ├── layer.tar │ │ │ │ │ └── json │ │ │ │ ├── 511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158 │ │ │ │ │ ├── json │ │ │ │ │ └── layer.tar │ │ │ │ └── 46af0962ab5afeb5ce6740d4d91652e69206fc991fd5328c1a94d364ad00e457 │ │ │ │ │ └── json │ │ │ │ ├── writercloser.go │ │ │ │ └── builder_context.go │ │ ├── bugsnag │ │ │ ├── panicwrap │ │ │ │ ├── monitor_windows.go │ │ │ │ ├── LICENSE │ │ │ │ └── monitor.go │ │ │ ├── bugsnag-go │ │ │ │ ├── errors │ │ │ │ │ └── README.md │ │ │ │ ├── .travis.yml │ │ │ │ ├── panicwrap.go │ │ │ │ ├── LICENSE.txt │ │ │ │ ├── json_tags.go │ │ │ │ └── configuration_test.go │ │ │ └── osext │ │ │ │ ├── osext_plan9.go │ │ │ │ ├── osext_procfs.go │ │ │ │ ├── osext_windows.go │ │ │ │ ├── LICENSE │ │ │ │ └── osext.go │ │ ├── stevvooe │ │ │ └── resumable │ │ │ │ ├── README.md │ │ │ │ ├── sha512 │ │ │ │ ├── sha512block_decl.go │ │ │ │ └── resume.go │ │ │ │ ├── sha256 │ │ │ │ ├── sha256block_decl.go │ │ │ │ └── resume.go │ │ │ │ ├── .gitignore │ │ │ │ └── LICENSE │ │ ├── AdRoll │ │ │ └── goamz │ │ │ │ ├── cloudfront │ │ │ │ ├── testdata │ │ │ │ │ └── key.pub │ │ │ │ └── cloudfront_test.go │ │ │ │ ├── s3 │ │ │ │ └── export_test.go │ │ │ │ └── aws │ │ │ │ └── export_test.go │ │ ├── Azure │ │ │ └── azure-sdk-for-go │ │ │ │ ├── .gitignore │ │ │ │ ├── .travis.yml │ │ │ │ └── storage │ │ │ │ └── util.go │ │ └── garyburd │ │ │ └── redigo │ │ │ ├── redis │ │ │ ├── test_test.go │ │ │ └── redis.go │ │ │ └── internal │ │ │ └── commandinfo.go │ │ ├── gopkg.in │ │ ├── check.v1 │ │ │ ├── .gitignore │ │ │ ├── TODO │ │ │ ├── export_test.go │ │ │ ├── README.md │ │ │ └── LICENSE │ │ └── yaml.v2 │ │ │ ├── suite_test.go │ │ │ └── LICENSE.libyaml │ │ └── golang.org │ │ └── x │ │ ├── net │ │ └── context │ │ │ └── withtimeout_test.go │ │ └── crypto │ │ └── bcrypt │ │ └── base64.go └── Readme ├── contrib ├── docker-integration │ ├── nginx │ │ ├── test.passwd │ │ ├── registry-noauth.conf │ │ ├── docker-registry-v2.conf │ │ ├── Dockerfile │ │ ├── registry-basic.conf │ │ ├── docker-registry.conf │ │ └── nginx.conf │ ├── docker-compose.yml │ ├── run.sh │ ├── test_runner.sh │ └── Dockerfile ├── compose │ ├── nginx │ │ ├── Dockerfile │ │ ├── docker-registry-v2.conf │ │ ├── docker-registry.conf │ │ ├── nginx.conf │ │ └── registry.conf │ └── docker-compose.yml └── apache │ └── README.MD ├── docs ├── images │ ├── registry.png │ └── notifications.png ├── osx │ ├── config.yml │ └── com.docker.registry.plist ├── storage-drivers │ ├── filesystem.md │ ├── inmemory.md │ ├── azure.md │ └── rados.md ├── spec │ └── implementations.md ├── help.md ├── Dockerfile ├── migration.md ├── mkdocs.yml └── osx-setup-guide.md ├── registry ├── doc.go ├── storage │ ├── doc.go │ ├── driver │ │ ├── rados │ │ │ ├── doc.go │ │ │ └── rados_test.go │ │ ├── inmemory │ │ │ └── driver_test.go │ │ ├── filesystem │ │ │ └── driver_test.go │ │ ├── azure │ │ │ ├── blockblob.go │ │ │ ├── blockid.go │ │ │ ├── zerofillwriter.go │ │ │ └── azure_test.go │ │ └── middleware │ │ │ └── storagemiddleware.go │ ├── cache │ │ ├── memory │ │ │ └── memory_test.go │ │ ├── cache.go │ │ └── redis │ │ │ └── redis_test.go │ ├── blobwriter_nonresumable.go │ ├── util.go │ └── walk.go ├── handlers │ ├── basicauth.go │ ├── helpers.go │ ├── mail.go │ ├── basicauth_prego14.go │ └── hooks.go ├── api │ ├── v2 │ │ ├── doc.go │ │ └── routes.go │ └── errcode │ │ └── handler.go ├── auth │ └── token │ │ ├── stringset.go │ │ └── util.go ├── middleware │ ├── registry │ │ └── middleware.go │ └── repository │ │ └── middleware.go └── client │ └── auth │ └── authchallenge_test.go ├── cmd ├── registry │ ├── rados.go │ └── config.yml └── dist │ ├── list.go │ ├── main.go │ ├── push.go │ └── pull.go ├── MAINTAINERS ├── doc.go ├── .mailmap ├── project ├── hooks │ ├── configure-hooks.sh │ ├── README.md │ └── pre-commit └── dev-image │ └── Dockerfile ├── version ├── version.go ├── print.go └── version.sh ├── Dockerfile ├── .gitignore ├── digest └── digester_resumable_test.go ├── health ├── checks │ ├── checks_test.go │ └── checks.go ├── api │ └── api.go └── health_test.go ├── context └── util.go ├── manifest ├── verify.go └── sign.go ├── .drone.yml └── uuid └── uuid_test.go /Godeps/_workspace/.gitignore: -------------------------------------------------------------------------------- 1 | /pkg 2 | /bin 3 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/.gitignore: -------------------------------------------------------------------------------- 1 | logrus 2 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/gorelic/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ncw/swift/.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.pyc 3 | test-env* 4 | junk/ -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/newrelic_platform_go/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/gopkg.in/check.v1/.gitignore: -------------------------------------------------------------------------------- 1 | _* 2 | *.swp 3 | *.[568] 4 | [568].out 5 | -------------------------------------------------------------------------------- /contrib/docker-integration/nginx/test.passwd: -------------------------------------------------------------------------------- 1 | testuser:$apr1$YmLhHjm6$AjP4z8J1WgcUNxU8J4ue5. 2 | -------------------------------------------------------------------------------- /docs/images/registry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DV/distribution/master/docs/images/registry.png -------------------------------------------------------------------------------- /Godeps/_workspace/src/gopkg.in/check.v1/TODO: -------------------------------------------------------------------------------- 1 | - Assert(slice, Contains, item) 2 | - Parallel test support 3 | -------------------------------------------------------------------------------- /docs/images/notifications.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DV/distribution/master/docs/images/notifications.png -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/gorelic/.gitignore: -------------------------------------------------------------------------------- 1 | *.nut 2 | *.swp 3 | examples/example1 4 | examples/example_web 5 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/gorilla/context/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.0 5 | - 1.1 6 | - 1.2 7 | - tip 8 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/gorilla/mux/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.0 5 | - 1.1 6 | - 1.2 7 | - tip 8 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/noahdesu/go-ceph/rados/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Set of wrappers around librados API. 3 | */ 4 | package rados 5 | -------------------------------------------------------------------------------- /registry/doc.go: -------------------------------------------------------------------------------- 1 | // Package registry is a placeholder package for registry interface 2 | // definitions and utilities. 3 | package registry 4 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/codegangsta/cli/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 1.1 3 | 4 | script: 5 | - go vet ./... 6 | - go test -v ./... 7 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/mitchellh/mapstructure/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.4 5 | 6 | script: 7 | - go test 8 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/gorilla/handlers/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.0 5 | - 1.1 6 | - 1.2 7 | - 1.3 8 | - tip 9 | -------------------------------------------------------------------------------- /cmd/registry/rados.go: -------------------------------------------------------------------------------- 1 | // +build include_rados 2 | 3 | package main 4 | 5 | import _ "github.com/docker/distribution/registry/storage/driver/rados" 6 | -------------------------------------------------------------------------------- /Godeps/Readme: -------------------------------------------------------------------------------- 1 | This directory tree is generated automatically by godep. 2 | 3 | Please do not edit. 4 | 5 | See https://github.com/tools/godep for more information. 6 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.2 4 | - 1.3 5 | - 1.4 6 | - tip 7 | install: 8 | - go get -t ./... 9 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/runtime_no_cgo.go: -------------------------------------------------------------------------------- 1 | // +build !cgo 2 | 3 | package metrics 4 | 5 | func numCgoCall() int64 { 6 | return 0 7 | } 8 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ncw/swift/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.1.2 5 | - 1.2.2 6 | - 1.3 7 | - tip 8 | 9 | script: 10 | - go test 11 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/newrelic_platform_go/doc.go: -------------------------------------------------------------------------------- 1 | // Package newrelic_platform_go is New Relic Platform Agent SDK for Go language. 2 | package newrelic_platform_go 3 | -------------------------------------------------------------------------------- /registry/storage/doc.go: -------------------------------------------------------------------------------- 1 | // Package storage contains storage services for use in the registry 2 | // application. It should be considered an internal package, as of Go 1.4. 3 | package storage 4 | -------------------------------------------------------------------------------- /registry/storage/driver/rados/doc.go: -------------------------------------------------------------------------------- 1 | // Package rados implements the rados storage driver backend. Support can be 2 | // enabled by including the "include_rados" build tag. 3 | package rados 4 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/terminal_openbsd.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import "syscall" 4 | 5 | const ioctlReadTermios = syscall.TIOCGETA 6 | 7 | type Termios syscall.Termios 8 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/docker/libtrust/MAINTAINERS: -------------------------------------------------------------------------------- 1 | Solomon Hykes 2 | Josh Hawn (github: jlhawn) 3 | Derek McGowan (github: dmcgowan) 4 | -------------------------------------------------------------------------------- /MAINTAINERS: -------------------------------------------------------------------------------- 1 | Solomon Hykes (@shykes) 2 | Olivier Gambier (@dmp42) 3 | Sam Alba (@samalba) 4 | Stephen Day (@stevvooe) 5 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/docker/docker/pkg/tarsum/testdata/xattr/layer.tar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DV/distribution/master/Godeps/_workspace/src/github.com/docker/docker/pkg/tarsum/testdata/xattr/layer.tar -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/runtime_cgo.go: -------------------------------------------------------------------------------- 1 | // +build cgo 2 | 3 | package metrics 4 | 5 | import "runtime" 6 | 7 | func numCgoCall() int64 { 8 | return runtime.NumCgoCall() 9 | } 10 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 0.7.3 2 | 3 | formatter/\*: allow configuration of timestamp layout 4 | 5 | # 0.7.2 6 | 7 | formatter/text: Add configuration option for time format (#158) 8 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/bugsnag/panicwrap/monitor_windows.go: -------------------------------------------------------------------------------- 1 | package panicwrap 2 | 3 | import "fmt" 4 | 5 | func monitor(c *WrapConfig) (int, error) { 6 | return -1, fmt.Errorf("Monitor is not supported on windows") 7 | } 8 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/codegangsta/cli/autocomplete/zsh_autocomplete: -------------------------------------------------------------------------------- 1 | autoload -U compinit && compinit 2 | autoload -U bashcompinit && bashcompinit 3 | 4 | script_dir=$(dirname $0) 5 | source ${script_dir}/bash_autocomplete 6 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/stevvooe/resumable/README.md: -------------------------------------------------------------------------------- 1 | # go-crypto 2 | A Subset of the Go `crypto` Package with a Resumable Hash Interface 3 | 4 | ### Documentation 5 | 6 | GoDocs: http://godoc.org/github.com/stevvooe/resumable 7 | -------------------------------------------------------------------------------- /registry/handlers/basicauth.go: -------------------------------------------------------------------------------- 1 | // +build go1.4 2 | 3 | package handlers 4 | 5 | import ( 6 | "net/http" 7 | ) 8 | 9 | func basicAuth(r *http.Request) (username, password string, ok bool) { 10 | return r.BasicAuth() 11 | } 12 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/.gitignore: -------------------------------------------------------------------------------- 1 | *.[68] 2 | *.a 3 | *.out 4 | *.swp 5 | _obj 6 | _testmain.go 7 | cmd/metrics-bench/metrics-bench 8 | cmd/metrics-example/metrics-example 9 | cmd/never-read/never-read 10 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/gopkg.in/yaml.v2/suite_test.go: -------------------------------------------------------------------------------- 1 | package yaml_test 2 | 3 | import ( 4 | . "gopkg.in/check.v1" 5 | "testing" 6 | ) 7 | 8 | func Test(t *testing.T) { TestingT(t) } 9 | 10 | type S struct{} 11 | 12 | var _ = Suite(&S{}) 13 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/gorelic/doc.go: -------------------------------------------------------------------------------- 1 | // Package gorelic is an New Relic agent implementation for Go runtime. It collect a lot of metrics about Go scheduler, garbage collector and memory allocator and send them to NewRelic. 2 | package gorelic 3 | -------------------------------------------------------------------------------- /contrib/docker-integration/nginx/registry-noauth.conf: -------------------------------------------------------------------------------- 1 | client_max_body_size 0; 2 | chunked_transfer_encoding on; 3 | location /v2/ { 4 | include docker-registry-v2.conf; 5 | } 6 | location / { 7 | include docker-registry.conf; 8 | } 9 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/gopkg.in/check.v1/export_test.go: -------------------------------------------------------------------------------- 1 | package check 2 | 3 | func PrintLine(filename string, line int) (string, error) { 4 | return printLine(filename, line) 5 | } 6 | 7 | func Indent(s, with string) string { 8 | return indent(s, with) 9 | } 10 | -------------------------------------------------------------------------------- /contrib/compose/nginx/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:1.7 2 | 3 | COPY nginx.conf /etc/nginx/nginx.conf 4 | COPY registry.conf /etc/nginx/conf.d/registry.conf 5 | COPY docker-registry.conf /etc/nginx/docker-registry.conf 6 | COPY docker-registry-v2.conf /etc/nginx/docker-registry-v2.conf 7 | -------------------------------------------------------------------------------- /cmd/dist/list.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/codegangsta/cli" 4 | 5 | var ( 6 | commandList = cli.Command{ 7 | Name: "images", 8 | Usage: "List available images", 9 | Action: imageList, 10 | } 11 | ) 12 | 13 | func imageList(c *cli.Context) { 14 | } 15 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/gorilla/mux/README.md: -------------------------------------------------------------------------------- 1 | mux 2 | === 3 | [![Build Status](https://travis-ci.org/gorilla/mux.png?branch=master)](https://travis-ci.org/gorilla/mux) 4 | 5 | gorilla/mux is a powerful URL router and dispatcher. 6 | 7 | Read the full documentation here: http://www.gorillatoolkit.org/pkg/mux 8 | -------------------------------------------------------------------------------- /contrib/compose/docker-compose.yml: -------------------------------------------------------------------------------- 1 | nginx: 2 | build: "nginx" 3 | ports: 4 | - "5000:5000" 5 | links: 6 | - registryv1:registryv1 7 | - registryv2:registryv2 8 | registryv1: 9 | image: registry 10 | ports: 11 | - "5000" 12 | registryv2: 13 | build: "../../" 14 | ports: 15 | - "5000" 16 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/errors/README.md: -------------------------------------------------------------------------------- 1 | Adds stacktraces to errors in golang. 2 | 3 | This was made to help build the Bugsnag notifier but can be used standalone if 4 | you like to have stacktraces on errors. 5 | 6 | See [Godoc](https://godoc.org/github.com/bugsnag/bugsnag-go/errors) for the API docs. 7 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.1 5 | - 1.2 6 | - 1.3 7 | - tip 8 | 9 | install: 10 | - go get github.com/bugsnag/panicwrap 11 | - go get github.com/bugsnag/osext 12 | - go get github.com/bitly/go-simplejson 13 | - go get github.com/revel/revel 14 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/gorilla/handlers/README.md: -------------------------------------------------------------------------------- 1 | gorilla/handlers 2 | ================ 3 | [![Build Status](https://travis-ci.org/gorilla/handlers.png?branch=master)](https://travis-ci.org/gorilla/handlers) 4 | 5 | *Warning:* This package is a work in progress and the APIs are subject to change. 6 | Consider this a v0 project. 7 | -------------------------------------------------------------------------------- /doc.go: -------------------------------------------------------------------------------- 1 | // Package distribution will define the interfaces for the components of 2 | // docker distribution. The goal is to allow users to reliably package, ship 3 | // and store content related to docker images. 4 | // 5 | // This is currently a work in progress. More details are available in the 6 | // README.md. 7 | package distribution 8 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/AdRoll/goamz/cloudfront/testdata/key.pub: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC0yMzp9DkPAE99DhsEaGkqougL 3 | vtmDKri4bZj0fFjmGmjyyjz9hlrsr87LHVWzH/7igK7040HG1UqypX3ijtJa9+6B 4 | KHwBBctboU3y4GfwFwVAOumY9UytFpyPlgUFrffZLQAywKkT24OgcfEj0G5kiQn7 5 | 60wFnmSUtOuITo708QIDAQAB 6 | -----END PUBLIC KEY----- 7 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/gorilla/context/README.md: -------------------------------------------------------------------------------- 1 | context 2 | ======= 3 | [![Build Status](https://travis-ci.org/gorilla/context.png?branch=master)](https://travis-ci.org/gorilla/context) 4 | 5 | gorilla/context is a general purpose registry for global request variables. 6 | 7 | Read the full documentation here: http://www.gorillatoolkit.org/pkg/context 8 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/stevvooe/resumable/sha512/sha512block_decl.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64 6 | 7 | package sha512 8 | 9 | //go:noescape 10 | 11 | func block(dig *digest, p []byte) 12 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/stevvooe/resumable/sha256/sha256block_decl.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386 amd64 6 | 7 | package sha256 8 | 9 | //go:noescape 10 | 11 | func block(dig *digest, p []byte) 12 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/gorelic/nut.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version": "0.0.6", 3 | "Vendor": "yvasiyarov", 4 | "Authors": [ 5 | { 6 | "FullName": "Yuriy Vasiyarov", 7 | "Email": "varyous@gmail.com" 8 | } 9 | ], 10 | "ExtraFiles": [ 11 | "README.md", 12 | "LICENSE" 13 | ], 14 | "Homepage": "https://github.com/yvasiyarov/gorelic" 15 | } 16 | -------------------------------------------------------------------------------- /docs/osx/config.yml: -------------------------------------------------------------------------------- 1 | version: 0.1 2 | log: 3 | level: info 4 | fields: 5 | service: registry 6 | environment: macbook-air 7 | storage: 8 | cache: 9 | layerinfo: inmemory 10 | filesystem: 11 | rootdirectory: /Users/Shared/Registry 12 | http: 13 | addr: 0.0.0.0:5000 14 | secret: mytokensecret 15 | debug: 16 | addr: localhost:5001 17 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/terminal_linux.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2013 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | package logrus 7 | 8 | import "syscall" 9 | 10 | const ioctlReadTermios = syscall.TCGETS 11 | 12 | type Termios syscall.Termios 13 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/terminal_darwin.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2013 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | package logrus 7 | 8 | import "syscall" 9 | 10 | const ioctlReadTermios = syscall.TIOCGETA 11 | 12 | type Termios syscall.Termios 13 | -------------------------------------------------------------------------------- /cmd/dist/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/codegangsta/cli" 7 | ) 8 | 9 | func main() { 10 | app := cli.NewApp() 11 | app.Name = "dist" 12 | app.Usage = "Package and ship Docker content" 13 | 14 | app.Action = commandList.Action 15 | app.Commands = []cli.Command{ 16 | commandList, 17 | commandPull, 18 | commandPush, 19 | } 20 | app.Run(os.Args) 21 | } 22 | -------------------------------------------------------------------------------- /registry/storage/cache/memory/memory_test.go: -------------------------------------------------------------------------------- 1 | package memory 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/docker/distribution/registry/storage/cache" 7 | ) 8 | 9 | // TestInMemoryBlobInfoCache checks the in memory implementation is working 10 | // correctly. 11 | func TestInMemoryBlobInfoCache(t *testing.T) { 12 | cache.CheckBlobDescriptorCache(t, NewInMemoryBlobDescriptorCacheProvider()) 13 | } 14 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/newrelic_platform_go/nut.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version": "0.0.1", 3 | "Vendor": "yvasiyarov", 4 | "Authors": [ 5 | { 6 | "FullName": "Yuriy Vasiyarov", 7 | "Email": "varyous@gmail.com" 8 | } 9 | ], 10 | "ExtraFiles": [ 11 | "README.md", 12 | "LICENSE" 13 | ], 14 | "Homepage": "https://github.com/yvasiyarov/newrelic_platform_go" 15 | } 16 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/docker/docker/pkg/tarsum/writercloser.go: -------------------------------------------------------------------------------- 1 | package tarsum 2 | 3 | import ( 4 | "io" 5 | ) 6 | 7 | type writeCloseFlusher interface { 8 | io.WriteCloser 9 | Flush() error 10 | } 11 | 12 | type nopCloseFlusher struct { 13 | io.Writer 14 | } 15 | 16 | func (n *nopCloseFlusher) Close() error { 17 | return nil 18 | } 19 | 20 | func (n *nopCloseFlusher) Flush() error { 21 | return nil 22 | } 23 | -------------------------------------------------------------------------------- /contrib/compose/nginx/docker-registry-v2.conf: -------------------------------------------------------------------------------- 1 | proxy_pass http://docker-registry-v2; 2 | proxy_set_header Host $http_host; # required for docker client's sake 3 | proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP 4 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 5 | proxy_set_header X-Forwarded-Proto $scheme; 6 | proxy_read_timeout 900; 7 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/stevvooe/resumable/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | -------------------------------------------------------------------------------- /contrib/docker-integration/nginx/docker-registry-v2.conf: -------------------------------------------------------------------------------- 1 | proxy_pass http://docker-registry-v2; 2 | proxy_set_header Host $http_host; # required for docker client's sake 3 | proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP 4 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 5 | proxy_set_header X-Forwarded-Proto $scheme; 6 | proxy_read_timeout 900; 7 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/gopkg.in/check.v1/README.md: -------------------------------------------------------------------------------- 1 | Instructions 2 | ============ 3 | 4 | Install the package with: 5 | 6 | go get gopkg.in/check.v1 7 | 8 | Import it with: 9 | 10 | import "gopkg.in/check.v1" 11 | 12 | and use _check_ as the package name inside the code. 13 | 14 | For more details, visit the project page: 15 | 16 | * http://labix.org/gocheck 17 | 18 | and the API documentation: 19 | 20 | * https://gopkg.in/check.v1 21 | -------------------------------------------------------------------------------- /cmd/dist/push.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/codegangsta/cli" 4 | 5 | var ( 6 | commandPush = cli.Command{ 7 | Name: "push", 8 | Usage: "Push an image to a registry", 9 | Action: imagePush, 10 | Flags: []cli.Flag{ 11 | cli.StringFlag{ 12 | Name: "r,registry", 13 | Value: "hub.docker.io", 14 | Usage: "Registry to use (e.g.: localhost:5000)", 15 | }, 16 | }, 17 | } 18 | ) 19 | 20 | func imagePush(*cli.Context) { 21 | } 22 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/codegangsta/cli/autocomplete/bash_autocomplete: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | _cli_bash_autocomplete() { 4 | local cur prev opts base 5 | COMPREPLY=() 6 | cur="${COMP_WORDS[COMP_CWORD]}" 7 | prev="${COMP_WORDS[COMP_CWORD-1]}" 8 | opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion ) 9 | COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) 10 | return 0 11 | } 12 | 13 | complete -F _cli_bash_autocomplete $PROG -------------------------------------------------------------------------------- /cmd/dist/pull.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/codegangsta/cli" 4 | 5 | var ( 6 | commandPull = cli.Command{ 7 | Name: "pull", 8 | Usage: "Pull and verify an image from a registry", 9 | Action: imagePull, 10 | Flags: []cli.Flag{ 11 | cli.StringFlag{ 12 | Name: "r,registry", 13 | Value: "hub.docker.io", 14 | Usage: "Registry to use (e.g.: localhost:5000)", 15 | }, 16 | }, 17 | } 18 | ) 19 | 20 | func imagePull(c *cli.Context) { 21 | } 22 | -------------------------------------------------------------------------------- /registry/handlers/helpers.go: -------------------------------------------------------------------------------- 1 | package handlers 2 | 3 | import ( 4 | "io" 5 | "net/http" 6 | ) 7 | 8 | // closeResources closes all the provided resources after running the target 9 | // handler. 10 | func closeResources(handler http.Handler, closers ...io.Closer) http.Handler { 11 | return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 12 | for _, closer := range closers { 13 | defer closer.Close() 14 | } 15 | handler.ServeHTTP(w, r) 16 | }) 17 | } 18 | -------------------------------------------------------------------------------- /contrib/docker-integration/nginx/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:1.9 2 | 3 | COPY nginx.conf /etc/nginx/nginx.conf 4 | COPY registry.conf /etc/nginx/conf.d/registry.conf 5 | COPY docker-registry.conf /etc/nginx/docker-registry.conf 6 | COPY docker-registry-v2.conf /etc/nginx/docker-registry-v2.conf 7 | COPY registry-noauth.conf /etc/nginx/registry-noauth.conf 8 | COPY registry-basic.conf /etc/nginx/registry-basic.conf 9 | COPY test.passwd /etc/nginx/test.passwd 10 | COPY ssl /etc/nginx/ssl 11 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | Stephen J Day Stephen Day 2 | Stephen J Day Stephen Day 3 | Olivier Gambier Olivier Gambier 4 | Brian Bland Brian Bland 5 | Josh Hawn Josh Hawn 6 | Richard Scothern Richard -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/terminal_freebsd.go: -------------------------------------------------------------------------------- 1 | /* 2 | Go 1.2 doesn't include Termios for FreeBSD. This should be added in 1.3 and this could be merged with terminal_darwin. 3 | */ 4 | package logrus 5 | 6 | import ( 7 | "syscall" 8 | ) 9 | 10 | const ioctlReadTermios = syscall.TIOCGETA 11 | 12 | type Termios struct { 13 | Iflag uint32 14 | Oflag uint32 15 | Cflag uint32 16 | Lflag uint32 17 | Cc [20]uint8 18 | Ispeed uint32 19 | Ospeed uint32 20 | } 21 | -------------------------------------------------------------------------------- /contrib/docker-integration/nginx/registry-basic.conf: -------------------------------------------------------------------------------- 1 | client_max_body_size 0; 2 | chunked_transfer_encoding on; 3 | location /v2/ { 4 | auth_basic "registry.localhost"; 5 | auth_basic_user_file test.passwd; 6 | add_header 'Docker-Distribution-Api-Version' 'registry/2.0' always; 7 | include docker-registry-v2.conf; 8 | } 9 | location / { 10 | auth_basic "registry.localhost"; 11 | auth_basic_user_file test.passwd; 12 | include docker-registry.conf; 13 | } 14 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Azure/azure-sdk-for-go/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | 26 | # Editor swap files 27 | *.swp 28 | *~ 29 | .DS_Store 30 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/bugsnag/osext/osext_plan9.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package osext 6 | 7 | import "syscall" 8 | 9 | func executable() (string, error) { 10 | f, err := Open("/proc/" + itoa(Getpid()) + "/text") 11 | if err != nil { 12 | return "", err 13 | } 14 | defer f.Close() 15 | return syscall.Fd2path(int(f.Fd())) 16 | } 17 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/writer_test.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import ( 4 | "sort" 5 | "testing" 6 | ) 7 | 8 | func TestMetricsSorting(t *testing.T) { 9 | var namedMetrics = namedMetricSlice{ 10 | {name: "zzz"}, 11 | {name: "bbb"}, 12 | {name: "fff"}, 13 | {name: "ggg"}, 14 | } 15 | 16 | sort.Sort(namedMetrics) 17 | for i, name := range []string{"bbb", "fff", "ggg", "zzz"} { 18 | if namedMetrics[i].name != name { 19 | t.Fail() 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /project/hooks/configure-hooks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd $(dirname $0) 4 | 5 | REPO_ROOT=$(git rev-parse --show-toplevel) 6 | RESOLVE_REPO_ROOT_STATUS=$? 7 | if [ "$RESOLVE_REPO_ROOT_STATUS" -ne "0" ]; then 8 | echo -e "Unable to resolve repository root. Error:\n$REPO_ROOT" > /dev/stderr 9 | exit $RESOLVE_REPO_ROOT_STATUS 10 | fi 11 | 12 | set -e 13 | set -x 14 | 15 | # Just in case the directory doesn't exist 16 | mkdir -p $REPO_ROOT/.git/hooks 17 | 18 | ln -f -s $(pwd)/pre-commit $REPO_ROOT/.git/hooks/pre-commit -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/docker/libtrust/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package libtrust provides an interface for managing authentication and 3 | authorization using public key cryptography. Authentication is handled 4 | using the identity attached to the public key and verified through TLS 5 | x509 certificates, a key challenge, or signature. Authorization and 6 | access control is managed through a trust graph distributed between 7 | both remote trust servers and locally cached and managed data. 8 | */ 9 | package libtrust 10 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/cmd/never-read/never-read.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "log" 5 | "net" 6 | ) 7 | 8 | func main() { 9 | addr, _ := net.ResolveTCPAddr("tcp", "127.0.0.1:2003") 10 | l, err := net.ListenTCP("tcp", addr) 11 | if nil != err { 12 | log.Fatalln(err) 13 | } 14 | log.Println("listening", l.Addr()) 15 | for { 16 | c, err := l.AcceptTCP() 17 | if nil != err { 18 | log.Fatalln(err) 19 | } 20 | log.Println("accepted", c.RemoteAddr()) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /registry/api/v2/doc.go: -------------------------------------------------------------------------------- 1 | // Package v2 describes routes, urls and the error codes used in the Docker 2 | // Registry JSON HTTP API V2. In addition to declarations, descriptors are 3 | // provided for routes and error codes that can be used for implementation and 4 | // automatically generating documentation. 5 | // 6 | // Definitions here are considered to be locked down for the V2 registry api. 7 | // Any changes must be considered carefully and should not proceed without a 8 | // change proposal in docker core. 9 | package v2 10 | -------------------------------------------------------------------------------- /contrib/docker-integration/nginx/docker-registry.conf: -------------------------------------------------------------------------------- 1 | proxy_pass http://docker-registry; 2 | proxy_set_header Host $http_host; # required for docker client's sake 3 | proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP 4 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 5 | proxy_set_header X-Forwarded-Proto $scheme; 6 | proxy_set_header Authorization ""; # see https://github.com/docker/docker-registry/issues/170 7 | proxy_read_timeout 900; 8 | -------------------------------------------------------------------------------- /version/version.go: -------------------------------------------------------------------------------- 1 | package version 2 | 3 | // Package is the overall, canonical project import path under which the 4 | // package was built. 5 | var Package = "github.com/docker/distribution" 6 | 7 | // Version indicates which version of the binary is running. This is set to 8 | // the latest release tag by hand, always suffixed by "+unknown". During 9 | // build, it will be replaced by the actual version. The value here will be 10 | // used if the registry is run after a go get based install. 11 | var Version = "v2.0.0+unknown" 12 | -------------------------------------------------------------------------------- /contrib/compose/nginx/docker-registry.conf: -------------------------------------------------------------------------------- 1 | proxy_pass http://docker-registry; 2 | proxy_set_header Host $http_host; # required for docker client's sake 3 | proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP 4 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 5 | proxy_set_header X-Forwarded-Proto $scheme; 6 | proxy_set_header Authorization ""; # For basic auth through nginx in v1 to work, please comment this line 7 | proxy_read_timeout 900; 8 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.4 2 | 3 | RUN apt-get update && \ 4 | apt-get install -y librados-dev apache2-utils && \ 5 | rm -rf /var/lib/apt/lists/* 6 | 7 | ENV DISTRIBUTION_DIR /go/src/github.com/docker/distribution 8 | ENV GOPATH $DISTRIBUTION_DIR/Godeps/_workspace:$GOPATH 9 | ENV DOCKER_BUILDTAGS include_rados 10 | 11 | WORKDIR $DISTRIBUTION_DIR 12 | COPY . $DISTRIBUTION_DIR 13 | RUN make PREFIX=/go clean binaries 14 | 15 | VOLUME ["/var/lib/registry"] 16 | EXPOSE 5000 17 | ENTRYPOINT ["registry"] 18 | CMD ["cmd/registry/config.yml"] 19 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/docker/libtrust/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to libtrust 2 | 3 | Want to hack on libtrust? Awesome! Here are instructions to get you 4 | started. 5 | 6 | libtrust is a part of the [Docker](https://www.docker.com) project, and follows 7 | the same rules and principles. If you're already familiar with the way 8 | Docker does things, you'll feel right at home. 9 | 10 | Otherwise, go read 11 | [Docker's contributions guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md). 12 | 13 | Happy hacking! 14 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ncw/swift/compatibility_1_1.go: -------------------------------------------------------------------------------- 1 | // Go 1.1 and later compatibility functions 2 | // 3 | // +build go1.1 4 | 5 | package swift 6 | 7 | import ( 8 | "net/http" 9 | "time" 10 | ) 11 | 12 | // Cancel the request 13 | func cancelRequest(transport http.RoundTripper, req *http.Request) { 14 | if tr, ok := transport.(interface { 15 | CancelRequest(*http.Request) 16 | }); ok { 17 | tr.CancelRequest(req) 18 | } 19 | } 20 | 21 | // Reset a timer 22 | func resetTimer(t *time.Timer, d time.Duration) { 23 | t.Reset(d) 24 | } 25 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/codegangsta/cli/helpers_test.go: -------------------------------------------------------------------------------- 1 | package cli_test 2 | 3 | import ( 4 | "reflect" 5 | "testing" 6 | ) 7 | 8 | /* Test Helpers */ 9 | func expect(t *testing.T, a interface{}, b interface{}) { 10 | if a != b { 11 | t.Errorf("Expected %v (type %v) - Got %v (type %v)", b, reflect.TypeOf(b), a, reflect.TypeOf(a)) 12 | } 13 | } 14 | 15 | func refute(t *testing.T, a interface{}, b interface{}) { 16 | if a == b { 17 | t.Errorf("Did not expect %v (type %v) - Got %v (type %v)", b, reflect.TypeOf(b), a, reflect.TypeOf(a)) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/newrelic_platform_go/README.md: -------------------------------------------------------------------------------- 1 | New Relic Platform Agent SDK for Go(golang) 2 | ==================== 3 | 4 | [![Build Status](https://travis-ci.org/yvasiyarov/newrelic_platform_go.png?branch=master)](https://travis-ci.org/yvasiyarov/newrelic_platform_go) 5 | 6 | This package provide very simple interface to NewRelic Platform http://newrelic.com/platform 7 | 8 | For example of usage see examples/wave_plugin.go 9 | 10 | For real-word example, you can have a look at: 11 | https://github.com/yvasiyarov/newrelic_sphinx 12 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/metrics.go: -------------------------------------------------------------------------------- 1 | // Go port of Coda Hale's Metrics library 2 | // 3 | // 4 | // 5 | // Coda Hale's original work: 6 | package metrics 7 | 8 | // UseNilMetrics is checked by the constructor functions for all of the 9 | // standard metrics. If it is true, the metric returned is a stub. 10 | // 11 | // This global kill-switch helps quantify the observer effect and makes 12 | // for less cluttered pprof profiles. 13 | var UseNilMetrics bool = false 14 | -------------------------------------------------------------------------------- /registry/storage/blobwriter_nonresumable.go: -------------------------------------------------------------------------------- 1 | // +build noresumabledigest 2 | 3 | package storage 4 | 5 | import ( 6 | "github.com/docker/distribution/context" 7 | ) 8 | 9 | // resumeHashAt is a noop when resumable digest support is disabled. 10 | func (bw *blobWriter) resumeDigestAt(ctx context.Context, offset int64) error { 11 | return errResumableDigestNotAvailable 12 | } 13 | 14 | // storeHashState is a noop when resumable digest support is disabled. 15 | func (bw *blobWriter) storeHashState(ctx context.Context) error { 16 | return errResumableDigestNotAvailable 17 | } 18 | -------------------------------------------------------------------------------- /docs/storage-drivers/filesystem.md: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | # Filesystem storage driver 11 | 12 | An implementation of the `storagedriver.StorageDriver` interface which uses the local filesystem. 13 | 14 | ## Parameters 15 | 16 | `rootdirectory`: (optional) The root directory tree in which all registry files will be stored. Defaults to `/var/lib/registry`. 17 | -------------------------------------------------------------------------------- /docs/storage-drivers/inmemory.md: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | # In-memory storage driver 11 | 12 | An implementation of the `storagedriver.StorageDriver` interface which uses local memory for object storage. 13 | 14 | **IMPORTANT**: This storage driver *does not* persist data across runs, and primarily exists for testing. 15 | 16 | ## Parameters 17 | 18 | None 19 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/opentsdb_test.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import ( 4 | "net" 5 | "time" 6 | ) 7 | 8 | func ExampleOpenTSDB() { 9 | addr, _ := net.ResolveTCPAddr("net", ":2003") 10 | go OpenTSDB(DefaultRegistry, 1*time.Second, "some.prefix", addr) 11 | } 12 | 13 | func ExampleOpenTSDBWithConfig() { 14 | addr, _ := net.ResolveTCPAddr("net", ":2003") 15 | go OpenTSDBWithConfig(OpenTSDBConfig{ 16 | Addr: addr, 17 | Registry: DefaultRegistry, 18 | FlushInterval: 1 * time.Second, 19 | DurationUnit: time.Millisecond, 20 | }) 21 | } 22 | 23 | -------------------------------------------------------------------------------- /contrib/docker-integration/docker-compose.yml: -------------------------------------------------------------------------------- 1 | nginx: 2 | build: "nginx" 3 | ports: 4 | - "5000:5000" 5 | - "5001:5001" 6 | - "5002:5002" 7 | - "5011:5011" 8 | - "5440:5440" 9 | - "5441:5441" 10 | - "5442:5442" 11 | - "5443:5443" 12 | - "5444:5444" 13 | - "5445:5445" 14 | - "5446:5446" 15 | - "5447:5447" 16 | - "5448:5448" 17 | links: 18 | - registryv1:registryv1 19 | - registryv2:registryv2 20 | registryv1: 21 | image: registry:0.9.1 22 | ports: 23 | - "5000" 24 | registryv2: 25 | build: "../../" 26 | ports: 27 | - "5000" 28 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/syslog/README.md: -------------------------------------------------------------------------------- 1 | # Syslog Hooks for Logrus :walrus: 2 | 3 | ## Usage 4 | 5 | ```go 6 | import ( 7 | "log/syslog" 8 | "github.com/Sirupsen/logrus" 9 | logrus_syslog "github.com/Sirupsen/logrus/hooks/syslog" 10 | ) 11 | 12 | func main() { 13 | log := logrus.New() 14 | hook, err := logrus_syslog.NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "") 15 | 16 | if err == nil { 17 | log.Hooks.Add(hook) 18 | } 19 | } 20 | ``` 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | 26 | # never checkin from the bin file (for now) 27 | bin/* 28 | 29 | # Test key files 30 | *.pem 31 | 32 | # Cover profiles 33 | *.out 34 | 35 | # Editor/IDE specific files. 36 | *.sublime-project 37 | *.sublime-workspace 38 | -------------------------------------------------------------------------------- /registry/storage/driver/inmemory/driver_test.go: -------------------------------------------------------------------------------- 1 | package inmemory 2 | 3 | import ( 4 | "testing" 5 | 6 | storagedriver "github.com/docker/distribution/registry/storage/driver" 7 | "github.com/docker/distribution/registry/storage/driver/testsuites" 8 | "gopkg.in/check.v1" 9 | ) 10 | 11 | // Hook up gocheck into the "go test" runner. 12 | func Test(t *testing.T) { check.TestingT(t) } 13 | 14 | func init() { 15 | inmemoryDriverConstructor := func() (storagedriver.StorageDriver, error) { 16 | return New(), nil 17 | } 18 | testsuites.RegisterSuite(inmemoryDriverConstructor, testsuites.NeverSkip) 19 | } 20 | -------------------------------------------------------------------------------- /registry/storage/util.go: -------------------------------------------------------------------------------- 1 | package storage 2 | 3 | import ( 4 | "github.com/docker/distribution/context" 5 | "github.com/docker/distribution/registry/storage/driver" 6 | ) 7 | 8 | // Exists provides a utility method to test whether or not a path exists in 9 | // the given driver. 10 | func exists(ctx context.Context, drv driver.StorageDriver, path string) (bool, error) { 11 | if _, err := drv.Stat(ctx, path); err != nil { 12 | switch err := err.(type) { 13 | case driver.PathNotFoundError: 14 | return false, nil 15 | default: 16 | return false, err 17 | } 18 | } 19 | 20 | return true, nil 21 | } 22 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/AdRoll/goamz/s3/export_test.go: -------------------------------------------------------------------------------- 1 | package s3 2 | 3 | import ( 4 | "github.com/AdRoll/goamz/aws" 5 | ) 6 | 7 | var originalStrategy = attempts 8 | 9 | func SetAttemptStrategy(s *aws.AttemptStrategy) { 10 | if s == nil { 11 | attempts = originalStrategy 12 | } else { 13 | attempts = *s 14 | } 15 | } 16 | 17 | func Sign(auth aws.Auth, method, path string, params, headers map[string][]string) { 18 | sign(auth, method, path, params, headers) 19 | } 20 | 21 | func SetListPartsMax(n int) { 22 | listPartsMax = n 23 | } 24 | 25 | func SetListMultiMax(n int) { 26 | listMultiMax = n 27 | } 28 | -------------------------------------------------------------------------------- /digest/digester_resumable_test.go: -------------------------------------------------------------------------------- 1 | // +build !noresumabledigest 2 | 3 | package digest 4 | 5 | import ( 6 | "testing" 7 | 8 | "github.com/stevvooe/resumable" 9 | _ "github.com/stevvooe/resumable/sha256" 10 | ) 11 | 12 | // TestResumableDetection just ensures that the resumable capability of a hash 13 | // is exposed through the digester type, which is just a hash plus a Digest 14 | // method. 15 | func TestResumableDetection(t *testing.T) { 16 | d := Canonical.New() 17 | 18 | if _, ok := d.Hash().(resumable.Hash); !ok { 19 | t.Fatalf("expected digester to implement resumable.Hash: %#v, %v", d, d.Hash()) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/gorilla/mux/bench_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Gorilla Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package mux 6 | 7 | import ( 8 | "net/http" 9 | "testing" 10 | ) 11 | 12 | func BenchmarkMux(b *testing.B) { 13 | router := new(Router) 14 | handler := func(w http.ResponseWriter, r *http.Request) {} 15 | router.HandleFunc("/v1/{v1}", handler) 16 | 17 | request, _ := http.NewRequest("GET", "/v1/anything", nil) 18 | for i := 0; i < b.N; i++ { 19 | router.ServeHTTP(nil, request) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/papertrail/papertrail_test.go: -------------------------------------------------------------------------------- 1 | package logrus_papertrail 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | 7 | "github.com/Sirupsen/logrus" 8 | "github.com/stvp/go-udp-testing" 9 | ) 10 | 11 | func TestWritingToUDP(t *testing.T) { 12 | port := 16661 13 | udp.SetAddr(fmt.Sprintf(":%d", port)) 14 | 15 | hook, err := NewPapertrailHook("localhost", port, "test") 16 | if err != nil { 17 | t.Errorf("Unable to connect to local UDP server.") 18 | } 19 | 20 | log := logrus.New() 21 | log.Hooks.Add(hook) 22 | 23 | udp.ShouldReceive(t, "foo", func() { 24 | log.Info("foo") 25 | }) 26 | } 27 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/newrelic_platform_go/agent.go: -------------------------------------------------------------------------------- 1 | package newrelic_platform_go 2 | 3 | import ( 4 | "log" 5 | "os" 6 | ) 7 | 8 | type Agent struct { 9 | Host string `json:"host"` 10 | Version string `json:"version"` 11 | Pid int `json:"pid"` 12 | } 13 | 14 | func NewAgent(Version string) *Agent { 15 | agent := &Agent{ 16 | Version: Version, 17 | } 18 | return agent 19 | } 20 | 21 | func (agent *Agent) CollectEnvironmentInfo() { 22 | var err error 23 | agent.Pid = os.Getpid() 24 | if agent.Host, err = os.Hostname(); err != nil { 25 | log.Fatalf("Can not get hostname: %#v \n", err) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/graphite_test.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import ( 4 | "net" 5 | "time" 6 | ) 7 | 8 | func ExampleGraphite() { 9 | addr, _ := net.ResolveTCPAddr("net", ":2003") 10 | go Graphite(DefaultRegistry, 1*time.Second, "some.prefix", addr) 11 | } 12 | 13 | func ExampleGraphiteWithConfig() { 14 | addr, _ := net.ResolveTCPAddr("net", ":2003") 15 | go GraphiteWithConfig(GraphiteConfig{ 16 | Addr: addr, 17 | Registry: DefaultRegistry, 18 | FlushInterval: 1 * time.Second, 19 | DurationUnit: time.Millisecond, 20 | Percentiles: []float64{ 0.5, 0.75, 0.99, 0.999 }, 21 | }) 22 | } 23 | -------------------------------------------------------------------------------- /project/hooks/README.md: -------------------------------------------------------------------------------- 1 | Git Hooks 2 | ========= 3 | 4 | To enforce valid and properly-formatted code, there is CI in place which runs `gofmt`, `golint`, and `go vet` against code in the repository. 5 | 6 | As an aid to prevent committing invalid code in the first place, a git pre-commit hook has been added to the repository, found in [pre-commit](./pre-commit). As it is impossible to automatically add linked hooks to a git repository, this hook should be linked into your `.git/hooks/pre-commit`, which can be done by running the `configure-hooks.sh` script in this directory. This script is the preferred method of configuring hooks, as it will be updated as more are added. -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/docker/docker/pkg/tarsum/testdata/511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158/json: -------------------------------------------------------------------------------- 1 | {"id":"511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158","comment":"Imported from -","created":"2013-06-13T14:03:50.821769-07:00","container_config":{"Hostname":"","Domainname":"","User":"","Memory":0,"MemorySwap":0,"CpuShares":0,"AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"ExposedPorts":null,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"NetworkDisabled":false,"OnBuild":null},"docker_version":"0.4.0","architecture":"x86_64","Size":0} -------------------------------------------------------------------------------- /project/dev-image/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:14.04 2 | 3 | ENV GOLANG_VERSION 1.4rc1 4 | ENV GOPATH /var/cache/drone 5 | ENV GOROOT /usr/local/go 6 | ENV PATH $PATH:$GOROOT/bin:$GOPATH/bin 7 | 8 | ENV LANG C 9 | ENV LC_ALL C 10 | 11 | RUN apt-get update && apt-get install -y \ 12 | wget ca-certificates git mercurial bzr \ 13 | --no-install-recommends \ 14 | && rm -rf /var/lib/apt/lists/* 15 | 16 | RUN wget https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz --quiet && \ 17 | tar -C /usr/local -xzf go$GOLANG_VERSION.linux-amd64.tar.gz && \ 18 | rm go${GOLANG_VERSION}.linux-amd64.tar.gz 19 | 20 | RUN go get github.com/axw/gocov/gocov github.com/mattn/goveralls github.com/golang/lint/golint 21 | -------------------------------------------------------------------------------- /registry/storage/driver/filesystem/driver_test.go: -------------------------------------------------------------------------------- 1 | package filesystem 2 | 3 | import ( 4 | "io/ioutil" 5 | "os" 6 | "testing" 7 | 8 | storagedriver "github.com/docker/distribution/registry/storage/driver" 9 | "github.com/docker/distribution/registry/storage/driver/testsuites" 10 | . "gopkg.in/check.v1" 11 | ) 12 | 13 | // Hook up gocheck into the "go test" runner. 14 | func Test(t *testing.T) { TestingT(t) } 15 | 16 | func init() { 17 | root, err := ioutil.TempDir("", "driver-") 18 | if err != nil { 19 | panic(err) 20 | } 21 | defer os.Remove(root) 22 | 23 | testsuites.RegisterSuite(func() (storagedriver.StorageDriver, error) { 24 | return New(root), nil 25 | }, testsuites.NeverSkip) 26 | } 27 | -------------------------------------------------------------------------------- /version/print.go: -------------------------------------------------------------------------------- 1 | package version 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "os" 7 | ) 8 | 9 | // FprintVersion outputs the version string to the writer, in the following 10 | // format, followed by a newline: 11 | // 12 | // 13 | // 14 | // For example, a binary "registry" built from github.com/docker/distribution 15 | // with version "v2.0" would print the following: 16 | // 17 | // registry github.com/docker/distribution v2.0 18 | // 19 | func FprintVersion(w io.Writer) { 20 | fmt.Fprintln(w, os.Args[0], Package, Version) 21 | } 22 | 23 | // PrintVersion outputs the version information, from Fprint, to stdout. 24 | func PrintVersion() { 25 | FprintVersion(os.Stdout) 26 | } 27 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/terminal_notwindows.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2011 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // +build linux darwin freebsd openbsd 7 | 8 | package logrus 9 | 10 | import ( 11 | "syscall" 12 | "unsafe" 13 | ) 14 | 15 | // IsTerminal returns true if the given file descriptor is a terminal. 16 | func IsTerminal() bool { 17 | fd := syscall.Stdout 18 | var termios Termios 19 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) 20 | return err == 0 21 | } 22 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Azure/azure-sdk-for-go/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | language: go 4 | 5 | before_script: 6 | - go get -u golang.org/x/tools/cmd/vet 7 | - go get -u github.com/golang/lint/golint 8 | 9 | go: tip 10 | script: 11 | - test -z "$(gofmt -s -l -w management | tee /dev/stderr)" 12 | - test -z "$(gofmt -s -l -w storage | tee /dev/stderr)" 13 | - go build -v ./... 14 | - go test -v ./storage/... -check.v 15 | - test -z "$(golint ./storage/... | tee /dev/stderr)" 16 | - go vet ./storage/... 17 | - go test -v ./management/... 18 | - test -z "$(golint ./management/... | grep -v 'should have comment' | grep -v 'stutters' | tee /dev/stderr)" 19 | - go vet ./management/... 20 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/bugsnag/osext/osext_procfs.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux netbsd openbsd 6 | 7 | package osext 8 | 9 | import ( 10 | "errors" 11 | "os" 12 | "runtime" 13 | ) 14 | 15 | func executable() (string, error) { 16 | switch runtime.GOOS { 17 | case "linux": 18 | return os.Readlink("/proc/self/exe") 19 | case "netbsd": 20 | return os.Readlink("/proc/curproc/exe") 21 | case "openbsd": 22 | return os.Readlink("/proc/curproc/file") 23 | } 24 | return "", errors.New("ExecPath not implemented for " + runtime.GOOS) 25 | } 26 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/syslog/syslog_test.go: -------------------------------------------------------------------------------- 1 | package logrus_syslog 2 | 3 | import ( 4 | "github.com/Sirupsen/logrus" 5 | "log/syslog" 6 | "testing" 7 | ) 8 | 9 | func TestLocalhostAddAndPrint(t *testing.T) { 10 | log := logrus.New() 11 | hook, err := NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "") 12 | 13 | if err != nil { 14 | t.Errorf("Unable to connect to local syslog.") 15 | } 16 | 17 | log.Hooks.Add(hook) 18 | 19 | for _, level := range hook.Levels() { 20 | if len(log.Hooks[level]) != 1 { 21 | t.Errorf("SyslogHook was not added. The length of log.Hooks[%v]: %v", level, len(log.Hooks[level])) 22 | } 23 | } 24 | 25 | log.Info("Congratulations!") 26 | } 27 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/docker/libtrust/util_test.go: -------------------------------------------------------------------------------- 1 | package libtrust 2 | 3 | import ( 4 | "encoding/pem" 5 | "reflect" 6 | "testing" 7 | ) 8 | 9 | func TestAddPEMHeadersToKey(t *testing.T) { 10 | pk := &rsaPublicKey{nil, map[string]interface{}{}} 11 | blk := &pem.Block{Headers: map[string]string{"hosts": "localhost,127.0.0.1"}} 12 | addPEMHeadersToKey(blk, pk) 13 | 14 | val := pk.GetExtendedField("hosts") 15 | hosts, ok := val.([]string) 16 | if !ok { 17 | t.Fatalf("hosts type(%v), expected []string", reflect.TypeOf(val)) 18 | } 19 | expected := []string{"localhost", "127.0.0.1"} 20 | if !reflect.DeepEqual(hosts, expected) { 21 | t.Errorf("hosts(%v), expected %v", hosts, expected) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/json_test.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import ( 4 | "bytes" 5 | "encoding/json" 6 | "testing" 7 | ) 8 | 9 | func TestRegistryMarshallJSON(t *testing.T) { 10 | b := &bytes.Buffer{} 11 | enc := json.NewEncoder(b) 12 | r := NewRegistry() 13 | r.Register("counter", NewCounter()) 14 | enc.Encode(r) 15 | if s := b.String(); "{\"counter\":{\"count\":0}}\n" != s { 16 | t.Fatalf(s) 17 | } 18 | } 19 | 20 | func TestRegistryWriteJSONOnce(t *testing.T) { 21 | r := NewRegistry() 22 | r.Register("counter", NewCounter()) 23 | b := &bytes.Buffer{} 24 | WriteJSONOnce(r, b) 25 | if s := b.String(); s != "{\"counter\":{\"count\":0}}\n" { 26 | t.Fail() 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/codegangsta/cli/cli.go: -------------------------------------------------------------------------------- 1 | // Package cli provides a minimal framework for creating and organizing command line 2 | // Go applications. cli is designed to be easy to understand and write, the most simple 3 | // cli application can be written as follows: 4 | // func main() { 5 | // cli.NewApp().Run(os.Args) 6 | // } 7 | // 8 | // Of course this application does not do much, so let's make this an actual application: 9 | // func main() { 10 | // app := cli.NewApp() 11 | // app.Name = "greet" 12 | // app.Usage = "say a greeting" 13 | // app.Action = func(c *cli.Context) { 14 | // println("Greetings") 15 | // } 16 | // 17 | // app.Run(os.Args) 18 | // } 19 | package cli 20 | -------------------------------------------------------------------------------- /contrib/compose/nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | user nginx; 2 | worker_processes 1; 3 | 4 | error_log /var/log/nginx/error.log warn; 5 | pid /var/run/nginx.pid; 6 | 7 | events { 8 | worker_connections 1024; 9 | } 10 | 11 | http { 12 | include /etc/nginx/mime.types; 13 | default_type application/octet-stream; 14 | 15 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 16 | '$status $body_bytes_sent "$http_referer" ' 17 | '"$http_user_agent" "$http_x_forwarded_for"'; 18 | 19 | access_log /var/log/nginx/access.log main; 20 | 21 | sendfile on; 22 | 23 | keepalive_timeout 65; 24 | 25 | include /etc/nginx/conf.d/*.conf; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /registry/storage/driver/azure/blockblob.go: -------------------------------------------------------------------------------- 1 | package azure 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | 7 | azure "github.com/Azure/azure-sdk-for-go/storage" 8 | ) 9 | 10 | // azureBlockStorage is adaptor between azure.BlobStorageClient and 11 | // blockStorage interface. 12 | type azureBlockStorage struct { 13 | azure.BlobStorageClient 14 | } 15 | 16 | func (b *azureBlockStorage) GetSectionReader(container, blob string, start, length int64) (io.ReadCloser, error) { 17 | return b.BlobStorageClient.GetBlobRange(container, blob, fmt.Sprintf("%v-%v", start, start+length-1)) 18 | } 19 | 20 | func newAzureBlockStorage(b azure.BlobStorageClient) azureBlockStorage { 21 | a := azureBlockStorage{} 22 | a.BlobStorageClient = b 23 | return a 24 | } 25 | -------------------------------------------------------------------------------- /contrib/docker-integration/nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | user nginx; 2 | worker_processes 1; 3 | 4 | error_log /var/log/nginx/error.log warn; 5 | pid /var/run/nginx.pid; 6 | 7 | events { 8 | worker_connections 1024; 9 | } 10 | 11 | http { 12 | include /etc/nginx/mime.types; 13 | default_type application/octet-stream; 14 | 15 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 16 | '$status $body_bytes_sent "$http_referer" ' 17 | '"$http_user_agent" "$http_x_forwarded_for"'; 18 | 19 | access_log /var/log/nginx/access.log main; 20 | 21 | sendfile on; 22 | 23 | keepalive_timeout 65; 24 | 25 | include /etc/nginx/conf.d/*.conf; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/writer.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import ( 4 | "bufio" 5 | "io" 6 | "runtime" 7 | ) 8 | 9 | func (logger *Logger) Writer() *io.PipeWriter { 10 | reader, writer := io.Pipe() 11 | 12 | go logger.writerScanner(reader) 13 | runtime.SetFinalizer(writer, writerFinalizer) 14 | 15 | return writer 16 | } 17 | 18 | func (logger *Logger) writerScanner(reader *io.PipeReader) { 19 | scanner := bufio.NewScanner(reader) 20 | for scanner.Scan() { 21 | logger.Print(scanner.Text()) 22 | } 23 | if err := scanner.Err(); err != nil { 24 | logger.Errorf("Error while reading from Writer: %s", err) 25 | } 26 | reader.Close() 27 | } 28 | 29 | func writerFinalizer(writer *io.PipeWriter) { 30 | writer.Close() 31 | } 32 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/docker/docker/pkg/tarsum/builder_context.go: -------------------------------------------------------------------------------- 1 | package tarsum 2 | 3 | // This interface extends TarSum by adding the Remove method. In general 4 | // there was concern about adding this method to TarSum itself so instead 5 | // it is being added just to "BuilderContext" which will then only be used 6 | // during the .dockerignore file processing - see builder/evaluator.go 7 | type BuilderContext interface { 8 | TarSum 9 | Remove(string) 10 | } 11 | 12 | func (bc *tarSum) Remove(filename string) { 13 | for i, fis := range bc.sums { 14 | if fis.Name() == filename { 15 | bc.sums = append(bc.sums[:i], bc.sums[i+1:]...) 16 | // Note, we don't just return because there could be 17 | // more than one with this name 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /health/checks/checks_test.go: -------------------------------------------------------------------------------- 1 | package checks 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | func TestFileChecker(t *testing.T) { 8 | if err := FileChecker("/tmp").Check(); err == nil { 9 | t.Errorf("/tmp was expected as exists") 10 | } 11 | 12 | if err := FileChecker("NoSuchFileFromMoon").Check(); err != nil { 13 | t.Errorf("NoSuchFileFromMoon was expected as not exists, error:%v", err) 14 | } 15 | } 16 | 17 | func TestHTTPChecker(t *testing.T) { 18 | if err := HTTPChecker("https://www.google.cybertron").Check(); err == nil { 19 | t.Errorf("Google on Cybertron was expected as not exists") 20 | } 21 | 22 | if err := HTTPChecker("https://www.google.pt").Check(); err != nil { 23 | t.Errorf("Google at Portugal was expected as exists, error:%v", err) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /docs/spec/implementations.md: -------------------------------------------------------------------------------- 1 | # Distribution API Implementations 2 | 3 | This is a list of known implementations of the Distribution API spec. 4 | 5 | ## [Docker Distribution Registry](https://github.com/docker/distribution) 6 | 7 | Docker distribution is the reference implementation of the distribution API 8 | specification. It aims to fully implement the entire specification. 9 | 10 | ### Releases 11 | #### 2.0.1 (_in development_) 12 | Implements API 2.0.1 13 | 14 | _Known Issues_ 15 | - No resumable push support 16 | - Content ranges ignored 17 | - Blob upload status will always return a starting range of 0 18 | 19 | #### 2.0.0 20 | Implements API 2.0.0 21 | 22 | _Known Issues_ 23 | - No resumable push support 24 | - No PATCH implementation for blob upload 25 | - Content ranges ignored 26 | 27 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/AdRoll/goamz/aws/export_test.go: -------------------------------------------------------------------------------- 1 | package aws 2 | 3 | import ( 4 | "net/http" 5 | "time" 6 | ) 7 | 8 | // V4Signer: 9 | // Exporting methods for testing 10 | 11 | func (s *V4Signer) RequestTime(req *http.Request) time.Time { 12 | return s.requestTime(req) 13 | } 14 | 15 | func (s *V4Signer) CanonicalRequest(req *http.Request) string { 16 | return s.canonicalRequest(req, "") 17 | } 18 | 19 | func (s *V4Signer) StringToSign(t time.Time, creq string) string { 20 | return s.stringToSign(t, creq) 21 | } 22 | 23 | func (s *V4Signer) Signature(t time.Time, sts string) string { 24 | return s.signature(t, sts) 25 | } 26 | 27 | func (s *V4Signer) Authorization(header http.Header, t time.Time, signature string) string { 28 | return s.authorization(header, t, signature) 29 | } 30 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/terminal_windows.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2011 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // +build windows 7 | 8 | package logrus 9 | 10 | import ( 11 | "syscall" 12 | "unsafe" 13 | ) 14 | 15 | var kernel32 = syscall.NewLazyDLL("kernel32.dll") 16 | 17 | var ( 18 | procGetConsoleMode = kernel32.NewProc("GetConsoleMode") 19 | ) 20 | 21 | // IsTerminal returns true if the given file descriptor is a terminal. 22 | func IsTerminal() bool { 23 | fd := syscall.Stdout 24 | var st uint32 25 | r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0) 26 | return r != 0 && e == 0 27 | } 28 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/cmd/metrics-bench/metrics-bench.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/rcrowley/go-metrics" 6 | "time" 7 | ) 8 | 9 | func main() { 10 | r := metrics.NewRegistry() 11 | for i := 0; i < 10000; i++ { 12 | r.Register(fmt.Sprintf("counter-%d", i), metrics.NewCounter()) 13 | r.Register(fmt.Sprintf("gauge-%d", i), metrics.NewGauge()) 14 | r.Register(fmt.Sprintf("gaugefloat64-%d", i), metrics.NewGaugeFloat64()) 15 | r.Register(fmt.Sprintf("histogram-uniform-%d", i), metrics.NewHistogram(metrics.NewUniformSample(1028))) 16 | r.Register(fmt.Sprintf("histogram-exp-%d", i), metrics.NewHistogram(metrics.NewExpDecaySample(1028, 0.015))) 17 | r.Register(fmt.Sprintf("meter-%d", i), metrics.NewMeter()) 18 | } 19 | time.Sleep(600e9) 20 | } 21 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/examples/hook/hook.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/Sirupsen/logrus" 5 | "github.com/Sirupsen/logrus/hooks/airbrake" 6 | ) 7 | 8 | var log = logrus.New() 9 | 10 | func init() { 11 | log.Formatter = new(logrus.TextFormatter) // default 12 | log.Hooks.Add(airbrake.NewHook("https://example.com", "xyz", "development")) 13 | } 14 | 15 | func main() { 16 | log.WithFields(logrus.Fields{ 17 | "animal": "walrus", 18 | "size": 10, 19 | }).Info("A group of walrus emerges from the ocean") 20 | 21 | log.WithFields(logrus.Fields{ 22 | "omg": true, 23 | "number": 122, 24 | }).Warn("The group's number increased tremendously!") 25 | 26 | log.WithFields(logrus.Fields{ 27 | "omg": true, 28 | "number": 100, 29 | }).Fatal("The ice breaks!") 30 | } 31 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/panicwrap.go: -------------------------------------------------------------------------------- 1 | // +build !appengine 2 | 3 | package bugsnag 4 | 5 | import ( 6 | "github.com/bugsnag/panicwrap" 7 | "github.com/bugsnag/bugsnag-go/errors" 8 | ) 9 | 10 | // NOTE: this function does not return when you call it, instead it 11 | // re-exec()s the current process with panic monitoring. 12 | func defaultPanicHandler() { 13 | defer defaultNotifier.dontPanic() 14 | 15 | err := panicwrap.BasicMonitor(func(output string) { 16 | toNotify, err := errors.ParsePanic(output) 17 | 18 | if err != nil { 19 | defaultNotifier.Config.log("bugsnag.handleUncaughtPanic: %v", err) 20 | } 21 | Notify(toNotify, SeverityError, Configuration{Synchronous: true}) 22 | }) 23 | 24 | if err != nil { 25 | defaultNotifier.Config.log("bugsnag.handleUncaughtPanic: %v", err) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/docker/libtrust/README.md: -------------------------------------------------------------------------------- 1 | # libtrust 2 | 3 | Libtrust is library for managing authentication and authorization using public key cryptography. 4 | 5 | Authentication is handled using the identity attached to the public key. 6 | Libtrust provides multiple methods to prove possession of the private key associated with an identity. 7 | - TLS x509 certificates 8 | - Signature verification 9 | - Key Challenge 10 | 11 | Authorization and access control is managed through a distributed trust graph. 12 | Trust servers are used as the authorities of the trust graph and allow caching portions of the graph for faster access. 13 | 14 | ## Copyright and license 15 | 16 | Code and documentation copyright 2014 Docker, inc. Code released under the Apache 2.0 license. 17 | Docs released under Creative commons. 18 | 19 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/net/context/withtimeout_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package context_test 6 | 7 | import ( 8 | "fmt" 9 | "time" 10 | 11 | "golang.org/x/net/context" 12 | ) 13 | 14 | func ExampleWithTimeout() { 15 | // Pass a context with a timeout to tell a blocking function that it 16 | // should abandon its work after the timeout elapses. 17 | ctx, _ := context.WithTimeout(context.Background(), 100*time.Millisecond) 18 | select { 19 | case <-time.After(200 * time.Millisecond): 20 | fmt.Println("overslept") 21 | case <-ctx.Done(): 22 | fmt.Println(ctx.Err()) // prints "context deadline exceeded" 23 | } 24 | // Output: 25 | // context deadline exceeded 26 | } 27 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/gauge_test.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import "testing" 4 | 5 | func BenchmarkGuage(b *testing.B) { 6 | g := NewGauge() 7 | b.ResetTimer() 8 | for i := 0; i < b.N; i++ { 9 | g.Update(int64(i)) 10 | } 11 | } 12 | 13 | func TestGauge(t *testing.T) { 14 | g := NewGauge() 15 | g.Update(int64(47)) 16 | if v := g.Value(); 47 != v { 17 | t.Errorf("g.Value(): 47 != %v\n", v) 18 | } 19 | } 20 | 21 | func TestGaugeSnapshot(t *testing.T) { 22 | g := NewGauge() 23 | g.Update(int64(47)) 24 | snapshot := g.Snapshot() 25 | g.Update(int64(0)) 26 | if v := snapshot.Value(); 47 != v { 27 | t.Errorf("g.Value(): 47 != %v\n", v) 28 | } 29 | } 30 | 31 | func TestGetOrRegisterGauge(t *testing.T) { 32 | r := NewRegistry() 33 | NewRegisteredGauge("foo", r).Update(47) 34 | if g := GetOrRegisterGauge("foo", r); 47 != g.Value() { 35 | t.Fatal(g) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /version/version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This bash script outputs the current, desired content of version.go, using 4 | # git describe. For best effect, pipe this to the target file. Generally, this 5 | # only needs to updated for releases. The actual value of will be replaced 6 | # during build time if the makefile is used. 7 | 8 | set -e 9 | 10 | cat < 2 | +++ 3 | title = "Getting help" 4 | description = "Getting help with the Registry" 5 | keywords = ["registry, service, images, repository, help"] 6 | [menu.main] 7 | parent="smn_registry" 8 | weight=9 9 | +++ 10 | 11 | 12 | # Getting help 13 | 14 | If you need help, or just want to chat, you can reach us: 15 | 16 | - on irc: `#docker-distribution` on freenode 17 | - on the [mailing list](https://groups.google.com/a/dockerproject.org/forum/#!forum/distribution) (mail at ) 18 | 19 | If you want to report a bug: 20 | 21 | - be sure to first read about [how to contribute](https://github.com/docker/distribution/blob/master/CONTRIBUTING.md) 22 | - you can then do so on the [GitHub project bugtracker](https://github.com/docker/distribution/issues) 23 | 24 | You can also find out more about the Docker's project [Getting Help resources](https://docs.docker.com/project/get-help). 25 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/bugsnag/osext/osext_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package osext 6 | 7 | import ( 8 | "syscall" 9 | "unicode/utf16" 10 | "unsafe" 11 | ) 12 | 13 | var ( 14 | kernel = syscall.MustLoadDLL("kernel32.dll") 15 | getModuleFileNameProc = kernel.MustFindProc("GetModuleFileNameW") 16 | ) 17 | 18 | // GetModuleFileName() with hModule = NULL 19 | func executable() (exePath string, err error) { 20 | return getModuleFileName() 21 | } 22 | 23 | func getModuleFileName() (string, error) { 24 | var n uint32 25 | b := make([]uint16, syscall.MAX_PATH) 26 | size := uint32(len(b)) 27 | 28 | r0, _, e1 := getModuleFileNameProc.Call(0, uintptr(unsafe.Pointer(&b[0])), uintptr(size)) 29 | n = uint32(r0) 30 | if n == 0 { 31 | return "", e1 32 | } 33 | return string(utf16.Decode(b[0:n])), nil 34 | } 35 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/bugsnag/osext/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Daniel Theophanes 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 16 | 2. Altered source versions must be plainly marked as such, and must not be 17 | misrepresented as being the original software. 18 | 19 | 3. This notice may not be removed or altered from any source 20 | distribution. 21 | -------------------------------------------------------------------------------- /registry/storage/driver/rados/rados_test.go: -------------------------------------------------------------------------------- 1 | // +build include_rados 2 | 3 | package rados 4 | 5 | import ( 6 | "os" 7 | "testing" 8 | 9 | storagedriver "github.com/docker/distribution/registry/storage/driver" 10 | "github.com/docker/distribution/registry/storage/driver/testsuites" 11 | 12 | "gopkg.in/check.v1" 13 | ) 14 | 15 | // Hook up gocheck into the "go test" runner. 16 | func Test(t *testing.T) { check.TestingT(t) } 17 | 18 | func init() { 19 | poolname := os.Getenv("RADOS_POOL") 20 | username := os.Getenv("RADOS_USER") 21 | 22 | driverConstructor := func() (storagedriver.StorageDriver, error) { 23 | parameters := DriverParameters{ 24 | poolname, 25 | username, 26 | defaultChunkSize, 27 | } 28 | 29 | return New(parameters) 30 | } 31 | 32 | skipCheck := func() string { 33 | if poolname == "" { 34 | return "RADOS_POOL must be set to run Rado tests" 35 | } 36 | return "" 37 | } 38 | 39 | testsuites.RegisterSuite(driverConstructor, skipCheck) 40 | } 41 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/crypto/bcrypt/base64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package bcrypt 6 | 7 | import "encoding/base64" 8 | 9 | const alphabet = "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" 10 | 11 | var bcEncoding = base64.NewEncoding(alphabet) 12 | 13 | func base64Encode(src []byte) []byte { 14 | n := bcEncoding.EncodedLen(len(src)) 15 | dst := make([]byte, n) 16 | bcEncoding.Encode(dst, src) 17 | for dst[n-1] == '=' { 18 | n-- 19 | } 20 | return dst[:n] 21 | } 22 | 23 | func base64Decode(src []byte) ([]byte, error) { 24 | numOfEquals := 4 - (len(src) % 4) 25 | for i := 0; i < numOfEquals; i++ { 26 | src = append(src, '=') 27 | } 28 | 29 | dst := make([]byte, bcEncoding.DecodedLen(len(src))) 30 | n, err := bcEncoding.Decode(dst, src) 31 | if err != nil { 32 | return nil, err 33 | } 34 | return dst[:n], nil 35 | } 36 | -------------------------------------------------------------------------------- /health/api/api.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import ( 4 | "errors" 5 | "net/http" 6 | 7 | "github.com/docker/distribution/health" 8 | ) 9 | 10 | var ( 11 | updater = health.NewStatusUpdater() 12 | ) 13 | 14 | // DownHandler registers a manual_http_status that always returns an Error 15 | func DownHandler(w http.ResponseWriter, r *http.Request) { 16 | if r.Method == "POST" { 17 | updater.Update(errors.New("Manual Check")) 18 | } else { 19 | w.WriteHeader(http.StatusNotFound) 20 | } 21 | } 22 | 23 | // UpHandler registers a manual_http_status that always returns nil 24 | func UpHandler(w http.ResponseWriter, r *http.Request) { 25 | if r.Method == "POST" { 26 | updater.Update(nil) 27 | } else { 28 | w.WriteHeader(http.StatusNotFound) 29 | } 30 | } 31 | 32 | // init sets up the two endpoints to bring the service up and down 33 | func init() { 34 | health.Register("manual_http_status", updater) 35 | http.HandleFunc("/debug/health/down", DownHandler) 36 | http.HandleFunc("/debug/health/up", UpHandler) 37 | } 38 | -------------------------------------------------------------------------------- /manifest/verify.go: -------------------------------------------------------------------------------- 1 | package manifest 2 | 3 | import ( 4 | "crypto/x509" 5 | 6 | "github.com/Sirupsen/logrus" 7 | "github.com/docker/libtrust" 8 | ) 9 | 10 | // Verify verifies the signature of the signed manifest returning the public 11 | // keys used during signing. 12 | func Verify(sm *SignedManifest) ([]libtrust.PublicKey, error) { 13 | js, err := libtrust.ParsePrettySignature(sm.Raw, "signatures") 14 | if err != nil { 15 | logrus.WithField("err", err).Debugf("(*SignedManifest).Verify") 16 | return nil, err 17 | } 18 | 19 | return js.Verify() 20 | } 21 | 22 | // VerifyChains verifies the signature of the signed manifest against the 23 | // certificate pool returning the list of verified chains. Signatures without 24 | // an x509 chain are not checked. 25 | func VerifyChains(sm *SignedManifest, ca *x509.CertPool) ([][]*x509.Certificate, error) { 26 | js, err := libtrust.ParsePrettySignature(sm.Raw, "signatures") 27 | if err != nil { 28 | return nil, err 29 | } 30 | 31 | return js.VerifyChains(ca) 32 | } 33 | -------------------------------------------------------------------------------- /project/hooks/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | REPO_ROOT=$(git rev-parse --show-toplevel) 4 | RESOLVE_REPO_ROOT_STATUS=$? 5 | if [ "$RESOLVE_REPO_ROOT_STATUS" -ne "0" ]; then 6 | printf "Unable to resolve repository root. Error:\n%s\n" "$RESOLVE_REPO_ROOT_STATUS" > /dev/stderr 7 | exit $RESOLVE_REPO_ROOT_STATUS 8 | fi 9 | 10 | cd $REPO_ROOT 11 | 12 | GOFMT_ERRORS=$(gofmt -s -l . 2>&1) 13 | if [ -n "$GOFMT_ERRORS" ]; then 14 | printf 'gofmt failed for the following files:\n%s\n\nPlease run "gofmt -s -l ." in the root of your repository before committing\n' "$GOFMT_ERRORS" > /dev/stderr 15 | exit 1 16 | fi 17 | 18 | GOLINT_ERRORS=$(golint ./... 2>&1) 19 | if [ -n "$GOLINT_ERRORS" ]; then 20 | printf "golint failed with the following errors:\n%s\n" "$GOLINT_ERRORS" > /dev/stderr 21 | exit 1 22 | fi 23 | 24 | GOVET_ERRORS=$(go vet ./... 2>&1) 25 | GOVET_STATUS=$? 26 | if [ "$GOVET_STATUS" -ne "0" ]; then 27 | printf "govet failed with the following errors:\n%s\n" "$GOVET_ERRORS" > /dev/stderr 28 | exit $GOVET_STATUS 29 | fi 30 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/bugsnag/osext/osext.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Extensions to the standard "os" package. 6 | package osext 7 | 8 | import "path/filepath" 9 | 10 | // Executable returns an absolute path that can be used to 11 | // re-invoke the current program. 12 | // It may not be valid after the current program exits. 13 | func Executable() (string, error) { 14 | p, err := executable() 15 | return filepath.Clean(p), err 16 | } 17 | 18 | // Returns same path as Executable, returns just the folder 19 | // path. Excludes the executable name. 20 | func ExecutableFolder() (string, error) { 21 | p, err := Executable() 22 | if err != nil { 23 | return "", err 24 | } 25 | folder, _ := filepath.Split(p) 26 | return folder, nil 27 | } 28 | 29 | // Depricated. Same as Executable(). 30 | func GetExePath() (exePath string, err error) { 31 | return Executable() 32 | } 33 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ncw/swift/watchdog_reader.go: -------------------------------------------------------------------------------- 1 | package swift 2 | 3 | import ( 4 | "io" 5 | "time" 6 | ) 7 | 8 | // An io.Reader which resets a watchdog timer whenever data is read 9 | type watchdogReader struct { 10 | timeout time.Duration 11 | reader io.Reader 12 | timer *time.Timer 13 | } 14 | 15 | // Returns a new reader which will kick the watchdog timer whenever data is read 16 | func newWatchdogReader(reader io.Reader, timeout time.Duration, timer *time.Timer) *watchdogReader { 17 | return &watchdogReader{ 18 | timeout: timeout, 19 | reader: reader, 20 | timer: timer, 21 | } 22 | } 23 | 24 | // Read reads up to len(p) bytes into p 25 | func (t *watchdogReader) Read(p []byte) (n int, err error) { 26 | // FIXME limit the amount of data read in one chunk so as to not exceed the timeout? 27 | resetTimer(t.timer, t.timeout) 28 | n, err = t.reader.Read(p) 29 | resetTimer(t.timer, t.timeout) 30 | return 31 | } 32 | 33 | // Check it satisfies the interface 34 | var _ io.Reader = &watchdogReader{} 35 | -------------------------------------------------------------------------------- /docs/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docs/base:latest 2 | MAINTAINER Mary Anthony (@moxiegirl) 3 | 4 | # To get the git info for this repo 5 | COPY . /src 6 | 7 | COPY . /docs/content/registry/ 8 | 9 | # Sed to process GitHub Markdown 10 | # 1-2 Remove comment code from metadata block 11 | # 3 Change ](/word to ](/project/ in links 12 | # 4 Change ](word.md) to ](/project/word) 13 | # 5 Remove .md extension from link text 14 | # 6 Change ](./ to ](/project/word) 15 | # 7 Change ](../../ to ](/project/ 16 | # 8 Change ](../ to ](/project/ 17 | # 18 | RUN find /docs/content/registry -type f -name "*.md" -exec sed -i.old \ 19 | -e '/^/g' \ 20 | -e '/^/g' \ 21 | -e 's/\(\]\)\([(]\)\(\/\)/\1\2\/registry\//g' \ 22 | -e 's/\(\][(]\)\([A-Za-z0-9]*\)\(\.md\)/\1\/registry\/\2/g' \ 23 | -e 's/\([(]\)\(.*\)\(\.md\)/\1\2/g' \ 24 | -e 's/\(\][(]\)\(\.\/\)/\1\/registry\//g' \ 25 | -e 's/\(\][(]\)\(\.\.\/\.\.\/\)/\1\/registry\//g' \ 26 | -e 's/\(\][(]\)\(\.\.\/\)/\1\/registry\//g' {} \; -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/gauge_float64_test.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import "testing" 4 | 5 | func BenchmarkGuageFloat64(b *testing.B) { 6 | g := NewGaugeFloat64() 7 | b.ResetTimer() 8 | for i := 0; i < b.N; i++ { 9 | g.Update(float64(i)) 10 | } 11 | } 12 | 13 | func TestGaugeFloat64(t *testing.T) { 14 | g := NewGaugeFloat64() 15 | g.Update(float64(47.0)) 16 | if v := g.Value(); float64(47.0) != v { 17 | t.Errorf("g.Value(): 47.0 != %v\n", v) 18 | } 19 | } 20 | 21 | func TestGaugeFloat64Snapshot(t *testing.T) { 22 | g := NewGaugeFloat64() 23 | g.Update(float64(47.0)) 24 | snapshot := g.Snapshot() 25 | g.Update(float64(0)) 26 | if v := snapshot.Value(); float64(47.0) != v { 27 | t.Errorf("g.Value(): 47.0 != %v\n", v) 28 | } 29 | } 30 | 31 | func TestGetOrRegisterGaugeFloat64(t *testing.T) { 32 | r := NewRegistry() 33 | NewRegisteredGaugeFloat64("foo", r).Update(float64(47.0)) 34 | t.Logf("registry: %v", r) 35 | if g := GetOrRegisterGaugeFloat64("foo", r); float64(47.0) != g.Value() { 36 | t.Fatal(g) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /.drone.yml: -------------------------------------------------------------------------------- 1 | image: dmp42/go:stable 2 | 3 | script: 4 | # To be spoofed back into the test image 5 | - go get github.com/modocache/gover 6 | 7 | - go get -t ./... 8 | 9 | # Go fmt 10 | - test -z "$(gofmt -s -l -w . | tee /dev/stderr)" 11 | # Go lint 12 | - test -z "$(golint ./... | tee /dev/stderr)" 13 | # Go vet 14 | - go vet ./... 15 | # Go test 16 | - go test -v -race -cover ./... 17 | # Helper to concatenate reports 18 | - gover 19 | # Send to coverall 20 | - goveralls -service drone.io -coverprofile=gover.coverprofile -repotoken {{COVERALLS_TOKEN}} 21 | 22 | # Do we want these as well? 23 | # - go get code.google.com/p/go.tools/cmd/goimports 24 | # - test -z "$(goimports -l -w ./... | tee /dev/stderr)" 25 | # http://labix.org/gocheck 26 | 27 | notify: 28 | email: 29 | recipients: 30 | - distribution@docker.com 31 | 32 | slack: 33 | team: docker 34 | channel: "#dt" 35 | username: mom 36 | token: {{SLACK_TOKEN}} 37 | on_success: true 38 | on_failure: true 39 | -------------------------------------------------------------------------------- /health/checks/checks.go: -------------------------------------------------------------------------------- 1 | package checks 2 | 3 | import ( 4 | "errors" 5 | "github.com/docker/distribution/health" 6 | "net/http" 7 | "os" 8 | ) 9 | 10 | // FileChecker checks the existence of a file and returns and error 11 | // if the file exists, taking the application out of rotation 12 | func FileChecker(f string) health.Checker { 13 | return health.CheckFunc(func() error { 14 | if _, err := os.Stat(f); err == nil { 15 | return errors.New("file exists") 16 | } 17 | return nil 18 | }) 19 | } 20 | 21 | // HTTPChecker does a HEAD request and verifies if the HTTP status 22 | // code return is a 200, taking the application out of rotation if 23 | // otherwise 24 | func HTTPChecker(r string) health.Checker { 25 | return health.CheckFunc(func() error { 26 | response, err := http.Head(r) 27 | if err != nil { 28 | return errors.New("error while checking: " + r) 29 | } 30 | if response.StatusCode != http.StatusOK { 31 | return errors.New("downstream service returned unexpected status: " + string(response.StatusCode)) 32 | } 33 | return nil 34 | }) 35 | } 36 | -------------------------------------------------------------------------------- /registry/storage/cache/cache.go: -------------------------------------------------------------------------------- 1 | // Package cache provides facilities to speed up access to the storage 2 | // backend. 3 | package cache 4 | 5 | import ( 6 | "fmt" 7 | 8 | "github.com/docker/distribution" 9 | ) 10 | 11 | // BlobDescriptorCacheProvider provides repository scoped 12 | // BlobDescriptorService cache instances and a global descriptor cache. 13 | type BlobDescriptorCacheProvider interface { 14 | distribution.BlobDescriptorService 15 | 16 | RepositoryScoped(repo string) (distribution.BlobDescriptorService, error) 17 | } 18 | 19 | // ValidateDescriptor provides a helper function to ensure that caches have 20 | // common criteria for admitting descriptors. 21 | func ValidateDescriptor(desc distribution.Descriptor) error { 22 | if err := desc.Digest.Validate(); err != nil { 23 | return err 24 | } 25 | 26 | if desc.Size < 0 { 27 | return fmt.Errorf("cache: invalid length in descriptor: %v < 0", desc.Size) 28 | } 29 | 30 | if desc.MediaType == "" { 31 | return fmt.Errorf("cache: empty mediatype on descriptor: %v", desc) 32 | } 33 | 34 | return nil 35 | } 36 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/debug_test.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import ( 4 | "runtime" 5 | "runtime/debug" 6 | "testing" 7 | "time" 8 | ) 9 | 10 | func BenchmarkDebugGCStats(b *testing.B) { 11 | r := NewRegistry() 12 | RegisterDebugGCStats(r) 13 | b.ResetTimer() 14 | for i := 0; i < b.N; i++ { 15 | CaptureDebugGCStatsOnce(r) 16 | } 17 | } 18 | 19 | func TestDebugGCStatsBlocking(t *testing.T) { 20 | if g := runtime.GOMAXPROCS(0); g < 2 { 21 | t.Skipf("skipping TestDebugGCMemStatsBlocking with GOMAXPROCS=%d\n", g) 22 | return 23 | } 24 | ch := make(chan int) 25 | go testDebugGCStatsBlocking(ch) 26 | var gcStats debug.GCStats 27 | t0 := time.Now() 28 | debug.ReadGCStats(&gcStats) 29 | t1 := time.Now() 30 | t.Log("i++ during debug.ReadGCStats:", <-ch) 31 | go testDebugGCStatsBlocking(ch) 32 | d := t1.Sub(t0) 33 | t.Log(d) 34 | time.Sleep(d) 35 | t.Log("i++ during time.Sleep:", <-ch) 36 | } 37 | 38 | func testDebugGCStatsBlocking(ch chan int) { 39 | i := 0 40 | for { 41 | select { 42 | case ch <- i: 43 | return 44 | default: 45 | i++ 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /registry/handlers/mail.go: -------------------------------------------------------------------------------- 1 | package handlers 2 | 3 | import ( 4 | "errors" 5 | "net/smtp" 6 | "strings" 7 | ) 8 | 9 | // mailer provides fields of email configuration for sending. 10 | type mailer struct { 11 | Addr, Username, Password, From string 12 | Insecure bool 13 | To []string 14 | } 15 | 16 | // sendMail allows users to send email, only if mail parameters is configured correctly. 17 | func (mail *mailer) sendMail(subject, message string) error { 18 | addr := strings.Split(mail.Addr, ":") 19 | if len(addr) != 2 { 20 | return errors.New("Invalid Mail Address") 21 | } 22 | host := addr[0] 23 | msg := []byte("To:" + strings.Join(mail.To, ";") + 24 | "\r\nFrom: " + mail.From + 25 | "\r\nSubject: " + subject + 26 | "\r\nContent-Type: text/plain\r\n\r\n" + 27 | message) 28 | auth := smtp.PlainAuth( 29 | "", 30 | mail.Username, 31 | mail.Password, 32 | host, 33 | ) 34 | err := smtp.SendMail( 35 | mail.Addr, 36 | auth, 37 | mail.From, 38 | mail.To, 39 | []byte(msg), 40 | ) 41 | if err != nil { 42 | return err 43 | } 44 | return nil 45 | } 46 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/mitchellh/mapstructure/mapstructure_bugs_test.go: -------------------------------------------------------------------------------- 1 | package mapstructure 2 | 3 | import "testing" 4 | 5 | // GH-1 6 | func TestDecode_NilValue(t *testing.T) { 7 | input := map[string]interface{}{ 8 | "vfoo": nil, 9 | "vother": nil, 10 | } 11 | 12 | var result Map 13 | err := Decode(input, &result) 14 | if err != nil { 15 | t.Fatalf("should not error: %s", err) 16 | } 17 | 18 | if result.Vfoo != "" { 19 | t.Fatalf("value should be default: %s", result.Vfoo) 20 | } 21 | 22 | if result.Vother != nil { 23 | t.Fatalf("Vother should be nil: %s", result.Vother) 24 | } 25 | } 26 | 27 | // GH-10 28 | func TestDecode_mapInterfaceInterface(t *testing.T) { 29 | input := map[interface{}]interface{}{ 30 | "vfoo": nil, 31 | "vother": nil, 32 | } 33 | 34 | var result Map 35 | err := Decode(input, &result) 36 | if err != nil { 37 | t.Fatalf("should not error: %s", err) 38 | } 39 | 40 | if result.Vfoo != "" { 41 | t.Fatalf("value should be default: %s", result.Vfoo) 42 | } 43 | 44 | if result.Vother != nil { 45 | t.Fatalf("Vother should be nil: %s", result.Vother) 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/json_formatter.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | ) 7 | 8 | type JSONFormatter struct { 9 | // TimestampFormat sets the format used for marshaling timestamps. 10 | TimestampFormat string 11 | } 12 | 13 | func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) { 14 | data := make(Fields, len(entry.Data)+3) 15 | for k, v := range entry.Data { 16 | switch v := v.(type) { 17 | case error: 18 | // Otherwise errors are ignored by `encoding/json` 19 | // https://github.com/Sirupsen/logrus/issues/137 20 | data[k] = v.Error() 21 | default: 22 | data[k] = v 23 | } 24 | } 25 | prefixFieldClashes(data) 26 | 27 | if f.TimestampFormat == "" { 28 | f.TimestampFormat = DefaultTimestampFormat 29 | } 30 | 31 | data["time"] = entry.Time.Format(f.TimestampFormat) 32 | data["msg"] = entry.Message 33 | data["level"] = entry.Level.String() 34 | 35 | serialized, err := json.Marshal(data) 36 | if err != nil { 37 | return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err) 38 | } 39 | return append(serialized, '\n'), nil 40 | } 41 | -------------------------------------------------------------------------------- /contrib/docker-integration/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 5 | 6 | # Root directory of Distribution 7 | DISTRIBUTION_ROOT=$(cd ../..; pwd -P) 8 | 9 | volumeMount="" 10 | if [ "$DOCKER_VOLUME" != "" ]; then 11 | volumeMount="-v ${DOCKER_VOLUME}:/var/lib/docker" 12 | fi 13 | 14 | dockerMount="" 15 | if [ "$DOCKER_BINARY" != "" ]; then 16 | dockerMount="-v ${DOCKER_BINARY}:/usr/local/bin/docker" 17 | fi 18 | 19 | # Image containing the integration tests environment. 20 | INTEGRATION_IMAGE=${INTEGRATION_IMAGE:-distribution/docker-integration} 21 | 22 | # Make sure we upgrade the integration environment. 23 | docker pull $INTEGRATION_IMAGE 24 | 25 | # Start the integration tests in a Docker container. 26 | ID=$(docker run -d -t --privileged $volumeMount $dockerMount \ 27 | -v ${DISTRIBUTION_ROOT}:/go/src/github.com/docker/distribution \ 28 | -e "STORAGE_DRIVER=$DOCKER_GRAPHDRIVER" \ 29 | -e "EXEC_DRIVER=$EXEC_DRIVER" \ 30 | ${INTEGRATION_IMAGE} \ 31 | ./test_runner.sh "$@") 32 | 33 | # Clean it up when we exit. 34 | trap "docker rm -f -v $ID > /dev/null" EXIT 35 | 36 | docker logs -f $ID 37 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Bugsnag 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/garyburd/redigo/redis/test_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Gary Burd 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package redis 16 | 17 | import ( 18 | "bufio" 19 | "net" 20 | "time" 21 | ) 22 | 23 | func SetNowFunc(f func() time.Time) { 24 | nowFunc = f 25 | } 26 | 27 | type nopCloser struct{ net.Conn } 28 | 29 | func (nopCloser) Close() error { return nil } 30 | 31 | // NewConnBufio is a hook for tests. 32 | func NewConnBufio(rw bufio.ReadWriter) Conn { 33 | return &conn{br: rw.Reader, bw: rw.Writer, conn: nopCloser{}} 34 | } 35 | 36 | var ( 37 | ErrNegativeInt = errNegativeInt 38 | ) 39 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Simon Eskildsen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ncw/swift/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012 by Nick Craig-Wood http://www.craig-wood.com/nick/ 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | 21 | -------------------------------------------------------------------------------- /registry/api/errcode/handler.go: -------------------------------------------------------------------------------- 1 | package errcode 2 | 3 | import ( 4 | "encoding/json" 5 | "net/http" 6 | ) 7 | 8 | // ServeJSON attempts to serve the errcode in a JSON envelope. It marshals err 9 | // and sets the content-type header to 'application/json'. It will handle 10 | // ErrorCoder and Errors, and if necessary will create an envelope. 11 | func ServeJSON(w http.ResponseWriter, err error) error { 12 | w.Header().Set("Content-Type", "application/json; charset=utf-8") 13 | var sc int 14 | 15 | switch errs := err.(type) { 16 | case Errors: 17 | if len(errs) < 1 { 18 | break 19 | } 20 | 21 | if err, ok := errs[0].(ErrorCoder); ok { 22 | sc = err.ErrorCode().Descriptor().HTTPStatusCode 23 | } 24 | case ErrorCoder: 25 | sc = errs.ErrorCode().Descriptor().HTTPStatusCode 26 | err = Errors{err} // create an envelope. 27 | default: 28 | // We just have an unhandled error type, so just place in an envelope 29 | // and move along. 30 | err = Errors{err} 31 | } 32 | 33 | if sc == 0 { 34 | sc = http.StatusInternalServerError 35 | } 36 | 37 | w.WriteHeader(sc) 38 | 39 | if err := json.NewEncoder(w).Encode(err); err != nil { 40 | return err 41 | } 42 | 43 | return nil 44 | } 45 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/bugsnag/panicwrap/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Mitchell Hashimoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/codegangsta/cli/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013 Jeremy Saenz 2 | All Rights Reserved. 3 | 4 | MIT LICENSE 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the "Software"), to deal in 8 | the Software without restriction, including without limitation the rights to 9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | the Software, and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /docs/migration.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | # Migrating a 1.0 registry to 2.0 8 | 9 | TODO: This needs to be revised in light of Olivier's work 10 | 11 | A few thoughts here: 12 | 13 | There was no "1.0". There was an implementation of the Registry API V1 but only a version 0.9 of the service was released. 14 | The image formats are not compatible in any way. One must convert v1 images to v2 images using a docker client or other tool. 15 | One can migrate images from one version to the other by pulling images from the old registry and pushing them to the v2 registry. 16 | 17 | ----- 18 | 19 | The Docker Registry 2.0 is backward compatible with images created by the earlier specification. If you are migrating a private registry to version 2.0, you should use the following process: 20 | 21 | 1. Configure and test a 2.0 registry image in a sandbox environment. 22 | 23 | 2. Back up up your production image storage. 24 | 25 | Your production image storage should reside on a volume or storage backend. 26 | Make sure you have a backup of its contents. 27 | 28 | 3. Stop your existing registry service. 29 | 30 | 4. Restart your registry with your tested 2.0 image. -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/mitchellh/mapstructure/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Mitchell Hashimoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/AdRoll/goamz/cloudfront/cloudfront_test.go: -------------------------------------------------------------------------------- 1 | package cloudfront 2 | 3 | import ( 4 | "crypto/x509" 5 | "encoding/pem" 6 | "io/ioutil" 7 | "net/url" 8 | "testing" 9 | "time" 10 | ) 11 | 12 | func TestSignedCannedURL(t *testing.T) { 13 | rawKey, err := ioutil.ReadFile("testdata/key.pem") 14 | if err != nil { 15 | t.Fatal(err) 16 | } 17 | 18 | pemKey, _ := pem.Decode(rawKey) 19 | privateKey, err := x509.ParsePKCS1PrivateKey(pemKey.Bytes) 20 | if err != nil { 21 | t.Fatal(err) 22 | } 23 | 24 | cf := &CloudFront{ 25 | key: privateKey, 26 | keyPairId: "test-key-pair-1231245", 27 | BaseURL: "https://cloudfront.com", 28 | } 29 | 30 | expireTime, err := time.Parse(time.RFC3339, "2014-03-28T14:00:21Z") 31 | if err != nil { 32 | t.Fatal(err) 33 | } 34 | 35 | query := make(url.Values) 36 | query.Add("test", "value") 37 | 38 | uri, err := cf.CannedSignedURL("test", "test=value", expireTime) 39 | if err != nil { 40 | t.Fatal(err) 41 | } 42 | 43 | parsed, err := url.Parse(uri) 44 | if err != nil { 45 | t.Fatal(err) 46 | } 47 | 48 | signature := parsed.Query().Get("Signature") 49 | if signature == "" { 50 | t.Fatal("Encoded signature is empty") 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /registry/handlers/basicauth_prego14.go: -------------------------------------------------------------------------------- 1 | // +build !go1.4 2 | 3 | package handlers 4 | 5 | import ( 6 | "encoding/base64" 7 | "net/http" 8 | "strings" 9 | ) 10 | 11 | // NOTE(stevvooe): This is basic auth support from go1.4 present to ensure we 12 | // can compile on go1.3 and earlier. 13 | 14 | // BasicAuth returns the username and password provided in the request's 15 | // Authorization header, if the request uses HTTP Basic Authentication. 16 | // See RFC 2617, Section 2. 17 | func basicAuth(r *http.Request) (username, password string, ok bool) { 18 | auth := r.Header.Get("Authorization") 19 | if auth == "" { 20 | return 21 | } 22 | return parseBasicAuth(auth) 23 | } 24 | 25 | // parseBasicAuth parses an HTTP Basic Authentication string. 26 | // "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" returns ("Aladdin", "open sesame", true). 27 | func parseBasicAuth(auth string) (username, password string, ok bool) { 28 | if !strings.HasPrefix(auth, "Basic ") { 29 | return 30 | } 31 | c, err := base64.StdEncoding.DecodeString(strings.TrimPrefix(auth, "Basic ")) 32 | if err != nil { 33 | return 34 | } 35 | cs := string(c) 36 | s := strings.IndexByte(cs, ':') 37 | if s < 0 { 38 | return 39 | } 40 | return cs[:s], cs[s+1:], true 41 | } 42 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/examples/basic/basic.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/Sirupsen/logrus" 5 | ) 6 | 7 | var log = logrus.New() 8 | 9 | func init() { 10 | log.Formatter = new(logrus.JSONFormatter) 11 | log.Formatter = new(logrus.TextFormatter) // default 12 | log.Level = logrus.DebugLevel 13 | } 14 | 15 | func main() { 16 | defer func() { 17 | err := recover() 18 | if err != nil { 19 | log.WithFields(logrus.Fields{ 20 | "omg": true, 21 | "err": err, 22 | "number": 100, 23 | }).Fatal("The ice breaks!") 24 | } 25 | }() 26 | 27 | log.WithFields(logrus.Fields{ 28 | "animal": "walrus", 29 | "number": 8, 30 | }).Debug("Started observing beach") 31 | 32 | log.WithFields(logrus.Fields{ 33 | "animal": "walrus", 34 | "size": 10, 35 | }).Info("A group of walrus emerges from the ocean") 36 | 37 | log.WithFields(logrus.Fields{ 38 | "omg": true, 39 | "number": 122, 40 | }).Warn("The group's number increased tremendously!") 41 | 42 | log.WithFields(logrus.Fields{ 43 | "temperature": -4, 44 | }).Debug("Temperature changes") 45 | 46 | log.WithFields(logrus.Fields{ 47 | "animal": "orca", 48 | "size": 9009, 49 | }).Panic("It's over 9000!") 50 | } 51 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/json_tags.go: -------------------------------------------------------------------------------- 1 | // The code is stripped from: 2 | // http://golang.org/src/pkg/encoding/json/tags.go?m=text 3 | 4 | package bugsnag 5 | 6 | import ( 7 | "strings" 8 | ) 9 | 10 | // tagOptions is the string following a comma in a struct field's "json" 11 | // tag, or the empty string. It does not include the leading comma. 12 | type tagOptions string 13 | 14 | // parseTag splits a struct field's json tag into its name and 15 | // comma-separated options. 16 | func parseTag(tag string) (string, tagOptions) { 17 | if idx := strings.Index(tag, ","); idx != -1 { 18 | return tag[:idx], tagOptions(tag[idx+1:]) 19 | } 20 | return tag, tagOptions("") 21 | } 22 | 23 | // Contains reports whether a comma-separated list of options 24 | // contains a particular substr flag. substr must be surrounded by a 25 | // string boundary or commas. 26 | func (o tagOptions) Contains(optionName string) bool { 27 | if len(o) == 0 { 28 | return false 29 | } 30 | s := string(o) 31 | for s != "" { 32 | var next string 33 | i := strings.Index(s, ",") 34 | if i >= 0 { 35 | s, next = s[:i], s[i+1:] 36 | } 37 | if s == optionName { 38 | return true 39 | } 40 | s = next 41 | } 42 | return false 43 | } 44 | -------------------------------------------------------------------------------- /contrib/docker-integration/test_runner.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 5 | 6 | # Load the helpers. 7 | #. helpers.bash 8 | 9 | TESTS=${@:-.} 10 | 11 | # Drivers to use for Docker engines the tests are going to create. 12 | STORAGE_DRIVER=${STORAGE_DRIVER:-overlay} 13 | EXEC_DRIVER=${EXEC_DRIVER:-native} 14 | 15 | 16 | function execute() { 17 | >&2 echo "++ $@" 18 | eval "$@" 19 | } 20 | 21 | # Set IP address in /etc/hosts for localregistry 22 | IP=$(ifconfig eth0|grep "inet addr:"| cut -d: -f2 | awk '{ print $1}') 23 | execute echo "$IP localregistry" >> /etc/hosts 24 | 25 | # Setup certificates 26 | execute sh install_certs.sh localregistry 27 | 28 | # Start the docker engine. 29 | execute docker --daemon --log-level=panic \ 30 | --storage-driver="$STORAGE_DRIVER" --exec-driver="$EXEC_DRIVER" & 31 | DOCKER_PID=$! 32 | 33 | # Wait for it to become reachable. 34 | tries=10 35 | until docker version &> /dev/null; do 36 | (( tries-- )) 37 | if [ $tries -le 0 ]; then 38 | echo >&2 "error: daemon failed to start" 39 | exit 1 40 | fi 41 | sleep 1 42 | done 43 | 44 | execute time docker-compose build 45 | 46 | execute docker-compose up -d 47 | 48 | # Run the tests. 49 | execute time bats -p $TESTS 50 | 51 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/codegangsta/cli/command_test.go: -------------------------------------------------------------------------------- 1 | package cli_test 2 | 3 | import ( 4 | "flag" 5 | "testing" 6 | 7 | "github.com/codegangsta/cli" 8 | ) 9 | 10 | func TestCommandDoNotIgnoreFlags(t *testing.T) { 11 | app := cli.NewApp() 12 | set := flag.NewFlagSet("test", 0) 13 | test := []string{"blah", "blah", "-break"} 14 | set.Parse(test) 15 | 16 | c := cli.NewContext(app, set, set) 17 | 18 | command := cli.Command{ 19 | Name: "test-cmd", 20 | ShortName: "tc", 21 | Usage: "this is for testing", 22 | Description: "testing", 23 | Action: func(_ *cli.Context) {}, 24 | } 25 | err := command.Run(c) 26 | 27 | expect(t, err.Error(), "flag provided but not defined: -break") 28 | } 29 | 30 | func TestCommandIgnoreFlags(t *testing.T) { 31 | app := cli.NewApp() 32 | set := flag.NewFlagSet("test", 0) 33 | test := []string{"blah", "blah"} 34 | set.Parse(test) 35 | 36 | c := cli.NewContext(app, set, set) 37 | 38 | command := cli.Command{ 39 | Name: "test-cmd", 40 | ShortName: "tc", 41 | Usage: "this is for testing", 42 | Description: "testing", 43 | Action: func(_ *cli.Context) {}, 44 | SkipFlagParsing: true, 45 | } 46 | err := command.Run(c) 47 | 48 | expect(t, err, nil) 49 | } 50 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | // A hook to be fired when logging on the logging levels returned from 4 | // `Levels()` on your implementation of the interface. Note that this is not 5 | // fired in a goroutine or a channel with workers, you should handle such 6 | // functionality yourself if your call is non-blocking and you don't wish for 7 | // the logging calls for levels returned from `Levels()` to block. 8 | type Hook interface { 9 | Levels() []Level 10 | Fire(*Entry) error 11 | } 12 | 13 | // Internal type for storing the hooks on a logger instance. 14 | type levelHooks map[Level][]Hook 15 | 16 | // Add a hook to an instance of logger. This is called with 17 | // `log.Hooks.Add(new(MyHook))` where `MyHook` implements the `Hook` interface. 18 | func (hooks levelHooks) Add(hook Hook) { 19 | for _, level := range hook.Levels() { 20 | hooks[level] = append(hooks[level], hook) 21 | } 22 | } 23 | 24 | // Fire all the hooks for the passed level. Used by `entry.log` to fire 25 | // appropriate hooks for a log entry. 26 | func (hooks levelHooks) Fire(level Level, entry *Entry) error { 27 | for _, hook := range hooks[level] { 28 | if err := hook.Fire(entry); err != nil { 29 | return err 30 | } 31 | } 32 | 33 | return nil 34 | } 35 | -------------------------------------------------------------------------------- /contrib/compose/nginx/registry.conf: -------------------------------------------------------------------------------- 1 | # Docker registry proxy for api versions 1 and 2 2 | 3 | upstream docker-registry { 4 | server registryv1:5000; 5 | } 6 | 7 | upstream docker-registry-v2 { 8 | server registryv2:5000; 9 | } 10 | 11 | # No client auth or TLS 12 | server { 13 | listen 5000; 14 | server_name localhost; 15 | 16 | # disable any limits to avoid HTTP 413 for large image uploads 17 | client_max_body_size 0; 18 | 19 | # required to avoid HTTP 411: see Issue #1486 (https://github.com/docker/docker/issues/1486) 20 | chunked_transfer_encoding on; 21 | 22 | location /v2/ { 23 | # Do not allow connections from docker 1.5 and earlier 24 | # docker pre-1.6.0 did not properly set the user agent on ping, catch "Go *" user agents 25 | if ($http_user_agent ~ "^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$" ) { 26 | return 404; 27 | } 28 | 29 | # To add basic authentication to v2 use auth_basic setting plus add_header 30 | # auth_basic "registry.localhost"; 31 | # auth_basic_user_file test.password; 32 | # add_header 'Docker-Distribution-Api-Version' 'registry/2.0' always; 33 | 34 | include docker-registry-v2.conf; 35 | } 36 | 37 | location / { 38 | include docker-registry.conf; 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /uuid/uuid_test.go: -------------------------------------------------------------------------------- 1 | package uuid 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | const iterations = 1000 8 | 9 | func TestUUID4Generation(t *testing.T) { 10 | for i := 0; i < iterations; i++ { 11 | u := Generate() 12 | 13 | if u[6]&0xf0 != 0x40 { 14 | t.Fatalf("version byte not correctly set: %v, %08b %08b", u, u[6], u[6]&0xf0) 15 | } 16 | 17 | if u[8]&0xc0 != 0x80 { 18 | t.Fatalf("top order 8th byte not correctly set: %v, %b", u, u[8]) 19 | } 20 | } 21 | } 22 | 23 | func TestParseAndEquality(t *testing.T) { 24 | for i := 0; i < iterations; i++ { 25 | u := Generate() 26 | 27 | parsed, err := Parse(u.String()) 28 | if err != nil { 29 | t.Fatalf("error parsing uuid %v: %v", u, err) 30 | } 31 | 32 | if parsed != u { 33 | t.Fatalf("parsing round trip failed: %v != %v", parsed, u) 34 | } 35 | } 36 | 37 | for _, c := range []string{ 38 | "bad", 39 | "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", // correct length, incorrect format 40 | " 20cc7775-2671-43c7-8742-51d1cfa23258", // leading space 41 | "20cc7775-2671-43c7-8742-51d1cfa23258 ", // trailing space 42 | "00000000-0000-0000-0000-x00000000000", // out of range character 43 | } { 44 | if _, err := Parse(c); err == nil { 45 | t.Fatalf("parsing %q should have failed", c) 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/mitchellh/mapstructure/error.go: -------------------------------------------------------------------------------- 1 | package mapstructure 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "sort" 7 | "strings" 8 | ) 9 | 10 | // Error implements the error interface and can represents multiple 11 | // errors that occur in the course of a single decode. 12 | type Error struct { 13 | Errors []string 14 | } 15 | 16 | func (e *Error) Error() string { 17 | points := make([]string, len(e.Errors)) 18 | for i, err := range e.Errors { 19 | points[i] = fmt.Sprintf("* %s", err) 20 | } 21 | 22 | sort.Strings(points) 23 | return fmt.Sprintf( 24 | "%d error(s) decoding:\n\n%s", 25 | len(e.Errors), strings.Join(points, "\n")) 26 | } 27 | 28 | // WrappedErrors implements the errwrap.Wrapper interface to make this 29 | // return value more useful with the errwrap and go-multierror libraries. 30 | func (e *Error) WrappedErrors() []error { 31 | if e == nil { 32 | return nil 33 | } 34 | 35 | result := make([]error, len(e.Errors)) 36 | for i, e := range e.Errors { 37 | result[i] = errors.New(e) 38 | } 39 | 40 | return result 41 | } 42 | 43 | func appendErrors(errors []string, err error) []string { 44 | switch e := err.(type) { 45 | case *Error: 46 | return append(errors, e.Errors...) 47 | default: 48 | return append(errors, e.Error()) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /docs/osx/com.docker.registry.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Label 6 | com.docker.registry 7 | KeepAlive 8 | 9 | StandardErrorPath 10 | /Users/Shared/Registry/registry.log 11 | StandardOutPath 12 | /Users/Shared/Registry/registry.log 13 | Program 14 | /usr/local/libexec/registry 15 | ProgramArguments 16 | 17 | /usr/local/libexec/registry 18 | /Users/Shared/Registry/config.yml 19 | 20 | Sockets 21 | 22 | http-listen-address 23 | 24 | SockServiceName 25 | 5000 26 | SockType 27 | dgram 28 | SockFamily 29 | IPv4 30 | 31 | http-debug-address 32 | 33 | SockServiceName 34 | 5001 35 | SockType 36 | dgram 37 | SockFamily 38 | IPv4 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /docs/storage-drivers/azure.md: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | # Microsoft Azure storage driver 11 | 12 | An implementation of the `storagedriver.StorageDriver` interface which uses [Microsoft Azure Blob Storage][azure-blob-storage] for object storage. 13 | 14 | ## Parameters 15 | 16 | The following parameters must be used to authenticate and configure the storage driver (case-sensitive): 17 | 18 | * `accountname`: Name of the Azure Storage Account. 19 | * `accountkey`: Primary or Secondary Key for the Storage Account. 20 | * `container`: Name of the root storage container in which all registry data will be stored. Must comply the storage container name [requirements][create-container-api]. 21 | * `realm`: (optional) Domain name suffix for the Storage Service API endpoint. Defaults to `core.windows.net`. For example realm for "Azure in China" would be `core.chinacloudapi.cn` and realm for "Azure Government" would be `core.usgovcloudapi.net`. 22 | 23 | [azure-blob-storage]: http://azure.microsoft.com/en-us/services/storage/ 24 | [create-container-api]: https://msdn.microsoft.com/en-us/library/azure/dd179468.aspx 25 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/entry_test.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "testing" 7 | 8 | "github.com/stretchr/testify/assert" 9 | ) 10 | 11 | func TestEntryPanicln(t *testing.T) { 12 | errBoom := fmt.Errorf("boom time") 13 | 14 | defer func() { 15 | p := recover() 16 | assert.NotNil(t, p) 17 | 18 | switch pVal := p.(type) { 19 | case *Entry: 20 | assert.Equal(t, "kaboom", pVal.Message) 21 | assert.Equal(t, errBoom, pVal.Data["err"]) 22 | default: 23 | t.Fatalf("want type *Entry, got %T: %#v", pVal, pVal) 24 | } 25 | }() 26 | 27 | logger := New() 28 | logger.Out = &bytes.Buffer{} 29 | entry := NewEntry(logger) 30 | entry.WithField("err", errBoom).Panicln("kaboom") 31 | } 32 | 33 | func TestEntryPanicf(t *testing.T) { 34 | errBoom := fmt.Errorf("boom again") 35 | 36 | defer func() { 37 | p := recover() 38 | assert.NotNil(t, p) 39 | 40 | switch pVal := p.(type) { 41 | case *Entry: 42 | assert.Equal(t, "kaboom true", pVal.Message) 43 | assert.Equal(t, errBoom, pVal.Data["err"]) 44 | default: 45 | t.Fatalf("want type *Entry, got %T: %#v", pVal, pVal) 46 | } 47 | }() 48 | 49 | logger := New() 50 | logger.Out = &bytes.Buffer{} 51 | entry := NewEntry(logger) 52 | entry.WithField("err", errBoom).Panicf("kaboom %v", true) 53 | } 54 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/docker/libtrust/filter.go: -------------------------------------------------------------------------------- 1 | package libtrust 2 | 3 | import ( 4 | "path/filepath" 5 | ) 6 | 7 | // FilterByHosts filters the list of PublicKeys to only those which contain a 8 | // 'hosts' pattern which matches the given host. If *includeEmpty* is true, 9 | // then keys which do not specify any hosts are also returned. 10 | func FilterByHosts(keys []PublicKey, host string, includeEmpty bool) ([]PublicKey, error) { 11 | filtered := make([]PublicKey, 0, len(keys)) 12 | 13 | for _, pubKey := range keys { 14 | var hosts []string 15 | switch v := pubKey.GetExtendedField("hosts").(type) { 16 | case []string: 17 | hosts = v 18 | case []interface{}: 19 | for _, value := range v { 20 | h, ok := value.(string) 21 | if !ok { 22 | continue 23 | } 24 | hosts = append(hosts, h) 25 | } 26 | } 27 | 28 | if len(hosts) == 0 { 29 | if includeEmpty { 30 | filtered = append(filtered, pubKey) 31 | } 32 | continue 33 | } 34 | 35 | // Check if any hosts match pattern 36 | for _, hostPattern := range hosts { 37 | match, err := filepath.Match(hostPattern, host) 38 | if err != nil { 39 | return nil, err 40 | } 41 | 42 | if match { 43 | filtered = append(filtered, pubKey) 44 | continue 45 | } 46 | } 47 | } 48 | 49 | return filtered, nil 50 | } 51 | -------------------------------------------------------------------------------- /registry/handlers/hooks.go: -------------------------------------------------------------------------------- 1 | package handlers 2 | 3 | import ( 4 | "bytes" 5 | "errors" 6 | "fmt" 7 | "strings" 8 | "text/template" 9 | 10 | "github.com/Sirupsen/logrus" 11 | ) 12 | 13 | // logHook is for hooking Panic in web application 14 | type logHook struct { 15 | LevelsParam []string 16 | Mail *mailer 17 | } 18 | 19 | // Fire forwards an error to LogHook 20 | func (hook *logHook) Fire(entry *logrus.Entry) error { 21 | addr := strings.Split(hook.Mail.Addr, ":") 22 | if len(addr) != 2 { 23 | return errors.New("Invalid Mail Address") 24 | } 25 | host := addr[0] 26 | subject := fmt.Sprintf("[%s] %s: %s", entry.Level, host, entry.Message) 27 | 28 | html := ` 29 | {{.Message}} 30 | 31 | {{range $key, $value := .Data}} 32 | {{$key}}: {{$value}} 33 | {{end}} 34 | ` 35 | b := bytes.NewBuffer(make([]byte, 0)) 36 | t := template.Must(template.New("mail body").Parse(html)) 37 | if err := t.Execute(b, entry); err != nil { 38 | return err 39 | } 40 | body := fmt.Sprintf("%s", b) 41 | 42 | return hook.Mail.sendMail(subject, body) 43 | } 44 | 45 | // Levels contains hook levels to be catched 46 | func (hook *logHook) Levels() []logrus.Level { 47 | levels := []logrus.Level{} 48 | for _, v := range hook.LevelsParam { 49 | lv, _ := logrus.ParseLevel(v) 50 | levels = append(levels, lv) 51 | } 52 | return levels 53 | } 54 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/newrelic_platform_go/metrica.go: -------------------------------------------------------------------------------- 1 | package newrelic_platform_go 2 | 3 | import ( 4 | "math" 5 | ) 6 | 7 | type IMetrica interface { 8 | GetValue() (float64, error) 9 | GetName() string 10 | GetUnits() string 11 | } 12 | 13 | type MetricaValue interface{} 14 | 15 | type SimpleMetricaValue float64 16 | 17 | type AggregatedMetricaValue struct { 18 | Min float64 `json:"min"` 19 | Max float64 `json:"max"` 20 | Total float64 `json:"total"` 21 | Count int `json:"count"` 22 | SumOfSquares float64 `json:"sum_of_squares"` 23 | } 24 | 25 | func NewAggregatedMetricaValue(existValue float64, newValue float64) *AggregatedMetricaValue { 26 | v := &AggregatedMetricaValue{ 27 | Min: math.Min(newValue, existValue), 28 | Max: math.Max(newValue, existValue), 29 | Total: newValue + existValue, 30 | Count: 2, 31 | SumOfSquares: newValue*newValue + existValue*existValue, 32 | } 33 | return v 34 | } 35 | 36 | func (aggregatedValue *AggregatedMetricaValue) Aggregate(newValue float64) { 37 | aggregatedValue.Min = math.Min(newValue, aggregatedValue.Min) 38 | aggregatedValue.Max = math.Max(newValue, aggregatedValue.Max) 39 | aggregatedValue.Total += newValue 40 | aggregatedValue.Count++ 41 | aggregatedValue.SumOfSquares += newValue * newValue 42 | } 43 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/bugsnag/panicwrap/monitor.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package panicwrap 4 | 5 | import ( 6 | "github.com/bugsnag/osext" 7 | "os" 8 | "os/exec" 9 | "syscall" 10 | ) 11 | 12 | func monitor(c *WrapConfig) (int, error) { 13 | 14 | // If we're the child process, absorb panics. 15 | if Wrapped(c) { 16 | panicCh := make(chan string) 17 | 18 | go trackPanic(os.Stdin, os.Stderr, c.DetectDuration, panicCh) 19 | 20 | // Wait on the panic data 21 | panicTxt := <-panicCh 22 | if panicTxt != "" { 23 | if !c.HidePanic { 24 | os.Stderr.Write([]byte(panicTxt)) 25 | } 26 | 27 | c.Handler(panicTxt) 28 | } 29 | 30 | os.Exit(0) 31 | } 32 | 33 | exePath, err := osext.Executable() 34 | if err != nil { 35 | return -1, err 36 | } 37 | cmd := exec.Command(exePath, os.Args[1:]...) 38 | 39 | read, write, err := os.Pipe() 40 | if err != nil { 41 | return -1, err 42 | } 43 | 44 | cmd.Stdin = read 45 | cmd.Stdout = os.Stdout 46 | cmd.Stderr = os.Stderr 47 | cmd.Env = append(os.Environ(), c.CookieKey+"="+c.CookieValue) 48 | 49 | if err != nil { 50 | return -1, err 51 | } 52 | err = cmd.Start() 53 | if err != nil { 54 | return -1, err 55 | } 56 | 57 | err = syscall.Dup2(int(write.Fd()), int(os.Stderr.Fd())) 58 | if err != nil { 59 | return -1, err 60 | } 61 | 62 | return -1, nil 63 | } 64 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/gorelic/examples/example1.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "github.com/yvasiyarov/gorelic" 6 | "log" 7 | "math/rand" 8 | "runtime" 9 | "time" 10 | ) 11 | 12 | var newrelicLicense = flag.String("newrelic-license", "", "Newrelic license") 13 | 14 | func allocateAndSum(arraySize int) int { 15 | arr := make([]int, arraySize, arraySize) 16 | for i := range arr { 17 | arr[i] = rand.Int() 18 | } 19 | time.Sleep(time.Duration(rand.Intn(3000)) * time.Millisecond) 20 | 21 | result := 0 22 | for _, v := range arr { 23 | result += v 24 | } 25 | //log.Printf("Array size is: %d, sum is: %d\n", arraySize, result) 26 | return result 27 | } 28 | 29 | func doSomeJob(numRoutines int) { 30 | for { 31 | for i := 0; i < numRoutines; i++ { 32 | go allocateAndSum(rand.Intn(1024) * 1024) 33 | } 34 | log.Printf("All %d routines started\n", numRoutines) 35 | time.Sleep(1000 * time.Millisecond) 36 | runtime.GC() 37 | } 38 | } 39 | 40 | func main() { 41 | 42 | flag.Parse() 43 | if *newrelicLicense == "" { 44 | log.Fatalf("Please, pass a valid newrelic license key.\n Use --help to get more information about available options\n") 45 | } 46 | agent := gorelic.NewAgent() 47 | agent.Verbose = true 48 | agent.NewrelicLicense = *newrelicLicense 49 | agent.Run() 50 | 51 | doSomeJob(100) 52 | } 53 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/airbrake/airbrake.go: -------------------------------------------------------------------------------- 1 | package airbrake 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | 7 | "github.com/Sirupsen/logrus" 8 | "github.com/tobi/airbrake-go" 9 | ) 10 | 11 | // AirbrakeHook to send exceptions to an exception-tracking service compatible 12 | // with the Airbrake API. 13 | type airbrakeHook struct { 14 | APIKey string 15 | Endpoint string 16 | Environment string 17 | } 18 | 19 | func NewHook(endpoint, apiKey, env string) *airbrakeHook { 20 | return &airbrakeHook{ 21 | APIKey: apiKey, 22 | Endpoint: endpoint, 23 | Environment: env, 24 | } 25 | } 26 | 27 | func (hook *airbrakeHook) Fire(entry *logrus.Entry) error { 28 | airbrake.ApiKey = hook.APIKey 29 | airbrake.Endpoint = hook.Endpoint 30 | airbrake.Environment = hook.Environment 31 | 32 | var notifyErr error 33 | err, ok := entry.Data["error"].(error) 34 | if ok { 35 | notifyErr = err 36 | } else { 37 | notifyErr = errors.New(entry.Message) 38 | } 39 | 40 | airErr := airbrake.Notify(notifyErr) 41 | if airErr != nil { 42 | return fmt.Errorf("Failed to send error to Airbrake: %s", airErr) 43 | } 44 | 45 | return nil 46 | } 47 | 48 | func (hook *airbrakeHook) Levels() []logrus.Level { 49 | return []logrus.Level{ 50 | logrus.ErrorLevel, 51 | logrus.FatalLevel, 52 | logrus.PanicLevel, 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /health/health_test.go: -------------------------------------------------------------------------------- 1 | package health 2 | 3 | import ( 4 | "errors" 5 | "net/http" 6 | "net/http/httptest" 7 | "testing" 8 | ) 9 | 10 | // TestReturns200IfThereAreNoChecks ensures that the result code of the health 11 | // endpoint is 200 if there are not currently registered checks. 12 | func TestReturns200IfThereAreNoChecks(t *testing.T) { 13 | recorder := httptest.NewRecorder() 14 | 15 | req, err := http.NewRequest("GET", "https://fakeurl.com/debug/health", nil) 16 | if err != nil { 17 | t.Errorf("Failed to create request.") 18 | } 19 | 20 | StatusHandler(recorder, req) 21 | 22 | if recorder.Code != 200 { 23 | t.Errorf("Did not get a 200.") 24 | } 25 | } 26 | 27 | // TestReturns500IfThereAreErrorChecks ensures that the result code of the 28 | // health endpoint is 500 if there are health checks with errors 29 | func TestReturns503IfThereAreErrorChecks(t *testing.T) { 30 | recorder := httptest.NewRecorder() 31 | 32 | req, err := http.NewRequest("GET", "https://fakeurl.com/debug/health", nil) 33 | if err != nil { 34 | t.Errorf("Failed to create request.") 35 | } 36 | 37 | // Create a manual error 38 | Register("some_check", CheckFunc(func() error { 39 | return errors.New("This Check did not succeed") 40 | })) 41 | 42 | StatusHandler(recorder, req) 43 | 44 | if recorder.Code != 503 { 45 | t.Errorf("Did not get a 503.") 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /registry/middleware/registry/middleware.go: -------------------------------------------------------------------------------- 1 | package middleware 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/docker/distribution" 7 | ) 8 | 9 | // InitFunc is the type of a RegistryMiddleware factory function and is 10 | // used to register the constructor for different RegistryMiddleware backends. 11 | type InitFunc func(registry distribution.Namespace, options map[string]interface{}) (distribution.Namespace, error) 12 | 13 | var middlewares map[string]InitFunc 14 | 15 | // Register is used to register an InitFunc for 16 | // a RegistryMiddleware backend with the given name. 17 | func Register(name string, initFunc InitFunc) error { 18 | if middlewares == nil { 19 | middlewares = make(map[string]InitFunc) 20 | } 21 | if _, exists := middlewares[name]; exists { 22 | return fmt.Errorf("name already registered: %s", name) 23 | } 24 | 25 | middlewares[name] = initFunc 26 | 27 | return nil 28 | } 29 | 30 | // Get constructs a RegistryMiddleware with the given options using the named backend. 31 | func Get(name string, options map[string]interface{}, registry distribution.Namespace) (distribution.Namespace, error) { 32 | if middlewares != nil { 33 | if initFunc, exists := middlewares[name]; exists { 34 | return initFunc(registry, options) 35 | } 36 | } 37 | 38 | return nil, fmt.Errorf("no registry middleware registered with name: %s", name) 39 | } 40 | -------------------------------------------------------------------------------- /registry/middleware/repository/middleware.go: -------------------------------------------------------------------------------- 1 | package middleware 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/docker/distribution" 7 | ) 8 | 9 | // InitFunc is the type of a RepositoryMiddleware factory function and is 10 | // used to register the constructor for different RepositoryMiddleware backends. 11 | type InitFunc func(repository distribution.Repository, options map[string]interface{}) (distribution.Repository, error) 12 | 13 | var middlewares map[string]InitFunc 14 | 15 | // Register is used to register an InitFunc for 16 | // a RepositoryMiddleware backend with the given name. 17 | func Register(name string, initFunc InitFunc) error { 18 | if middlewares == nil { 19 | middlewares = make(map[string]InitFunc) 20 | } 21 | if _, exists := middlewares[name]; exists { 22 | return fmt.Errorf("name already registered: %s", name) 23 | } 24 | 25 | middlewares[name] = initFunc 26 | 27 | return nil 28 | } 29 | 30 | // Get constructs a RepositoryMiddleware with the given options using the named backend. 31 | func Get(name string, options map[string]interface{}, repository distribution.Repository) (distribution.Repository, error) { 32 | if middlewares != nil { 33 | if initFunc, exists := middlewares[name]; exists { 34 | return initFunc(repository, options) 35 | } 36 | } 37 | 38 | return nil, fmt.Errorf("no repository middleware registered with name: %s", name) 39 | } 40 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/meter_test.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import ( 4 | "testing" 5 | "time" 6 | ) 7 | 8 | func BenchmarkMeter(b *testing.B) { 9 | m := NewMeter() 10 | b.ResetTimer() 11 | for i := 0; i < b.N; i++ { 12 | m.Mark(1) 13 | } 14 | } 15 | 16 | func TestGetOrRegisterMeter(t *testing.T) { 17 | r := NewRegistry() 18 | NewRegisteredMeter("foo", r).Mark(47) 19 | if m := GetOrRegisterMeter("foo", r); 47 != m.Count() { 20 | t.Fatal(m) 21 | } 22 | } 23 | 24 | func TestMeterDecay(t *testing.T) { 25 | ma := meterArbiter{ 26 | ticker: time.NewTicker(1), 27 | } 28 | m := newStandardMeter() 29 | ma.meters = append(ma.meters, m) 30 | go ma.tick() 31 | m.Mark(1) 32 | rateMean := m.RateMean() 33 | time.Sleep(1) 34 | if m.RateMean() >= rateMean { 35 | t.Error("m.RateMean() didn't decrease") 36 | } 37 | } 38 | 39 | func TestMeterNonzero(t *testing.T) { 40 | m := NewMeter() 41 | m.Mark(3) 42 | if count := m.Count(); 3 != count { 43 | t.Errorf("m.Count(): 3 != %v\n", count) 44 | } 45 | } 46 | 47 | func TestMeterSnapshot(t *testing.T) { 48 | m := NewMeter() 49 | m.Mark(1) 50 | if snapshot := m.Snapshot(); m.RateMean() != snapshot.RateMean() { 51 | t.Fatal(snapshot) 52 | } 53 | } 54 | 55 | func TestMeterZero(t *testing.T) { 56 | m := NewMeter() 57 | if count := m.Count(); 0 != count { 58 | t.Errorf("m.Count(): 0 != %v\n", count) 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/stevvooe/resumable/sha256/resume.go: -------------------------------------------------------------------------------- 1 | package sha256 2 | 3 | import ( 4 | "bytes" 5 | "encoding/gob" 6 | 7 | // import to ensure that our init function runs after the standard package 8 | _ "crypto/sha256" 9 | ) 10 | 11 | // Len returns the number of bytes which have been written to the digest. 12 | func (d *digest) Len() int64 { 13 | return int64(d.len) 14 | } 15 | 16 | // State returns a snapshot of the state of the digest. 17 | func (d *digest) State() ([]byte, error) { 18 | var buf bytes.Buffer 19 | encoder := gob.NewEncoder(&buf) 20 | 21 | // We encode this way so that we do not have 22 | // to export these fields of the digest struct. 23 | vals := []interface{}{ 24 | d.h, d.x, d.nx, d.len, d.is224, 25 | } 26 | 27 | for _, val := range vals { 28 | if err := encoder.Encode(val); err != nil { 29 | return nil, err 30 | } 31 | } 32 | 33 | return buf.Bytes(), nil 34 | } 35 | 36 | // Restore resets the digest to the given state. 37 | func (d *digest) Restore(state []byte) error { 38 | decoder := gob.NewDecoder(bytes.NewReader(state)) 39 | 40 | // We decode this way so that we do not have 41 | // to export these fields of the digest struct. 42 | vals := []interface{}{ 43 | &d.h, &d.x, &d.nx, &d.len, &d.is224, 44 | } 45 | 46 | for _, val := range vals { 47 | if err := decoder.Decode(val); err != nil { 48 | return err 49 | } 50 | } 51 | 52 | return nil 53 | } 54 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/stevvooe/resumable/sha512/resume.go: -------------------------------------------------------------------------------- 1 | package sha512 2 | 3 | import ( 4 | "bytes" 5 | "encoding/gob" 6 | 7 | // import to ensure that our init function runs after the standard package 8 | _ "crypto/sha512" 9 | ) 10 | 11 | // Len returns the number of bytes which have been written to the digest. 12 | func (d *digest) Len() int64 { 13 | return int64(d.len) 14 | } 15 | 16 | // State returns a snapshot of the state of the digest. 17 | func (d *digest) State() ([]byte, error) { 18 | var buf bytes.Buffer 19 | encoder := gob.NewEncoder(&buf) 20 | 21 | // We encode this way so that we do not have 22 | // to export these fields of the digest struct. 23 | vals := []interface{}{ 24 | d.h, d.x, d.nx, d.len, d.is384, 25 | } 26 | 27 | for _, val := range vals { 28 | if err := encoder.Encode(val); err != nil { 29 | return nil, err 30 | } 31 | } 32 | 33 | return buf.Bytes(), nil 34 | } 35 | 36 | // Restore resets the digest to the given state. 37 | func (d *digest) Restore(state []byte) error { 38 | decoder := gob.NewDecoder(bytes.NewReader(state)) 39 | 40 | // We decode this way so that we do not have 41 | // to export these fields of the digest struct. 42 | vals := []interface{}{ 43 | &d.h, &d.x, &d.nx, &d.len, &d.is384, 44 | } 45 | 46 | for _, val := range vals { 47 | if err := decoder.Decode(val); err != nil { 48 | return err 49 | } 50 | } 51 | 52 | return nil 53 | } 54 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/formatters/logstash/logstash_test.go: -------------------------------------------------------------------------------- 1 | package logstash 2 | 3 | import ( 4 | "bytes" 5 | "encoding/json" 6 | "github.com/Sirupsen/logrus" 7 | "github.com/stretchr/testify/assert" 8 | "testing" 9 | ) 10 | 11 | func TestLogstashFormatter(t *testing.T) { 12 | assert := assert.New(t) 13 | 14 | lf := LogstashFormatter{Type: "abc"} 15 | 16 | fields := logrus.Fields{ 17 | "message": "def", 18 | "level": "ijk", 19 | "type": "lmn", 20 | "one": 1, 21 | "pi": 3.14, 22 | "bool": true, 23 | } 24 | 25 | entry := logrus.WithFields(fields) 26 | entry.Message = "msg" 27 | entry.Level = logrus.InfoLevel 28 | 29 | b, _ := lf.Format(entry) 30 | 31 | var data map[string]interface{} 32 | dec := json.NewDecoder(bytes.NewReader(b)) 33 | dec.UseNumber() 34 | dec.Decode(&data) 35 | 36 | // base fields 37 | assert.Equal(json.Number("1"), data["@version"]) 38 | assert.NotEmpty(data["@timestamp"]) 39 | assert.Equal("abc", data["type"]) 40 | assert.Equal("msg", data["message"]) 41 | assert.Equal("info", data["level"]) 42 | 43 | // substituted fields 44 | assert.Equal("def", data["fields.message"]) 45 | assert.Equal("ijk", data["fields.level"]) 46 | assert.Equal("lmn", data["fields.type"]) 47 | 48 | // formats 49 | assert.Equal(json.Number("1"), data["one"]) 50 | assert.Equal(json.Number("3.14"), data["pi"]) 51 | assert.Equal(true, data["bool"]) 52 | } 53 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/gorelic/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Yuriy Vasiyarov. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 15 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 16 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 18 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 20 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/newrelic_platform_go/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Yuriy Vasiyarov. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 15 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 16 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 18 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 20 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /docs/mkdocs.yml: -------------------------------------------------------------------------------- 1 | - ['registry/index.md', 'Reference', 'Docker Registry 2.0'] 2 | - ['registry/introduction.md', 'Reference', '    ▪  Introduction' ] 3 | - ['registry/deploying.md', 'Reference', '    ▪  Deploy a registry' ] 4 | - ['registry/configuration.md', 'Reference', '    ▪  Configure a registry' ] 5 | - ['registry/authentication.md', 'Reference', '    ▪  Authentication' ] 6 | - ['registry/glossary.md', 'Reference', '    ▪  Glossary' ] 7 | - ['registry/help.md', 'Reference', '    ▪  Getting help' ] 8 | - ['registry/storagedrivers.md', 'Reference', '    ▪  Storage driver model' ] 9 | - ['registry/notifications.md', 'Reference', '    ▪  Work with notifications' ] 10 | - ['registry/spec/api.md', 'Reference', '    ▪  Registry Service API v2' ] 11 | 12 | - ['registry/spec/json.md', '**HIDDEN**'] 13 | - ['registry/spec/auth/token.md', '**HIDDEN**'] 14 | - ['registry/storage-drivers/azure.md', '**HIDDEN**' ] 15 | - ['registry/storage-drivers/filesystem.md', '**HIDDEN**' ] 16 | - ['registry/storage-drivers/inmemory.md', '**HIDDEN**' ] 17 | - ['registry/storage-drivers/rados.md', '**HIDDEN**' ] 18 | - ['registry/storage-drivers/s3.md','**HIDDEN**' ] 19 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/garyburd/redigo/internal/commandinfo.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Gary Burd 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package internal 16 | 17 | import ( 18 | "strings" 19 | ) 20 | 21 | const ( 22 | WatchState = 1 << iota 23 | MultiState 24 | SubscribeState 25 | MonitorState 26 | ) 27 | 28 | type CommandInfo struct { 29 | Set, Clear int 30 | } 31 | 32 | var commandInfos = map[string]CommandInfo{ 33 | "WATCH": {Set: WatchState}, 34 | "UNWATCH": {Clear: WatchState}, 35 | "MULTI": {Set: MultiState}, 36 | "EXEC": {Clear: WatchState | MultiState}, 37 | "DISCARD": {Clear: WatchState | MultiState}, 38 | "PSUBSCRIBE": {Set: SubscribeState}, 39 | "SUBSCRIBE": {Set: SubscribeState}, 40 | "MONITOR": {Set: MonitorState}, 41 | } 42 | 43 | func LookupCommandInfo(commandName string) CommandInfo { 44 | return commandInfos[strings.ToUpper(commandName)] 45 | } 46 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/noahdesu/go-ceph/rados/rados.go: -------------------------------------------------------------------------------- 1 | package rados 2 | 3 | // #cgo LDFLAGS: -lrados 4 | // #include 5 | // #include 6 | import "C" 7 | 8 | import ( 9 | "fmt" 10 | "unsafe" 11 | ) 12 | 13 | type RadosError int 14 | 15 | func (e RadosError) Error() string { 16 | return fmt.Sprintf("rados: ret=%d", e) 17 | } 18 | 19 | // Version returns the major, minor, and patch components of the version of 20 | // the RADOS library linked against. 21 | func Version() (int, int, int) { 22 | var c_major, c_minor, c_patch C.int 23 | C.rados_version(&c_major, &c_minor, &c_patch) 24 | return int(c_major), int(c_minor), int(c_patch) 25 | } 26 | 27 | // NewConn creates a new connection object. It returns the connection and an 28 | // error, if any. 29 | func NewConn() (*Conn, error) { 30 | conn := &Conn{} 31 | ret := C.rados_create(&conn.cluster, nil) 32 | 33 | if ret == 0 { 34 | return conn, nil 35 | } else { 36 | return nil, RadosError(int(ret)) 37 | } 38 | } 39 | 40 | // NewConnWithUser creates a new connection object with a custom username. 41 | // It returns the connection and an error, if any. 42 | func NewConnWithUser(user string) (*Conn, error) { 43 | c_user := C.CString(user) 44 | defer C.free(unsafe.Pointer(c_user)) 45 | 46 | conn := &Conn{} 47 | ret := C.rados_create(&conn.cluster, c_user) 48 | 49 | if ret == 0 { 50 | return conn, nil 51 | } else { 52 | return nil, RadosError(int(ret)) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /registry/client/auth/authchallenge_test.go: -------------------------------------------------------------------------------- 1 | package auth 2 | 3 | import ( 4 | "net/http" 5 | "testing" 6 | ) 7 | 8 | func TestAuthChallengeParse(t *testing.T) { 9 | header := http.Header{} 10 | header.Add("WWW-Authenticate", `Bearer realm="https://auth.example.com/token",service="registry.example.com",other=fun,slashed="he\"\l\lo"`) 11 | 12 | challenges := parseAuthHeader(header) 13 | if len(challenges) != 1 { 14 | t.Fatalf("Unexpected number of auth challenges: %d, expected 1", len(challenges)) 15 | } 16 | challenge := challenges[0] 17 | 18 | if expected := "bearer"; challenge.Scheme != expected { 19 | t.Fatalf("Unexpected scheme: %s, expected: %s", challenge.Scheme, expected) 20 | } 21 | 22 | if expected := "https://auth.example.com/token"; challenge.Parameters["realm"] != expected { 23 | t.Fatalf("Unexpected param: %s, expected: %s", challenge.Parameters["realm"], expected) 24 | } 25 | 26 | if expected := "registry.example.com"; challenge.Parameters["service"] != expected { 27 | t.Fatalf("Unexpected param: %s, expected: %s", challenge.Parameters["service"], expected) 28 | } 29 | 30 | if expected := "fun"; challenge.Parameters["other"] != expected { 31 | t.Fatalf("Unexpected param: %s, expected: %s", challenge.Parameters["other"], expected) 32 | } 33 | 34 | if expected := "he\"llo"; challenge.Parameters["slashed"] != expected { 35 | t.Fatalf("Unexpected param: %s, expected: %s", challenge.Parameters["slashed"], expected) 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/docker/docker/pkg/tarsum/testdata/xattr/json: -------------------------------------------------------------------------------- 1 | {"id":"4439c3c7f847954100b42b267e7e5529cac1d6934db082f65795c5ca2e594d93","parent":"73b164f4437db87e96e90083c73a6592f549646ae2ec00ed33c6b9b49a5c4470","created":"2014-05-16T17:19:44.091534414Z","container":"5f92fb06cc58f357f0cde41394e2bbbb664e663974b2ac1693ab07b7a306749b","container_config":{"Hostname":"9565c6517a0e","Domainname":"","User":"","Memory":0,"MemorySwap":0,"CpuShares":0,"Cpuset":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"ExposedPorts":null,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["HOME=/","PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/bin/sh","-c","setcap 'cap_setgid,cap_setuid+ep' ./file \u0026\u0026 getcap ./file"],"Image":"73b164f4437db87e96e90083c73a6592f549646ae2ec00ed33c6b9b49a5c4470","Volumes":null,"WorkingDir":"","Entrypoint":null,"NetworkDisabled":false,"OnBuild":[]},"docker_version":"0.11.1-dev","config":{"Hostname":"9565c6517a0e","Domainname":"","User":"","Memory":0,"MemorySwap":0,"CpuShares":0,"Cpuset":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"ExposedPorts":null,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["HOME=/","PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":null,"Image":"73b164f4437db87e96e90083c73a6592f549646ae2ec00ed33c6b9b49a5c4470","Volumes":null,"WorkingDir":"","Entrypoint":null,"NetworkDisabled":false,"OnBuild":[]},"architecture":"amd64","os":"linux","Size":0} -------------------------------------------------------------------------------- /Godeps/_workspace/src/gopkg.in/yaml.v2/LICENSE.libyaml: -------------------------------------------------------------------------------- 1 | The following files were ported to Go from C files of libyaml, and thus 2 | are still covered by their original copyright and license: 3 | 4 | apic.go 5 | emitterc.go 6 | parserc.go 7 | readerc.go 8 | scannerc.go 9 | writerc.go 10 | yamlh.go 11 | yamlprivateh.go 12 | 13 | Copyright (c) 2006 Kirill Simonov 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of 16 | this software and associated documentation files (the "Software"), to deal in 17 | the Software without restriction, including without limitation the rights to 18 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 19 | of the Software, and to permit persons to whom the Software is furnished to do 20 | so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | -------------------------------------------------------------------------------- /contrib/apache/README.MD: -------------------------------------------------------------------------------- 1 | # Apache HTTPd sample for Registry v1, v2 and mirror 2 | 3 | 3 containers involved 4 | 5 | * Docker Registry v1 (registry 0.9.1) 6 | * Docker Registry v2 (registry 2.0.0) 7 | * Docker Registry v1 in mirror mode 8 | 9 | HTTP for mirror and HTTPS for v1 & v2 10 | 11 | * http://registry.example.com proxify Docker Registry 1.0 in Mirror mode 12 | * https://registry.example.com proxify Docker Registry 1.0 or 2.0 in Hosting mode 13 | 14 | ## 3 Docker containers should be started 15 | 16 | * Docker Registry 1.0 in Mirror mode : port 5001 17 | * Docker Registry 1.0 in Hosting mode : port 5000 18 | * Docker Registry 2.0 in Hosting mode : port 5002 19 | 20 | ### Registry v1 21 | 22 | docker run -d -e SETTINGS_FLAVOR=dev -v /var/lib/docker-registry/storage/hosting-v1:/tmp -p 5000:5000 registry:0.9.1" 23 | 24 | ### Mirror 25 | 26 | docker run -d -e SETTINGS_FLAVOR=dev -e STANDALONE=false -e MIRROR_SOURCE=https://registry-1.docker.io -e MIRROR_SOURCE_INDEX=https://index.docker.io \ 27 | -e MIRROR_TAGS_CACHE_TTL=172800 -v /var/lib/docker-registry/storage/mirror:/tmp -p 5001:5000 registry:0.9.1" 28 | 29 | ### Registry v2 30 | 31 | docker run -d -e SETTINGS_FLAVOR=dev -v /var/lib/axway/docker-registry/storage/hosting2-v2:/tmp -p 5002:5000 registry:2.0" 32 | 33 | # For Hosting mode access 34 | 35 | * users should have account (valid-user) to be able to fetch images 36 | * only users using account docker-deployer will be allowed to push images 37 | -------------------------------------------------------------------------------- /registry/api/v2/routes.go: -------------------------------------------------------------------------------- 1 | package v2 2 | 3 | import "github.com/gorilla/mux" 4 | 5 | // The following are definitions of the name under which all V2 routes are 6 | // registered. These symbols can be used to look up a route based on the name. 7 | const ( 8 | RouteNameBase = "base" 9 | RouteNameManifest = "manifest" 10 | RouteNameTags = "tags" 11 | RouteNameBlob = "blob" 12 | RouteNameBlobUpload = "blob-upload" 13 | RouteNameBlobUploadChunk = "blob-upload-chunk" 14 | RouteNameCatalog = "catalog" 15 | ) 16 | 17 | var allEndpoints = []string{ 18 | RouteNameManifest, 19 | RouteNameCatalog, 20 | RouteNameTags, 21 | RouteNameBlob, 22 | RouteNameBlobUpload, 23 | RouteNameBlobUploadChunk, 24 | } 25 | 26 | // Router builds a gorilla router with named routes for the various API 27 | // methods. This can be used directly by both server implementations and 28 | // clients. 29 | func Router() *mux.Router { 30 | return RouterWithPrefix("") 31 | } 32 | 33 | // RouterWithPrefix builds a gorilla router with a configured prefix 34 | // on all routes. 35 | func RouterWithPrefix(prefix string) *mux.Router { 36 | rootRouter := mux.NewRouter() 37 | router := rootRouter 38 | if prefix != "" { 39 | router = router.PathPrefix(prefix).Subrouter() 40 | } 41 | 42 | router.StrictSlash(true) 43 | 44 | for _, descriptor := range routeDescriptors { 45 | router.Path(descriptor.Path).Name(descriptor.Name) 46 | } 47 | 48 | return rootRouter 49 | } 50 | -------------------------------------------------------------------------------- /registry/storage/driver/middleware/storagemiddleware.go: -------------------------------------------------------------------------------- 1 | package storagemiddleware 2 | 3 | import ( 4 | "fmt" 5 | 6 | storagedriver "github.com/docker/distribution/registry/storage/driver" 7 | ) 8 | 9 | // InitFunc is the type of a StorageMiddleware factory function and is 10 | // used to register the constructor for different StorageMiddleware backends. 11 | type InitFunc func(storageDriver storagedriver.StorageDriver, options map[string]interface{}) (storagedriver.StorageDriver, error) 12 | 13 | var storageMiddlewares map[string]InitFunc 14 | 15 | // Register is used to register an InitFunc for 16 | // a StorageMiddleware backend with the given name. 17 | func Register(name string, initFunc InitFunc) error { 18 | if storageMiddlewares == nil { 19 | storageMiddlewares = make(map[string]InitFunc) 20 | } 21 | if _, exists := storageMiddlewares[name]; exists { 22 | return fmt.Errorf("name already registered: %s", name) 23 | } 24 | 25 | storageMiddlewares[name] = initFunc 26 | 27 | return nil 28 | } 29 | 30 | // Get constructs a StorageMiddleware with the given options using the named backend. 31 | func Get(name string, options map[string]interface{}, storageDriver storagedriver.StorageDriver) (storagedriver.StorageDriver, error) { 32 | if storageMiddlewares != nil { 33 | if initFunc, exists := storageMiddlewares[name]; exists { 34 | return initFunc(storageDriver, options) 35 | } 36 | } 37 | 38 | return nil, fmt.Errorf("no storage middleware registered with name: %s", name) 39 | } 40 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/docker/docker/pkg/tarsum/testdata/46af0962ab5afeb5ce6740d4d91652e69206fc991fd5328c1a94d364ad00e457/json: -------------------------------------------------------------------------------- 1 | {"id":"46af0962ab5afeb5ce6740d4d91652e69206fc991fd5328c1a94d364ad00e457","parent":"def3f9165934325dfd027c86530b2ea49bb57a0963eb1336b3a0415ff6fd56de","created":"2014-04-07T02:45:52.610504484Z","container":"e0f07f8d72cae171a3dcc35859960e7e956e0628bce6fedc4122bf55b2c287c7","container_config":{"Hostname":"88807319f25e","Domainname":"","User":"","Memory":0,"MemorySwap":0,"CpuShares":0,"AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"ExposedPorts":null,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["HOME=/","PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/bin/sh","-c","sed -ri 's/^(%wheel.*)(ALL)$/\\1NOPASSWD: \\2/' /etc/sudoers"],"Image":"def3f9165934325dfd027c86530b2ea49bb57a0963eb1336b3a0415ff6fd56de","Volumes":null,"WorkingDir":"","Entrypoint":null,"NetworkDisabled":false,"OnBuild":[]},"docker_version":"0.9.1-dev","config":{"Hostname":"88807319f25e","Domainname":"","User":"","Memory":0,"MemorySwap":0,"CpuShares":0,"AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"ExposedPorts":null,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["HOME=/","PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":null,"Image":"def3f9165934325dfd027c86530b2ea49bb57a0963eb1336b3a0415ff6fd56de","Volumes":null,"WorkingDir":"","Entrypoint":null,"NetworkDisabled":false,"OnBuild":[]},"architecture":"amd64","os":"linux","Size":3425} -------------------------------------------------------------------------------- /Godeps/_workspace/src/gopkg.in/check.v1/LICENSE: -------------------------------------------------------------------------------- 1 | Gocheck - A rich testing framework for Go 2 | 3 | Copyright (c) 2010-2013 Gustavo Niemeyer 4 | 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/formatters/logstash/logstash.go: -------------------------------------------------------------------------------- 1 | package logstash 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | 7 | "github.com/Sirupsen/logrus" 8 | ) 9 | 10 | // Formatter generates json in logstash format. 11 | // Logstash site: http://logstash.net/ 12 | type LogstashFormatter struct { 13 | Type string // if not empty use for logstash type field. 14 | 15 | // TimestampFormat sets the format used for timestamps. 16 | TimestampFormat string 17 | } 18 | 19 | func (f *LogstashFormatter) Format(entry *logrus.Entry) ([]byte, error) { 20 | entry.Data["@version"] = 1 21 | 22 | if f.TimestampFormat == "" { 23 | f.TimestampFormat = logrus.DefaultTimestampFormat 24 | } 25 | 26 | entry.Data["@timestamp"] = entry.Time.Format(f.TimestampFormat) 27 | 28 | // set message field 29 | v, ok := entry.Data["message"] 30 | if ok { 31 | entry.Data["fields.message"] = v 32 | } 33 | entry.Data["message"] = entry.Message 34 | 35 | // set level field 36 | v, ok = entry.Data["level"] 37 | if ok { 38 | entry.Data["fields.level"] = v 39 | } 40 | entry.Data["level"] = entry.Level.String() 41 | 42 | // set type field 43 | if f.Type != "" { 44 | v, ok = entry.Data["type"] 45 | if ok { 46 | entry.Data["fields.type"] = v 47 | } 48 | entry.Data["type"] = f.Type 49 | } 50 | 51 | serialized, err := json.Marshal(entry.Data) 52 | if err != nil { 53 | return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err) 54 | } 55 | return append(serialized, '\n'), nil 56 | } 57 | -------------------------------------------------------------------------------- /docs/storage-drivers/rados.md: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | # Ceph RADOS storage driver 11 | 12 | An implementation of the `storagedriver.StorageDriver` interface which uses 13 | [Ceph RADOS Object Storage][rados] for storage backend. 14 | 15 | ## Parameters 16 | 17 | The following parameters must be used to configure the storage driver 18 | (case-sensitive): 19 | 20 | * `poolname`: Name of the Ceph pool 21 | * `username` *optional*: The user to connect as (i.e. admin, not client.admin) 22 | * `chunksize` *optional*: Size of the written RADOS objects. Default value is 23 | 4MB (4194304). 24 | 25 | This drivers loads the [Ceph client configuration][rados-config] from the 26 | following regular paths (the first found is used): 27 | 28 | * `$CEPH_CONF` (environment variable) 29 | * `/etc/ceph/ceph.conf` 30 | * `~/.ceph/config` 31 | * `ceph.conf` (in the current working directory) 32 | 33 | ## Developing 34 | 35 | To include this driver when building Docker Distribution, use the build tag 36 | `include_rados`. Please see the [building documentation][building] for details. 37 | 38 | [rados]: http://ceph.com/docs/master/rados/ 39 | [rados-config]: http://ceph.com/docs/master/rados/configuration/ceph-conf/ 40 | [building]: https://github.com/docker/distribution/blob/master/docs/building.md#optional-build-tags 41 | -------------------------------------------------------------------------------- /cmd/registry/config.yml: -------------------------------------------------------------------------------- 1 | version: 0.1 2 | log: 3 | level: debug 4 | fields: 5 | service: registry 6 | environment: development 7 | hooks: 8 | - type: mail 9 | disabled: true 10 | levels: 11 | - panic 12 | options: 13 | smtp: 14 | addr: mail.example.com:25 15 | username: mailuser 16 | password: password 17 | insecure: true 18 | from: sender@example.com 19 | to: 20 | - errors@example.com 21 | storage: 22 | cache: 23 | blobdescriptor: redis 24 | filesystem: 25 | rootdirectory: /var/lib/registry 26 | maintenance: 27 | uploadpurging: 28 | enabled: false 29 | http: 30 | addr: :5000 31 | secret: asecretforlocaldevelopment 32 | debug: 33 | addr: localhost:5001 34 | redis: 35 | addr: localhost:6379 36 | pool: 37 | maxidle: 16 38 | maxactive: 64 39 | idletimeout: 300s 40 | dialtimeout: 10ms 41 | readtimeout: 10ms 42 | writetimeout: 10ms 43 | notifications: 44 | endpoints: 45 | - name: local-5003 46 | url: http://localhost:5003/callback 47 | headers: 48 | Authorization: [Bearer ] 49 | timeout: 1s 50 | threshold: 10 51 | backoff: 1s 52 | disabled: true 53 | - name: local-8083 54 | url: http://localhost:8083/callback 55 | timeout: 1s 56 | threshold: 10 57 | backoff: 1s 58 | disabled: true 59 | 60 | -------------------------------------------------------------------------------- /registry/storage/cache/redis/redis_test.go: -------------------------------------------------------------------------------- 1 | package redis 2 | 3 | import ( 4 | "flag" 5 | "os" 6 | "testing" 7 | "time" 8 | 9 | "github.com/docker/distribution/registry/storage/cache" 10 | "github.com/garyburd/redigo/redis" 11 | ) 12 | 13 | var redisAddr string 14 | 15 | func init() { 16 | flag.StringVar(&redisAddr, "test.registry.storage.cache.redis.addr", "", "configure the address of a test instance of redis") 17 | } 18 | 19 | // TestRedisLayerInfoCache exercises a live redis instance using the cache 20 | // implementation. 21 | func TestRedisBlobDescriptorCacheProvider(t *testing.T) { 22 | if redisAddr == "" { 23 | // fallback to an environement variable 24 | redisAddr = os.Getenv("TEST_REGISTRY_STORAGE_CACHE_REDIS_ADDR") 25 | } 26 | 27 | if redisAddr == "" { 28 | // skip if still not set 29 | t.Skip("please set -registry.storage.cache.redis to test layer info cache against redis") 30 | } 31 | 32 | pool := &redis.Pool{ 33 | Dial: func() (redis.Conn, error) { 34 | return redis.Dial("tcp", redisAddr) 35 | }, 36 | MaxIdle: 1, 37 | MaxActive: 2, 38 | TestOnBorrow: func(c redis.Conn, t time.Time) error { 39 | _, err := c.Do("PING") 40 | return err 41 | }, 42 | Wait: false, // if a connection is not avialable, proceed without cache. 43 | } 44 | 45 | // Clear the database 46 | if _, err := pool.Get().Do("FLUSHDB"); err != nil { 47 | t.Fatalf("unexpected error flushing redis db: %v", err) 48 | } 49 | 50 | cache.CheckBlobDescriptorCache(t, NewRedisBlobDescriptorCacheProvider(pool)) 51 | } 52 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ncw/swift/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package swift provides an easy to use interface to Swift / Openstack Object Storage / Rackspace Cloud Files 3 | 4 | Standard Usage 5 | 6 | Most of the work is done through the Container*() and Object*() methods. 7 | 8 | All methods are safe to use concurrently in multiple go routines. 9 | 10 | Object Versioning 11 | 12 | As defined by http://docs.openstack.org/api/openstack-object-storage/1.0/content/Object_Versioning-e1e3230.html#d6e983 one can create a container which allows for version control of files. The suggested method is to create a version container for holding all non-current files, and a current container for holding the latest version that the file points to. The container and objects inside it can be used in the standard manner, however, pushing a file multiple times will result in it being copied to the version container and the new file put in it's place. If the current file is deleted, the previous file in the version container will replace it. This means that if a file is updated 5 times, it must be deleted 5 times to be completely removed from the system. 13 | 14 | Rackspace Sub Module 15 | 16 | This module specifically allows the enabling/disabling of Rackspace Cloud File CDN management on a container. This is specific to the Rackspace API and not Swift/Openstack, therefore it has been placed in a submodule. One can easily create a RsConnection and use it like the standard Connection to access and manipulate containers and objects. 17 | 18 | */ 19 | package swift 20 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/docker/libtrust/hash.go: -------------------------------------------------------------------------------- 1 | package libtrust 2 | 3 | import ( 4 | "crypto" 5 | _ "crypto/sha256" // Registrer SHA224 and SHA256 6 | _ "crypto/sha512" // Registrer SHA384 and SHA512 7 | "fmt" 8 | ) 9 | 10 | type signatureAlgorithm struct { 11 | algHeaderParam string 12 | hashID crypto.Hash 13 | } 14 | 15 | func (h *signatureAlgorithm) HeaderParam() string { 16 | return h.algHeaderParam 17 | } 18 | 19 | func (h *signatureAlgorithm) HashID() crypto.Hash { 20 | return h.hashID 21 | } 22 | 23 | var ( 24 | rs256 = &signatureAlgorithm{"RS256", crypto.SHA256} 25 | rs384 = &signatureAlgorithm{"RS384", crypto.SHA384} 26 | rs512 = &signatureAlgorithm{"RS512", crypto.SHA512} 27 | es256 = &signatureAlgorithm{"ES256", crypto.SHA256} 28 | es384 = &signatureAlgorithm{"ES384", crypto.SHA384} 29 | es512 = &signatureAlgorithm{"ES512", crypto.SHA512} 30 | ) 31 | 32 | func rsaSignatureAlgorithmByName(alg string) (*signatureAlgorithm, error) { 33 | switch { 34 | case alg == "RS256": 35 | return rs256, nil 36 | case alg == "RS384": 37 | return rs384, nil 38 | case alg == "RS512": 39 | return rs512, nil 40 | default: 41 | return nil, fmt.Errorf("RSA Digital Signature Algorithm %q not supported", alg) 42 | } 43 | } 44 | 45 | func rsaPKCS1v15SignatureAlgorithmForHashID(hashID crypto.Hash) *signatureAlgorithm { 46 | switch { 47 | case hashID == crypto.SHA512: 48 | return rs512 49 | case hashID == crypto.SHA384: 50 | return rs384 51 | case hashID == crypto.SHA256: 52 | fallthrough 53 | default: 54 | return rs256 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /registry/storage/driver/azure/blockid.go: -------------------------------------------------------------------------------- 1 | package azure 2 | 3 | import ( 4 | "encoding/base64" 5 | "fmt" 6 | "math/rand" 7 | "sync" 8 | "time" 9 | 10 | azure "github.com/Azure/azure-sdk-for-go/storage" 11 | ) 12 | 13 | type blockIDGenerator struct { 14 | pool map[string]bool 15 | r *rand.Rand 16 | m sync.Mutex 17 | } 18 | 19 | // Generate returns an unused random block id and adds the generated ID 20 | // to list of used IDs so that the same block name is not used again. 21 | func (b *blockIDGenerator) Generate() string { 22 | b.m.Lock() 23 | defer b.m.Unlock() 24 | 25 | var id string 26 | for { 27 | id = toBlockID(int(b.r.Int())) 28 | if !b.exists(id) { 29 | break 30 | } 31 | } 32 | b.pool[id] = true 33 | return id 34 | } 35 | 36 | func (b *blockIDGenerator) exists(id string) bool { 37 | _, used := b.pool[id] 38 | return used 39 | } 40 | 41 | func (b *blockIDGenerator) Feed(blocks azure.BlockListResponse) { 42 | b.m.Lock() 43 | defer b.m.Unlock() 44 | 45 | for _, bl := range append(blocks.CommittedBlocks, blocks.UncommittedBlocks...) { 46 | b.pool[bl.Name] = true 47 | } 48 | } 49 | 50 | func newBlockIDGenerator() *blockIDGenerator { 51 | return &blockIDGenerator{ 52 | pool: make(map[string]bool), 53 | r: rand.New(rand.NewSource(time.Now().UnixNano()))} 54 | } 55 | 56 | // toBlockId converts given integer to base64-encoded block ID of a fixed length. 57 | func toBlockID(i int) string { 58 | s := fmt.Sprintf("%029d", i) // add zero padding for same length-blobs 59 | return base64.StdEncoding.EncodeToString([]byte(s)) 60 | } 61 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ncw/swift/timeout_reader.go: -------------------------------------------------------------------------------- 1 | package swift 2 | 3 | import ( 4 | "io" 5 | "time" 6 | ) 7 | 8 | // An io.ReadCloser which obeys an idle timeout 9 | type timeoutReader struct { 10 | reader io.ReadCloser 11 | timeout time.Duration 12 | cancel func() 13 | } 14 | 15 | // Returns a wrapper around the reader which obeys an idle 16 | // timeout. The cancel function is called if the timeout happens 17 | func newTimeoutReader(reader io.ReadCloser, timeout time.Duration, cancel func()) *timeoutReader { 18 | return &timeoutReader{ 19 | reader: reader, 20 | timeout: timeout, 21 | cancel: cancel, 22 | } 23 | } 24 | 25 | // Read reads up to len(p) bytes into p 26 | // 27 | // Waits at most for timeout for the read to complete otherwise returns a timeout 28 | func (t *timeoutReader) Read(p []byte) (int, error) { 29 | // FIXME limit the amount of data read in one chunk so as to not exceed the timeout? 30 | // Do the read in the background 31 | type result struct { 32 | n int 33 | err error 34 | } 35 | done := make(chan result, 1) 36 | go func() { 37 | n, err := t.reader.Read(p) 38 | done <- result{n, err} 39 | }() 40 | // Wait for the read or the timeout 41 | select { 42 | case r := <-done: 43 | return r.n, r.err 44 | case <-time.After(t.timeout): 45 | t.cancel() 46 | return 0, TimeoutError 47 | } 48 | panic("unreachable") // for Go 1.0 49 | } 50 | 51 | // Close the channel 52 | func (t *timeoutReader) Close() error { 53 | return t.reader.Close() 54 | } 55 | 56 | // Check it satisfies the interface 57 | var _ io.ReadCloser = &timeoutReader{} 58 | -------------------------------------------------------------------------------- /contrib/docker-integration/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | MAINTAINER Docker Distribution Team 4 | 5 | # compile and runtime deps 6 | # https://github.com/docker/docker/blob/master/project/PACKAGERS.md#runtime-dependencies 7 | RUN apt-get update && apt-get install -y --no-install-recommends \ 8 | # For DIND 9 | ca-certificates \ 10 | curl \ 11 | iptables \ 12 | procps \ 13 | e2fsprogs \ 14 | xz-utils \ 15 | # For build 16 | build-essential \ 17 | file \ 18 | git \ 19 | net-tools \ 20 | && apt-get clean && rm -rf /var/lib/apt/lists/* 21 | 22 | # Install Docker 23 | ENV VERSION 1.7.0-rc1 24 | RUN curl -L -o /usr/local/bin/docker https://test.docker.com/builds/Linux/x86_64/docker-${VERSION} \ 25 | && chmod +x /usr/local/bin/docker 26 | 27 | # Install DIND 28 | RUN curl -L -o /dind https://raw.githubusercontent.com/docker/docker/master/hack/dind \ 29 | && chmod +x /dind 30 | 31 | # Install bats 32 | RUN cd /usr/local/src/ \ 33 | && git clone https://github.com/sstephenson/bats.git \ 34 | && cd bats \ 35 | && ./install.sh /usr/local 36 | 37 | # Install docker-compose 38 | RUN curl -L https://github.com/docker/compose/releases/download/1.2.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose \ 39 | && chmod +x /usr/local/bin/docker-compose 40 | 41 | RUN mkdir -p /go/src/github.com/docker/distribution 42 | WORKDIR /go/src/github.com/docker/distribution/contrib/docker-integration 43 | 44 | VOLUME /var/lib/docker 45 | 46 | ENTRYPOINT ["/dind"] 47 | -------------------------------------------------------------------------------- /registry/storage/driver/azure/zerofillwriter.go: -------------------------------------------------------------------------------- 1 | package azure 2 | 3 | import ( 4 | "bytes" 5 | "io" 6 | ) 7 | 8 | type blockBlobWriter interface { 9 | GetSize(container, blob string) (int64, error) 10 | WriteBlobAt(container, blob string, offset int64, chunk io.Reader) (int64, error) 11 | } 12 | 13 | // zeroFillWriter enables writing to an offset outside a block blob's size 14 | // by offering the chunk to the underlying writer as a contiguous data with 15 | // the gap in between filled with NUL (zero) bytes. 16 | type zeroFillWriter struct { 17 | blockBlobWriter 18 | } 19 | 20 | func newZeroFillWriter(b blockBlobWriter) zeroFillWriter { 21 | w := zeroFillWriter{} 22 | w.blockBlobWriter = b 23 | return w 24 | } 25 | 26 | // Write writes the given chunk to the specified existing blob even though 27 | // offset is out of blob's size. The gaps are filled with zeros. Returned 28 | // written number count does not include zeros written. 29 | func (z *zeroFillWriter) Write(container, blob string, offset int64, chunk io.Reader) (int64, error) { 30 | size, err := z.blockBlobWriter.GetSize(container, blob) 31 | if err != nil { 32 | return 0, err 33 | } 34 | 35 | var reader io.Reader 36 | var zeroPadding int64 37 | if offset <= size { 38 | reader = chunk 39 | } else { 40 | zeroPadding = offset - size 41 | offset = size // adjust offset to be the append index 42 | zeros := bytes.NewReader(make([]byte, zeroPadding)) 43 | reader = io.MultiReader(zeros, chunk) 44 | } 45 | 46 | nn, err := z.blockBlobWriter.WriteBlobAt(container, blob, offset, reader) 47 | nn -= zeroPadding 48 | return nn, err 49 | } 50 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/gorilla/context/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Rodrigo Moraes. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/gorilla/mux/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Rodrigo Moraes. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/docker/docker/pkg/tarsum/testdata/511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158/layer.tar: -------------------------------------------------------------------------------- 1 | ./0040755000000000000000000000000012156431635007413 5ustar0000000000000000 -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/stevvooe/resumable/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/papertrail/papertrail.go: -------------------------------------------------------------------------------- 1 | package logrus_papertrail 2 | 3 | import ( 4 | "fmt" 5 | "net" 6 | "os" 7 | "time" 8 | 9 | "github.com/Sirupsen/logrus" 10 | ) 11 | 12 | const ( 13 | format = "Jan 2 15:04:05" 14 | ) 15 | 16 | // PapertrailHook to send logs to a logging service compatible with the Papertrail API. 17 | type PapertrailHook struct { 18 | Host string 19 | Port int 20 | AppName string 21 | UDPConn net.Conn 22 | } 23 | 24 | // NewPapertrailHook creates a hook to be added to an instance of logger. 25 | func NewPapertrailHook(host string, port int, appName string) (*PapertrailHook, error) { 26 | conn, err := net.Dial("udp", fmt.Sprintf("%s:%d", host, port)) 27 | return &PapertrailHook{host, port, appName, conn}, err 28 | } 29 | 30 | // Fire is called when a log event is fired. 31 | func (hook *PapertrailHook) Fire(entry *logrus.Entry) error { 32 | date := time.Now().Format(format) 33 | msg, _ := entry.String() 34 | payload := fmt.Sprintf("<22> %s %s: %s", date, hook.AppName, msg) 35 | 36 | bytesWritten, err := hook.UDPConn.Write([]byte(payload)) 37 | if err != nil { 38 | fmt.Fprintf(os.Stderr, "Unable to send log line to Papertrail via UDP. Wrote %d bytes before error: %v", bytesWritten, err) 39 | return err 40 | } 41 | 42 | return nil 43 | } 44 | 45 | // Levels returns the available logging levels. 46 | func (hook *PapertrailHook) Levels() []logrus.Level { 47 | return []logrus.Level{ 48 | logrus.PanicLevel, 49 | logrus.FatalLevel, 50 | logrus.ErrorLevel, 51 | logrus.WarnLevel, 52 | logrus.InfoLevel, 53 | logrus.DebugLevel, 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/formatter.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import "time" 4 | 5 | const DefaultTimestampFormat = time.RFC3339 6 | 7 | // The Formatter interface is used to implement a custom Formatter. It takes an 8 | // `Entry`. It exposes all the fields, including the default ones: 9 | // 10 | // * `entry.Data["msg"]`. The message passed from Info, Warn, Error .. 11 | // * `entry.Data["time"]`. The timestamp. 12 | // * `entry.Data["level"]. The level the entry was logged at. 13 | // 14 | // Any additional fields added with `WithField` or `WithFields` are also in 15 | // `entry.Data`. Format is expected to return an array of bytes which are then 16 | // logged to `logger.Out`. 17 | type Formatter interface { 18 | Format(*Entry) ([]byte, error) 19 | } 20 | 21 | // This is to not silently overwrite `time`, `msg` and `level` fields when 22 | // dumping it. If this code wasn't there doing: 23 | // 24 | // logrus.WithField("level", 1).Info("hello") 25 | // 26 | // Would just silently drop the user provided level. Instead with this code 27 | // it'll logged as: 28 | // 29 | // {"level": "info", "fields.level": 1, "msg": "hello", "time": "..."} 30 | // 31 | // It's not exported because it's still using Data in an opinionated way. It's to 32 | // avoid code duplication between the two default formatters. 33 | func prefixFieldClashes(data Fields) { 34 | _, ok := data["time"] 35 | if ok { 36 | data["fields.time"] = data["time"] 37 | } 38 | 39 | _, ok = data["msg"] 40 | if ok { 41 | data["fields.msg"] = data["msg"] 42 | } 43 | 44 | _, ok = data["level"] 45 | if ok { 46 | data["fields.level"] = data["level"] 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /docs/osx-setup-guide.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | # OS X Setup Guide 8 | 9 | This guide will walk you through running the new Go based [Docker registry](https://github.com/docker/distribution) on your local OS X machine. 10 | 11 | ## Checkout the Docker Distribution source tree 12 | 13 | ``` 14 | mkdir -p $GOPATH/src/github.com/docker 15 | git clone https://github.com/docker/distribution.git $GOPATH/src/github.com/docker/distribution 16 | cd $GOPATH/src/github.com/docker/distribution 17 | ``` 18 | 19 | ## Build the registry binary 20 | 21 | ``` 22 | GOPATH=$(PWD)/Godeps/_workspace:$GOPATH make binaries 23 | sudo cp bin/registry /usr/local/libexec/registry 24 | ``` 25 | 26 | ## Setup 27 | 28 | Copy the registry configuration file in place: 29 | 30 | ``` 31 | mkdir /Users/Shared/Registry 32 | cp docs/osx/config.yml /Users/Shared/Registry/config.yml 33 | ``` 34 | 35 | ## Running the Docker Registry under launchd 36 | 37 | Copy the Docker registry plist into place: 38 | 39 | ``` 40 | plutil -lint docs/osx/com.docker.registry.plist 41 | cp docs/osx/com.docker.registry.plist ~/Library/LaunchAgents/ 42 | chmod 644 ~/Library/LaunchAgents/com.docker.registry.plist 43 | ``` 44 | 45 | Start the Docker registry: 46 | 47 | ``` 48 | launchctl load ~/Library/LaunchAgents/com.docker.registry.plist 49 | ``` 50 | 51 | ### Restarting the docker registry service 52 | 53 | ``` 54 | launchctl stop com.docker.registry 55 | launchctl start com.docker.registry 56 | ``` 57 | 58 | ### Unloading the docker registry service 59 | 60 | ``` 61 | launchctl unload ~/Library/LaunchAgents/com.docker.registry.plist 62 | ``` 63 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/bugsnag/bugsnag_test.go: -------------------------------------------------------------------------------- 1 | package logrus_bugsnag 2 | 3 | import ( 4 | "encoding/json" 5 | "errors" 6 | "io/ioutil" 7 | "net/http" 8 | "net/http/httptest" 9 | "testing" 10 | "time" 11 | 12 | "github.com/Sirupsen/logrus" 13 | "github.com/bugsnag/bugsnag-go" 14 | ) 15 | 16 | type notice struct { 17 | Events []struct { 18 | Exceptions []struct { 19 | Message string `json:"message"` 20 | } `json:"exceptions"` 21 | } `json:"events"` 22 | } 23 | 24 | func TestNoticeReceived(t *testing.T) { 25 | msg := make(chan string, 1) 26 | expectedMsg := "foo" 27 | 28 | ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 29 | var notice notice 30 | data, _ := ioutil.ReadAll(r.Body) 31 | if err := json.Unmarshal(data, ¬ice); err != nil { 32 | t.Error(err) 33 | } 34 | _ = r.Body.Close() 35 | 36 | msg <- notice.Events[0].Exceptions[0].Message 37 | })) 38 | defer ts.Close() 39 | 40 | hook := &bugsnagHook{} 41 | 42 | bugsnag.Configure(bugsnag.Configuration{ 43 | Endpoint: ts.URL, 44 | ReleaseStage: "production", 45 | APIKey: "12345678901234567890123456789012", 46 | Synchronous: true, 47 | }) 48 | 49 | log := logrus.New() 50 | log.Hooks.Add(hook) 51 | 52 | log.WithFields(logrus.Fields{ 53 | "error": errors.New(expectedMsg), 54 | }).Error("Bugsnag will not see this string") 55 | 56 | select { 57 | case received := <-msg: 58 | if received != expectedMsg { 59 | t.Errorf("Unexpected message received: %s", received) 60 | } 61 | case <-time.After(time.Second): 62 | t.Error("Timed out; no notice received by Bugsnag API") 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2012 Richard Crowley. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | 1. Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following 12 | disclaimer in the documentation and/or other materials provided 13 | with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY RICHARD CROWLEY ``AS IS'' AND ANY EXPRESS 16 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL RICHARD CROWLEY OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | The views and conclusions contained in the software and documentation 28 | are those of the authors and should not be interpreted as representing 29 | official policies, either expressed or implied, of Richard Crowley. 30 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/yvasiyarov/gorelic/examples/example_web.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "expvar" 5 | "flag" 6 | "github.com/yvasiyarov/gorelic" 7 | "io" 8 | "log" 9 | "math/rand" 10 | "net/http" 11 | "runtime" 12 | "time" 13 | ) 14 | 15 | var newrelicLicense = flag.String("newrelic-license", "", "Newrelic license") 16 | 17 | var numCalls = expvar.NewInt("num_calls") 18 | 19 | func allocateAndSum(arraySize int) int { 20 | arr := make([]int, arraySize, arraySize) 21 | for i := range arr { 22 | arr[i] = rand.Int() 23 | } 24 | time.Sleep(time.Duration(rand.Intn(3000)) * time.Millisecond) 25 | 26 | result := 0 27 | for _, v := range arr { 28 | result += v 29 | } 30 | //log.Printf("Array size is: %d, sum is: %d\n", arraySize, result) 31 | return result 32 | } 33 | 34 | func doSomeJob(numRoutines int) { 35 | for i := 0; i < numRoutines; i++ { 36 | go allocateAndSum(rand.Intn(1024) * 1024) 37 | } 38 | log.Printf("All %d routines started\n", numRoutines) 39 | time.Sleep(1000 * time.Millisecond) 40 | runtime.GC() 41 | } 42 | 43 | func helloServer(w http.ResponseWriter, req *http.Request) { 44 | 45 | doSomeJob(5) 46 | io.WriteString(w, "Did some work") 47 | } 48 | 49 | func main() { 50 | flag.Parse() 51 | if *newrelicLicense == "" { 52 | log.Fatalf("Please, pass a valid newrelic license key.\n Use --help to get more information about available options\n") 53 | } 54 | agent := gorelic.NewAgent() 55 | agent.Verbose = true 56 | agent.CollectHTTPStat = true 57 | agent.NewrelicLicense = *newrelicLicense 58 | agent.Run() 59 | 60 | http.HandleFunc("/", agent.WrapHTTPHandlerFunc(helloServer)) 61 | http.ListenAndServe(":8080", nil) 62 | 63 | } 64 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/papertrail/README.md: -------------------------------------------------------------------------------- 1 | # Papertrail Hook for Logrus :walrus: 2 | 3 | [Papertrail](https://papertrailapp.com) provides hosted log management. Once stored in Papertrail, you can [group](http://help.papertrailapp.com/kb/how-it-works/groups/) your logs on various dimensions, [search](http://help.papertrailapp.com/kb/how-it-works/search-syntax) them, and trigger [alerts](http://help.papertrailapp.com/kb/how-it-works/alerts). 4 | 5 | In most deployments, you'll want to send logs to Papertrail via their [remote_syslog](http://help.papertrailapp.com/kb/configuration/configuring-centralized-logging-from-text-log-files-in-unix/) daemon, which requires no application-specific configuration. This hook is intended for relatively low-volume logging, likely in managed cloud hosting deployments where installing `remote_syslog` is not possible. 6 | 7 | ## Usage 8 | 9 | You can find your Papertrail UDP port on your [Papertrail account page](https://papertrailapp.com/account/destinations). Substitute it below for `YOUR_PAPERTRAIL_UDP_PORT`. 10 | 11 | For `YOUR_APP_NAME`, substitute a short string that will readily identify your application or service in the logs. 12 | 13 | ```go 14 | import ( 15 | "log/syslog" 16 | "github.com/Sirupsen/logrus" 17 | "github.com/Sirupsen/logrus/hooks/papertrail" 18 | ) 19 | 20 | func main() { 21 | log := logrus.New() 22 | hook, err := logrus_papertrail.NewPapertrailHook("logs.papertrailapp.com", YOUR_PAPERTRAIL_UDP_PORT, YOUR_APP_NAME) 23 | 24 | if err == nil { 25 | log.Hooks.Add(hook) 26 | } 27 | } 28 | ``` 29 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/docker/libtrust/tlsdemo/gencert.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "encoding/pem" 5 | "fmt" 6 | "log" 7 | "net" 8 | 9 | "github.com/docker/libtrust" 10 | ) 11 | 12 | var ( 13 | serverAddress = "localhost:8888" 14 | clientPrivateKeyFilename = "client_data/private_key.pem" 15 | trustedHostsFilename = "client_data/trusted_hosts.pem" 16 | ) 17 | 18 | func main() { 19 | key, err := libtrust.LoadKeyFile(clientPrivateKeyFilename) 20 | if err != nil { 21 | log.Fatal(err) 22 | } 23 | 24 | keyPEMBlock, err := key.PEMBlock() 25 | if err != nil { 26 | log.Fatal(err) 27 | } 28 | 29 | encodedPrivKey := pem.EncodeToMemory(keyPEMBlock) 30 | fmt.Printf("Client Key:\n\n%s\n", string(encodedPrivKey)) 31 | 32 | cert, err := libtrust.GenerateSelfSignedClientCert(key) 33 | if err != nil { 34 | log.Fatal(err) 35 | } 36 | 37 | encodedCert := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: cert.Raw}) 38 | fmt.Printf("Client Cert:\n\n%s\n", string(encodedCert)) 39 | 40 | trustedServerKeys, err := libtrust.LoadKeySetFile(trustedHostsFilename) 41 | if err != nil { 42 | log.Fatal(err) 43 | } 44 | 45 | hostname, _, err := net.SplitHostPort(serverAddress) 46 | if err != nil { 47 | log.Fatal(err) 48 | } 49 | 50 | trustedServerKeys, err = libtrust.FilterByHosts(trustedServerKeys, hostname, false) 51 | if err != nil { 52 | log.Fatal(err) 53 | } 54 | 55 | caCert, err := libtrust.GenerateCACert(key, trustedServerKeys[0]) 56 | if err != nil { 57 | log.Fatal(err) 58 | } 59 | 60 | encodedCert = pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: caCert.Raw}) 61 | fmt.Printf("CA Cert:\n\n%s\n", string(encodedCert)) 62 | } 63 | -------------------------------------------------------------------------------- /manifest/sign.go: -------------------------------------------------------------------------------- 1 | package manifest 2 | 3 | import ( 4 | "crypto/x509" 5 | "encoding/json" 6 | 7 | "github.com/docker/libtrust" 8 | ) 9 | 10 | // Sign signs the manifest with the provided private key, returning a 11 | // SignedManifest. This typically won't be used within the registry, except 12 | // for testing. 13 | func Sign(m *Manifest, pk libtrust.PrivateKey) (*SignedManifest, error) { 14 | p, err := json.MarshalIndent(m, "", " ") 15 | if err != nil { 16 | return nil, err 17 | } 18 | 19 | js, err := libtrust.NewJSONSignature(p) 20 | if err != nil { 21 | return nil, err 22 | } 23 | 24 | if err := js.Sign(pk); err != nil { 25 | return nil, err 26 | } 27 | 28 | pretty, err := js.PrettySignature("signatures") 29 | if err != nil { 30 | return nil, err 31 | } 32 | 33 | return &SignedManifest{ 34 | Manifest: *m, 35 | Raw: pretty, 36 | }, nil 37 | } 38 | 39 | // SignWithChain signs the manifest with the given private key and x509 chain. 40 | // The public key of the first element in the chain must be the public key 41 | // corresponding with the sign key. 42 | func SignWithChain(m *Manifest, key libtrust.PrivateKey, chain []*x509.Certificate) (*SignedManifest, error) { 43 | p, err := json.MarshalIndent(m, "", " ") 44 | if err != nil { 45 | return nil, err 46 | } 47 | 48 | js, err := libtrust.NewJSONSignature(p) 49 | if err != nil { 50 | return nil, err 51 | } 52 | 53 | if err := js.SignWithChain(key, chain); err != nil { 54 | return nil, err 55 | } 56 | 57 | pretty, err := js.PrettySignature("signatures") 58 | if err != nil { 59 | return nil, err 60 | } 61 | 62 | return &SignedManifest{ 63 | Manifest: *m, 64 | Raw: pretty, 65 | }, nil 66 | } 67 | -------------------------------------------------------------------------------- /registry/storage/walk.go: -------------------------------------------------------------------------------- 1 | package storage 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | 7 | "github.com/docker/distribution/context" 8 | storageDriver "github.com/docker/distribution/registry/storage/driver" 9 | ) 10 | 11 | // SkipDir is used as a return value from onFileFunc to indicate that 12 | // the directory named in the call is to be skipped. It is not returned 13 | // as an error by any function. 14 | var ErrSkipDir = errors.New("skip this directory") 15 | 16 | // WalkFn is called once per file by Walk 17 | // If the returned error is ErrSkipDir and fileInfo refers 18 | // to a directory, the directory will not be entered and Walk 19 | // will continue the traversal. Otherwise Walk will return 20 | type WalkFn func(fileInfo storageDriver.FileInfo) error 21 | 22 | // Walk traverses a filesystem defined within driver, starting 23 | // from the given path, calling f on each file 24 | func Walk(ctx context.Context, driver storageDriver.StorageDriver, from string, f WalkFn) error { 25 | children, err := driver.List(ctx, from) 26 | if err != nil { 27 | return err 28 | } 29 | for _, child := range children { 30 | fileInfo, err := driver.Stat(ctx, child) 31 | if err != nil { 32 | return err 33 | } 34 | err = f(fileInfo) 35 | skipDir := (err == ErrSkipDir) 36 | if err != nil && !skipDir { 37 | return err 38 | } 39 | 40 | if fileInfo.IsDir() && !skipDir { 41 | Walk(ctx, driver, child, f) 42 | } 43 | } 44 | return nil 45 | } 46 | 47 | // pushError formats an error type given a path and an error 48 | // and pushes it to a slice of errors 49 | func pushError(errors []error, path string, err error) []error { 50 | return append(errors, fmt.Errorf("%s: %s", path, err)) 51 | } 52 | -------------------------------------------------------------------------------- /registry/storage/driver/azure/azure_test.go: -------------------------------------------------------------------------------- 1 | package azure 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "strings" 7 | "testing" 8 | 9 | storagedriver "github.com/docker/distribution/registry/storage/driver" 10 | "github.com/docker/distribution/registry/storage/driver/testsuites" 11 | . "gopkg.in/check.v1" 12 | ) 13 | 14 | const ( 15 | envAccountName = "AZURE_STORAGE_ACCOUNT_NAME" 16 | envAccountKey = "AZURE_STORAGE_ACCOUNT_KEY" 17 | envContainer = "AZURE_STORAGE_CONTAINER" 18 | envRealm = "AZURE_STORAGE_REALM" 19 | ) 20 | 21 | // Hook up gocheck into the "go test" runner. 22 | func Test(t *testing.T) { TestingT(t) } 23 | 24 | func init() { 25 | var ( 26 | accountName string 27 | accountKey string 28 | container string 29 | realm string 30 | ) 31 | 32 | config := []struct { 33 | env string 34 | value *string 35 | }{ 36 | {envAccountName, &accountName}, 37 | {envAccountKey, &accountKey}, 38 | {envContainer, &container}, 39 | {envRealm, &realm}, 40 | } 41 | 42 | missing := []string{} 43 | for _, v := range config { 44 | *v.value = os.Getenv(v.env) 45 | if *v.value == "" { 46 | missing = append(missing, v.env) 47 | } 48 | } 49 | 50 | azureDriverConstructor := func() (storagedriver.StorageDriver, error) { 51 | return New(accountName, accountKey, container, realm) 52 | } 53 | 54 | // Skip Azure storage driver tests if environment variable parameters are not provided 55 | skipCheck := func() string { 56 | if len(missing) > 0 { 57 | return fmt.Sprintf("Must set %s environment variables to run Azure tests", strings.Join(missing, ", ")) 58 | } 59 | return "" 60 | } 61 | 62 | testsuites.RegisterSuite(azureDriverConstructor, skipCheck) 63 | } 64 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Azure/azure-sdk-for-go/storage/util.go: -------------------------------------------------------------------------------- 1 | package storage 2 | 3 | import ( 4 | "bytes" 5 | "crypto/hmac" 6 | "crypto/sha256" 7 | "encoding/base64" 8 | "encoding/xml" 9 | "fmt" 10 | "io" 11 | "io/ioutil" 12 | "net/http" 13 | "net/url" 14 | "time" 15 | ) 16 | 17 | func (c Client) computeHmac256(message string) string { 18 | h := hmac.New(sha256.New, c.accountKey) 19 | h.Write([]byte(message)) 20 | return base64.StdEncoding.EncodeToString(h.Sum(nil)) 21 | } 22 | 23 | func currentTimeRfc1123Formatted() string { 24 | return timeRfc1123Formatted(time.Now().UTC()) 25 | } 26 | 27 | func timeRfc1123Formatted(t time.Time) string { 28 | return t.Format(http.TimeFormat) 29 | } 30 | 31 | func mergeParams(v1, v2 url.Values) url.Values { 32 | out := url.Values{} 33 | for k, v := range v1 { 34 | out[k] = v 35 | } 36 | for k, v := range v2 { 37 | vals, ok := out[k] 38 | if ok { 39 | vals = append(vals, v...) 40 | out[k] = vals 41 | } else { 42 | out[k] = v 43 | } 44 | } 45 | return out 46 | } 47 | 48 | func prepareBlockListRequest(blocks []Block) string { 49 | s := `` 50 | for _, v := range blocks { 51 | s += fmt.Sprintf("<%s>%s", v.Status, v.ID, v.Status) 52 | } 53 | s += `` 54 | return s 55 | } 56 | 57 | func xmlUnmarshal(body io.Reader, v interface{}) error { 58 | data, err := ioutil.ReadAll(body) 59 | if err != nil { 60 | return err 61 | } 62 | return xml.Unmarshal(data, v) 63 | } 64 | 65 | func xmlMarshal(v interface{}) (io.Reader, int, error) { 66 | b, err := xml.Marshal(v) 67 | if err != nil { 68 | return nil, 0, err 69 | } 70 | return bytes.NewReader(b), len(b), nil 71 | } 72 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/syslog/syslog.go: -------------------------------------------------------------------------------- 1 | package logrus_syslog 2 | 3 | import ( 4 | "fmt" 5 | "github.com/Sirupsen/logrus" 6 | "log/syslog" 7 | "os" 8 | ) 9 | 10 | // SyslogHook to send logs via syslog. 11 | type SyslogHook struct { 12 | Writer *syslog.Writer 13 | SyslogNetwork string 14 | SyslogRaddr string 15 | } 16 | 17 | // Creates a hook to be added to an instance of logger. This is called with 18 | // `hook, err := NewSyslogHook("udp", "localhost:514", syslog.LOG_DEBUG, "")` 19 | // `if err == nil { log.Hooks.Add(hook) }` 20 | func NewSyslogHook(network, raddr string, priority syslog.Priority, tag string) (*SyslogHook, error) { 21 | w, err := syslog.Dial(network, raddr, priority, tag) 22 | return &SyslogHook{w, network, raddr}, err 23 | } 24 | 25 | func (hook *SyslogHook) Fire(entry *logrus.Entry) error { 26 | line, err := entry.String() 27 | if err != nil { 28 | fmt.Fprintf(os.Stderr, "Unable to read entry, %v", err) 29 | return err 30 | } 31 | 32 | switch entry.Level { 33 | case logrus.PanicLevel: 34 | return hook.Writer.Crit(line) 35 | case logrus.FatalLevel: 36 | return hook.Writer.Crit(line) 37 | case logrus.ErrorLevel: 38 | return hook.Writer.Err(line) 39 | case logrus.WarnLevel: 40 | return hook.Writer.Warning(line) 41 | case logrus.InfoLevel: 42 | return hook.Writer.Info(line) 43 | case logrus.DebugLevel: 44 | return hook.Writer.Debug(line) 45 | default: 46 | return nil 47 | } 48 | } 49 | 50 | func (hook *SyslogHook) Levels() []logrus.Level { 51 | return []logrus.Level{ 52 | logrus.PanicLevel, 53 | logrus.FatalLevel, 54 | logrus.ErrorLevel, 55 | logrus.WarnLevel, 56 | logrus.InfoLevel, 57 | logrus.DebugLevel, 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ncw/swift/notes.txt: -------------------------------------------------------------------------------- 1 | Notes on Go Swift 2 | ================= 3 | 4 | Make a builder style interface like the Google Go APIs? Advantages 5 | are that it is easy to add named methods to the service object to do 6 | specific things. Slightly less efficient. Not sure about how to 7 | return extra stuff though - in an object? 8 | 9 | Make a container struct so these could be methods on it? 10 | 11 | Make noResponse check for 204? 12 | 13 | Make storage public so it can be extended easily? 14 | 15 | Rename to go-swift to match user agent string? 16 | 17 | Reconnect on auth error - 401 when token expires isn't tested 18 | 19 | Make more api compatible with python cloudfiles? 20 | 21 | Retry operations on timeout / network errors? 22 | - also 408 error 23 | - GET requests only? 24 | 25 | Make Connection thread safe - whenever it is changed take a write lock whenever it is read from a read lock 26 | 27 | Add extra headers field to Connection (for via etc) 28 | 29 | Make errors use an error heirachy then can catch them with a type assertion 30 | 31 | Error(...) 32 | ObjectCorrupted{ Error } 33 | 34 | Make a Debug flag in connection for logging stuff 35 | 36 | Object If-Match, If-None-Match, If-Modified-Since, If-Unmodified-Since etc 37 | 38 | Object range 39 | 40 | Object create, update with X-Delete-At or X-Delete-After 41 | 42 | Large object support 43 | - check uploads are less than 5GB in normal mode? 44 | 45 | Access control CORS? 46 | 47 | Swift client retries and backs off for all types of errors 48 | 49 | Implement net error interface? 50 | 51 | type Error interface { 52 | error 53 | Timeout() bool // Is the error a timeout? 54 | Temporary() bool // Is the error temporary? 55 | } 56 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/ncw/swift/watchdog_reader_test.go: -------------------------------------------------------------------------------- 1 | // This tests WatchdogReader 2 | 3 | package swift 4 | 5 | import ( 6 | "io/ioutil" 7 | "testing" 8 | "time" 9 | ) 10 | 11 | // Uses testReader from timeout_reader_test.go 12 | 13 | func testWatchdogReaderTimeout(t *testing.T, initialTimeout, watchdogTimeout time.Duration, expectedTimeout bool) { 14 | test := newTestReader(3, 10*time.Millisecond) 15 | timer := time.NewTimer(initialTimeout) 16 | firedChan := make(chan bool) 17 | started := make(chan bool) 18 | go func() { 19 | started <- true 20 | select { 21 | case <-timer.C: 22 | firedChan <- true 23 | } 24 | }() 25 | <-started 26 | wr := newWatchdogReader(test, watchdogTimeout, timer) 27 | b, err := ioutil.ReadAll(wr) 28 | if err != nil || string(b) != "AAA" { 29 | t.Fatalf("Bad read %s %s", err, b) 30 | } 31 | fired := false 32 | select { 33 | case fired = <-firedChan: 34 | default: 35 | } 36 | if expectedTimeout { 37 | if !fired { 38 | t.Fatal("Timer should have fired") 39 | } 40 | } else { 41 | if fired { 42 | t.Fatal("Timer should not have fired") 43 | } 44 | } 45 | } 46 | 47 | func TestWatchdogReaderNoTimeout(t *testing.T) { 48 | testWatchdogReaderTimeout(t, 100*time.Millisecond, 100*time.Millisecond, false) 49 | } 50 | 51 | func TestWatchdogReaderTimeout(t *testing.T) { 52 | testWatchdogReaderTimeout(t, 5*time.Millisecond, 5*time.Millisecond, true) 53 | } 54 | 55 | func TestWatchdogReaderNoTimeoutShortInitial(t *testing.T) { 56 | testWatchdogReaderTimeout(t, 5*time.Millisecond, 100*time.Millisecond, false) 57 | } 58 | 59 | func TestWatchdogReaderTimeoutLongInitial(t *testing.T) { 60 | testWatchdogReaderTimeout(t, 100*time.Millisecond, 5*time.Millisecond, true) 61 | } 62 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/configuration_test.go: -------------------------------------------------------------------------------- 1 | package bugsnag 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | func TestNotifyReleaseStages(t *testing.T) { 8 | 9 | var testCases = []struct { 10 | stage string 11 | configured []string 12 | notify bool 13 | msg string 14 | }{ 15 | { 16 | stage: "production", 17 | notify: true, 18 | msg: "Should notify in all release stages by default", 19 | }, 20 | { 21 | stage: "production", 22 | configured: []string{"development", "production"}, 23 | notify: true, 24 | msg: "Failed to notify in configured release stage", 25 | }, 26 | { 27 | stage: "staging", 28 | configured: []string{"development", "production"}, 29 | notify: false, 30 | msg: "Failed to prevent notification in excluded release stage", 31 | }, 32 | } 33 | 34 | for _, testCase := range testCases { 35 | Configure(Configuration{ReleaseStage: testCase.stage, NotifyReleaseStages: testCase.configured}) 36 | 37 | if Config.notifyInReleaseStage() != testCase.notify { 38 | t.Error(testCase.msg) 39 | } 40 | } 41 | } 42 | 43 | func TestProjectPackages(t *testing.T) { 44 | Configure(Configuration{ProjectPackages: []string{"main", "github.com/ConradIrwin/*"}}) 45 | if !Config.isProjectPackage("main") { 46 | t.Error("literal project package doesn't work") 47 | } 48 | if !Config.isProjectPackage("github.com/ConradIrwin/foo") { 49 | t.Error("wildcard project package doesn't work") 50 | } 51 | if Config.isProjectPackage("runtime") { 52 | t.Error("wrong packges being marked in project") 53 | } 54 | if Config.isProjectPackage("github.com/ConradIrwin/foo/bar") { 55 | t.Error("wrong packges being marked in project") 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/docker/libtrust/tlsdemo/genkeys.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "log" 5 | 6 | "github.com/docker/libtrust" 7 | ) 8 | 9 | func main() { 10 | // Generate client key. 11 | clientKey, err := libtrust.GenerateECP256PrivateKey() 12 | if err != nil { 13 | log.Fatal(err) 14 | } 15 | 16 | // Add a comment for the client key. 17 | clientKey.AddExtendedField("comment", "TLS Demo Client") 18 | 19 | // Save the client key, public and private versions. 20 | err = libtrust.SaveKey("client_data/private_key.pem", clientKey) 21 | if err != nil { 22 | log.Fatal(err) 23 | } 24 | 25 | err = libtrust.SavePublicKey("client_data/public_key.pem", clientKey.PublicKey()) 26 | if err != nil { 27 | log.Fatal(err) 28 | } 29 | 30 | // Generate server key. 31 | serverKey, err := libtrust.GenerateECP256PrivateKey() 32 | if err != nil { 33 | log.Fatal(err) 34 | } 35 | 36 | // Set the list of addresses to use for the server. 37 | serverKey.AddExtendedField("hosts", []string{"localhost", "docker.example.com"}) 38 | 39 | // Save the server key, public and private versions. 40 | err = libtrust.SaveKey("server_data/private_key.pem", serverKey) 41 | if err != nil { 42 | log.Fatal(err) 43 | } 44 | 45 | err = libtrust.SavePublicKey("server_data/public_key.pem", serverKey.PublicKey()) 46 | if err != nil { 47 | log.Fatal(err) 48 | } 49 | 50 | // Generate Authorized Keys file for server. 51 | err = libtrust.AddKeySetFile("server_data/trusted_clients.pem", clientKey.PublicKey()) 52 | if err != nil { 53 | log.Fatal(err) 54 | } 55 | 56 | // Generate Known Host Keys file for client. 57 | err = libtrust.AddKeySetFile("client_data/trusted_hosts.pem", serverKey.PublicKey()) 58 | if err != nil { 59 | log.Fatal(err) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /registry/auth/token/util.go: -------------------------------------------------------------------------------- 1 | package token 2 | 3 | import ( 4 | "encoding/base64" 5 | "errors" 6 | "strings" 7 | ) 8 | 9 | // joseBase64UrlEncode encodes the given data using the standard base64 url 10 | // encoding format but with all trailing '=' characters omitted in accordance 11 | // with the jose specification. 12 | // http://tools.ietf.org/html/draft-ietf-jose-json-web-signature-31#section-2 13 | func joseBase64UrlEncode(b []byte) string { 14 | return strings.TrimRight(base64.URLEncoding.EncodeToString(b), "=") 15 | } 16 | 17 | // joseBase64UrlDecode decodes the given string using the standard base64 url 18 | // decoder but first adds the appropriate number of trailing '=' characters in 19 | // accordance with the jose specification. 20 | // http://tools.ietf.org/html/draft-ietf-jose-json-web-signature-31#section-2 21 | func joseBase64UrlDecode(s string) ([]byte, error) { 22 | switch len(s) % 4 { 23 | case 0: 24 | case 2: 25 | s += "==" 26 | case 3: 27 | s += "=" 28 | default: 29 | return nil, errors.New("illegal base64url string") 30 | } 31 | return base64.URLEncoding.DecodeString(s) 32 | } 33 | 34 | // actionSet is a special type of stringSet. 35 | type actionSet struct { 36 | stringSet 37 | } 38 | 39 | func newActionSet(actions ...string) actionSet { 40 | return actionSet{newStringSet(actions...)} 41 | } 42 | 43 | // Contains calls StringSet.Contains() for 44 | // either "*" or the given action string. 45 | func (s actionSet) contains(action string) bool { 46 | return s.stringSet.contains("*") || s.stringSet.contains(action) 47 | } 48 | 49 | // contains returns true if q is found in ss. 50 | func contains(ss []string, q string) bool { 51 | for _, s := range ss { 52 | if s == q { 53 | return true 54 | } 55 | } 56 | 57 | return false 58 | } 59 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/garyburd/redigo/redis/redis.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Gary Burd 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package redis 16 | 17 | // Error represents an error returned in a command reply. 18 | type Error string 19 | 20 | func (err Error) Error() string { return string(err) } 21 | 22 | // Conn represents a connection to a Redis server. 23 | type Conn interface { 24 | // Close closes the connection. 25 | Close() error 26 | 27 | // Err returns a non-nil value if the connection is broken. The returned 28 | // value is either the first non-nil value returned from the underlying 29 | // network connection or a protocol parsing error. Applications should 30 | // close broken connections. 31 | Err() error 32 | 33 | // Do sends a command to the server and returns the received reply. 34 | Do(commandName string, args ...interface{}) (reply interface{}, err error) 35 | 36 | // Send writes the command to the client's output buffer. 37 | Send(commandName string, args ...interface{}) error 38 | 39 | // Flush flushes the output buffer to the Redis server. 40 | Flush() error 41 | 42 | // Receive receives a single reply from the Redis server 43 | Receive() (reply interface{}, err error) 44 | } 45 | --------------------------------------------------------------------------------