mirror of https://github.com/docker/cli.git
Merge pull request #2803 from thaJeztah/bump_engine
Update docker/docker and dependencies to current master
This commit is contained in:
commit
95fe476706
|
@ -1,4 +1,4 @@
|
||||||
cloud.google.com/go 0ebda48a7f143b1cce9eb37a8c1106ac762a3430 # v0.34.0
|
cloud.google.com/go ceeb313ad77b789a7fa5287b36a1d127b69b7093 # v0.44.3
|
||||||
github.com/agl/ed25519 5312a61534124124185d41f09206b9fef1d88403
|
github.com/agl/ed25519 5312a61534124124185d41f09206b9fef1d88403
|
||||||
github.com/Azure/go-ansiterm d6e3b3328b783f23731bc4d058875b0371ff8109
|
github.com/Azure/go-ansiterm d6e3b3328b783f23731bc4d058875b0371ff8109
|
||||||
github.com/beorn7/perks 37c8de3658fcb183f997c4e13e8337516ab753e6 # v1.0.1
|
github.com/beorn7/perks 37c8de3658fcb183f997c4e13e8337516ab753e6 # v1.0.1
|
||||||
|
@ -13,7 +13,7 @@ github.com/creack/pty 3a6a957789163cacdfe0e291617a
|
||||||
github.com/davecgh/go-spew 8991bc29aa16c548c550c7ff78260e27b9ab7c73 # v1.1.1
|
github.com/davecgh/go-spew 8991bc29aa16c548c550c7ff78260e27b9ab7c73 # v1.1.1
|
||||||
github.com/docker/compose-on-kubernetes 78e6a00beda64ac8ccb9fec787e601fe2ce0d5bb # v0.5.0-alpha1
|
github.com/docker/compose-on-kubernetes 78e6a00beda64ac8ccb9fec787e601fe2ce0d5bb # v0.5.0-alpha1
|
||||||
github.com/docker/distribution 0d3efadf0154c2b8a4e7b6621fff9809655cc580
|
github.com/docker/distribution 0d3efadf0154c2b8a4e7b6621fff9809655cc580
|
||||||
github.com/docker/docker 7f7e4abb331a2973cfb3223710cc35a3e476b1b3
|
github.com/docker/docker 73dc6a680cdd48f2f993f1a1b91aac1dd23d47c8
|
||||||
github.com/docker/docker-credential-helpers 54f0238b6bf101fc3ad3b34114cb5520beb562f5 # v0.6.3
|
github.com/docker/docker-credential-helpers 54f0238b6bf101fc3ad3b34114cb5520beb562f5 # v0.6.3
|
||||||
github.com/docker/go d30aec9fd63c35133f8f79c3412ad91a3b08be06 # Contains a customized version of canonical/json and is used by Notary. The package is periodically rebased on current Go versions.
|
github.com/docker/go d30aec9fd63c35133f8f79c3412ad91a3b08be06 # Contains a customized version of canonical/json and is used by Notary. The package is periodically rebased on current Go versions.
|
||||||
github.com/docker/go-connections 7395e3f8aa162843a74ed6d48e79627d9792ac55 # v0.4.0
|
github.com/docker/go-connections 7395e3f8aa162843a74ed6d48e79627d9792ac55 # v0.4.0
|
||||||
|
@ -23,7 +23,7 @@ github.com/docker/go-units 519db1ee28dcc9fd2474ae59fca2
|
||||||
github.com/docker/swarmkit d6592ddefd8a5319aadff74c558b816b1a0b2590
|
github.com/docker/swarmkit d6592ddefd8a5319aadff74c558b816b1a0b2590
|
||||||
github.com/evanphx/json-patch 72bf35d0ff611848c1dc9df0f976c81192392fa5 # v4.1.0
|
github.com/evanphx/json-patch 72bf35d0ff611848c1dc9df0f976c81192392fa5 # v4.1.0
|
||||||
github.com/fvbommel/sortorder a1ddee917217bbd0691affdca9c88d24d3f5c27d # v1.0.1
|
github.com/fvbommel/sortorder a1ddee917217bbd0691affdca9c88d24d3f5c27d # v1.0.1
|
||||||
github.com/gofrs/flock 392e7fae8f1b0bdbd67dad7237d23f618feb6dbb # v0.7.1
|
github.com/gofrs/flock 6caa7350c26b838538005fae7dbee4e69d9398db # v0.7.3
|
||||||
github.com/gogo/googleapis 01e0f9cca9b92166042241267ee2a5cdf5cff46c # v1.3.2
|
github.com/gogo/googleapis 01e0f9cca9b92166042241267ee2a5cdf5cff46c # v1.3.2
|
||||||
github.com/gogo/protobuf 5628607bb4c51c3157aacc3a50f0ab707582b805 # v1.3.1
|
github.com/gogo/protobuf 5628607bb4c51c3157aacc3a50f0ab707582b805 # v1.3.1
|
||||||
github.com/golang/glog 23def4e6c14b4da8ac2ed8007337bc5eb5007998
|
github.com/golang/glog 23def4e6c14b4da8ac2ed8007337bc5eb5007998
|
||||||
|
@ -52,7 +52,7 @@ github.com/moby/term 73f35e472e8f0a3f91347164138c
|
||||||
github.com/modern-go/concurrent bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94 # 1.0.3
|
github.com/modern-go/concurrent bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94 # 1.0.3
|
||||||
github.com/modern-go/reflect2 4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd # 1.0.1
|
github.com/modern-go/reflect2 4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd # 1.0.1
|
||||||
github.com/morikuni/aec 39771216ff4c63d11f5e604076f9c45e8be1067b # v1.0.0
|
github.com/morikuni/aec 39771216ff4c63d11f5e604076f9c45e8be1067b # v1.0.0
|
||||||
github.com/opencontainers/go-digest 279bed98673dd5bef374d3b6e4b09e2af76183bf # v1.0.0-rc1
|
github.com/opencontainers/go-digest ea51bea511f75cfa3ef6098cc253c5c3609b037a # v1.0.0
|
||||||
github.com/opencontainers/image-spec d60099175f88c47cd379c4738d158884749ed235 # v1.0.1
|
github.com/opencontainers/image-spec d60099175f88c47cd379c4738d158884749ed235 # v1.0.1
|
||||||
github.com/opencontainers/runc ff819c7e9184c13b7c2607fe6c30ae19403a7aff # v1.0.0-rc92
|
github.com/opencontainers/runc ff819c7e9184c13b7c2607fe6c30ae19403a7aff # v1.0.0-rc92
|
||||||
github.com/opentracing/opentracing-go 1361b9cd60be79c4c3a7fa9841b3c132e40066a7
|
github.com/opentracing/opentracing-go 1361b9cd60be79c4c3a7fa9841b3c132e40066a7
|
||||||
|
|
|
@ -19,67 +19,44 @@ make backwards-incompatible changes.
|
||||||
|
|
||||||
**NOTE:** Github repo is a mirror of [https://code.googlesource.com/gocloud](https://code.googlesource.com/gocloud).
|
**NOTE:** Github repo is a mirror of [https://code.googlesource.com/gocloud](https://code.googlesource.com/gocloud).
|
||||||
|
|
||||||
* [News](#news)
|
|
||||||
* [Supported APIs](#supported-apis)
|
|
||||||
* [Go Versions Supported](#go-versions-supported)
|
|
||||||
* [Authorization](#authorization)
|
|
||||||
* [Cloud Datastore](#cloud-datastore-)
|
|
||||||
* [Cloud Storage](#cloud-storage-)
|
|
||||||
* [Cloud Pub/Sub](#cloud-pub-sub-)
|
|
||||||
* [BigQuery](#cloud-bigquery-)
|
|
||||||
* [Stackdriver Logging](#stackdriver-logging-)
|
|
||||||
* [Cloud Spanner](#cloud-spanner-)
|
|
||||||
|
|
||||||
|
|
||||||
## News
|
|
||||||
|
|
||||||
_7 August 2018_
|
|
||||||
|
|
||||||
As of November 1, the code in the repo will no longer support Go versions 1.8
|
|
||||||
and earlier. No one other than AppEngine users should be on those old versions,
|
|
||||||
and AppEngine
|
|
||||||
[Standard](https://groups.google.com/forum/#!topic/google-appengine-go/e7oPNomd7ak)
|
|
||||||
and
|
|
||||||
[Flex](https://groups.google.com/forum/#!topic/google-appengine-go/wHsYtxvEbXI)
|
|
||||||
will stop supporting new deployments with those versions on that date.
|
|
||||||
|
|
||||||
|
|
||||||
Changes have been moved to [CHANGES](https://github.com/GoogleCloudPlatform/google-cloud-go/blob/master/CHANGES.md).
|
|
||||||
|
|
||||||
|
|
||||||
## Supported APIs
|
## Supported APIs
|
||||||
|
|
||||||
Google API | Status | Package
|
Google API | Status | Package
|
||||||
---------------------------------------------|--------------|-----------------------------------------------------------
|
------------------------------------------------|--------------|-----------------------------------------------------------
|
||||||
[Asset][cloud-asset] | alpha | [`godoc.org/cloud.google.com/go/asset/v1beta`][cloud-asset-ref]
|
[Asset][cloud-asset] | alpha | [`cloud.google.com/go/asset/v1beta`][cloud-asset-ref]
|
||||||
[BigQuery][cloud-bigquery] | stable | [`godoc.org/cloud.google.com/go/bigquery`][cloud-bigquery-ref]
|
[BigQuery][cloud-bigquery] | stable | [`cloud.google.com/go/bigquery`][cloud-bigquery-ref]
|
||||||
[Bigtable][cloud-bigtable] | stable | [`godoc.org/cloud.google.com/go/bigtable`][cloud-bigtable-ref]
|
[Bigtable][cloud-bigtable] | stable | [`cloud.google.com/go/bigtable`][cloud-bigtable-ref]
|
||||||
[Cloudtasks][cloud-tasks] | beta | [`godoc.org/cloud.google.com/go/cloudtasks/apiv2beta3`][cloud-tasks-ref]
|
[Cloudtasks][cloud-tasks] | stable | [`cloud.google.com/go/cloudtasks/apiv2`][cloud-tasks-ref]
|
||||||
[Container][cloud-container] | stable | [`godoc.org/cloud.google.com/go/container/apiv1`][cloud-container-ref]
|
[Container][cloud-container] | stable | [`cloud.google.com/go/container/apiv1`][cloud-container-ref]
|
||||||
[ContainerAnalysis][cloud-containeranalysis] | beta | [`godoc.org/cloud.google.com/go/containeranalysis/apiv1beta1`][cloud-containeranalysis-ref]
|
[ContainerAnalysis][cloud-containeranalysis] | beta | [`cloud.google.com/go/containeranalysis/apiv1beta1`][cloud-containeranalysis-ref]
|
||||||
[Dataproc][cloud-dataproc] | stable | [`godoc.org/cloud.google.com/go/dataproc/apiv1`][cloud-dataproc-ref]
|
[Dataproc][cloud-dataproc] | stable | [`cloud.google.com/go/dataproc/apiv1`][cloud-dataproc-ref]
|
||||||
[Datastore][cloud-datastore] | stable | [`godoc.org/cloud.google.com/go/datastore`][cloud-datastore-ref]
|
[Datastore][cloud-datastore] | stable | [`cloud.google.com/go/datastore`][cloud-datastore-ref]
|
||||||
[Debugger][cloud-debugger] | alpha | [`godoc.org/cloud.google.com/go/debugger/apiv2`][cloud-debugger-ref]
|
[Debugger][cloud-debugger] | alpha | [`cloud.google.com/go/debugger/apiv2`][cloud-debugger-ref]
|
||||||
[Dialogflow][cloud-dialogflow] | alpha | [`godoc.org/cloud.google.com/go/dialogflow/apiv2`][cloud-dialogflow-ref]
|
[Dialogflow][cloud-dialogflow] | alpha | [`cloud.google.com/go/dialogflow/apiv2`][cloud-dialogflow-ref]
|
||||||
[Data Loss Prevention][cloud-dlp] | alpha | [`godoc.org/cloud.google.com/go/dlp/apiv2`][cloud-dlp-ref]
|
[Data Loss Prevention][cloud-dlp] | alpha | [`cloud.google.com/go/dlp/apiv2`][cloud-dlp-ref]
|
||||||
[ErrorReporting][cloud-errors] | alpha | [`godoc.org/cloud.google.com/go/errorreporting`][cloud-errors-ref]
|
[ErrorReporting][cloud-errors] | alpha | [`cloud.google.com/go/errorreporting`][cloud-errors-ref]
|
||||||
[Firestore][cloud-firestore] | beta | [`godoc.org/cloud.google.com/go/firestore`][cloud-firestore-ref]
|
[Firestore][cloud-firestore] | stable | [`cloud.google.com/go/firestore`][cloud-firestore-ref]
|
||||||
[IAM][cloud-iam] | stable | [`godoc.org/cloud.google.com/go/iam`][cloud-iam-ref]
|
[IAM][cloud-iam] | stable | [`cloud.google.com/go/iam`][cloud-iam-ref]
|
||||||
[KMS][cloud-kms] | stable | [`godoc.org/cloud.google.com/go/kms`][cloud-kms-ref]
|
[IoT][cloud-iot] | alpha | [`cloud.google.com/iot/apiv1`][cloud-iot-ref]
|
||||||
[Natural Language][cloud-natural-language] | stable | [`godoc.org/cloud.google.com/go/language/apiv1`][cloud-natural-language-ref]
|
[KMS][cloud-kms] | stable | [`cloud.google.com/go/kms`][cloud-kms-ref]
|
||||||
[Logging][cloud-logging] | stable | [`godoc.org/cloud.google.com/go/logging`][cloud-logging-ref]
|
[Natural Language][cloud-natural-language] | stable | [`cloud.google.com/go/language/apiv1`][cloud-natural-language-ref]
|
||||||
[Monitoring][cloud-monitoring] | alpha | [`godoc.org/cloud.google.com/go/monitoring/apiv3`][cloud-monitoring-ref]
|
[Logging][cloud-logging] | stable | [`cloud.google.com/go/logging`][cloud-logging-ref]
|
||||||
[OS Login][cloud-oslogin] | alpha | [`cloud.google.com/compute/docs/oslogin/rest`][cloud-oslogin-ref]
|
[Monitoring][cloud-monitoring] | alpha | [`cloud.google.com/go/monitoring/apiv3`][cloud-monitoring-ref]
|
||||||
[Pub/Sub][cloud-pubsub] | stable | [`godoc.org/cloud.google.com/go/pubsub`][cloud-pubsub-ref]
|
[OS Login][cloud-oslogin] | alpha | [`cloud.google.com/go/oslogin/apiv1`][cloud-oslogin-ref]
|
||||||
[Memorystore][cloud-memorystore] | stable | [`godoc.org/cloud.google.com/go/redis/apiv1beta1`][cloud-memorystore-ref]
|
[Pub/Sub][cloud-pubsub] | stable | [`cloud.google.com/go/pubsub`][cloud-pubsub-ref]
|
||||||
[Spanner][cloud-spanner] | stable | [`godoc.org/cloud.google.com/go/spanner`][cloud-spanner-ref]
|
[Phishing Protection][cloud-phishingprotection] | alpha | [`cloud.google.com/go/phishingprotection/apiv1betad1`][cloud-phishingprotection-ref]
|
||||||
[Speech][cloud-speech] | stable | [`godoc.org/cloud.google.com/go/speech/apiv1`][cloud-speech-ref]
|
[reCAPTCHA Enterprise][cloud-recaptcha] | alpha | [`cloud.google.com/go/recaptchaenterprise/apiv1betad1`][cloud-recaptcha-ref]
|
||||||
[Storage][cloud-storage] | stable | [`godoc.org/cloud.google.com/go/storage`][cloud-storage-ref]
|
[Memorystore][cloud-memorystore] | alpha | [`cloud.google.com/go/redis/apiv1`][cloud-memorystore-ref]
|
||||||
[Text To Speech][cloud-texttospeech] | alpha | [`godoc.org/cloud.google.com/go/texttospeech/apiv1`][cloud-storage-ref]
|
[Scheduler][cloud-scheduler] | stable | [`cloud.google.com/go/scheduler/apiv1`][cloud-scheduler-ref]
|
||||||
[Trace][cloud-trace] | alpha | [`godoc.org/cloud.google.com/go/trace/apiv2`][cloud-translation-ref]
|
[Spanner][cloud-spanner] | stable | [`cloud.google.com/go/spanner`][cloud-spanner-ref]
|
||||||
[Translation][cloud-translation] | stable | [`godoc.org/cloud.google.com/go/translate`][cloud-translation-ref]
|
[Speech][cloud-speech] | stable | [`cloud.google.com/go/speech/apiv1`][cloud-speech-ref]
|
||||||
[Video Intelligence][cloud-video] | alpha | [`godoc.org/cloud.google.com/go/videointelligence/apiv1beta1`][cloud-video-ref]
|
[Storage][cloud-storage] | stable | [`cloud.google.com/go/storage`][cloud-storage-ref]
|
||||||
[Vision][cloud-vision] | stable | [`godoc.org/cloud.google.com/go/vision/apiv1`][cloud-vision-ref]
|
[Talent][cloud-talent] | alpha | [`cloud.google.com/go/talent/apiv4beta1`][cloud-talent-ref]
|
||||||
|
[Text To Speech][cloud-texttospeech] | alpha | [`cloud.google.com/go/texttospeech/apiv1`][cloud-texttospeech-ref]
|
||||||
|
[Trace][cloud-trace] | alpha | [`cloud.google.com/go/trace/apiv2`][cloud-trace-ref]
|
||||||
|
[Translate][cloud-translate] | stable | [`cloud.google.com/go/translate`][cloud-translate-ref]
|
||||||
|
[Video Intelligence][cloud-video] | alpha | [`cloud.google.com/go/videointelligence/apiv1beta1`][cloud-video-ref]
|
||||||
|
[Vision][cloud-vision] | stable | [`cloud.google.com/go/vision/apiv1`][cloud-vision-ref]
|
||||||
|
|
||||||
> **Alpha status**: the API is still being actively developed. As a
|
> **Alpha status**: the API is still being actively developed. As a
|
||||||
> result, it might change in backward-incompatible ways and is not recommended
|
> result, it might change in backward-incompatible ways and is not recommended
|
||||||
|
@ -92,12 +69,7 @@ Google API | Status | Package
|
||||||
> **Stable status**: the API is mature and ready for production use. We will
|
> **Stable status**: the API is mature and ready for production use. We will
|
||||||
> continue addressing bugs and feature requests.
|
> continue addressing bugs and feature requests.
|
||||||
|
|
||||||
Documentation and examples are available at
|
Documentation and examples are available at [godoc.org/cloud.google.com/go](godoc.org/cloud.google.com/go)
|
||||||
https://godoc.org/cloud.google.com/go
|
|
||||||
|
|
||||||
Visit or join the
|
|
||||||
[google-api-go-announce group](https://groups.google.com/forum/#!forum/google-api-go-announce)
|
|
||||||
for updates on these packages.
|
|
||||||
|
|
||||||
## Go Versions Supported
|
## Go Versions Supported
|
||||||
|
|
||||||
|
@ -106,7 +78,7 @@ an older version, we support that as well.
|
||||||
|
|
||||||
## Authorization
|
## Authorization
|
||||||
|
|
||||||
By default, each API will use [Google Application Default Credentials][default-creds]
|
By default, each API will use [Google Application Default Credentials](https://developers.google.com/identity/protocols/application-default-credentials)
|
||||||
for authorization credentials used in calling the API endpoints. This will allow your
|
for authorization credentials used in calling the API endpoints. This will allow your
|
||||||
application to run in many environments without requiring explicit configuration.
|
application to run in many environments without requiring explicit configuration.
|
||||||
|
|
||||||
|
@ -137,249 +109,6 @@ tokenSource := ...
|
||||||
client, err := storage.NewClient(ctx, option.WithTokenSource(tokenSource))
|
client, err := storage.NewClient(ctx, option.WithTokenSource(tokenSource))
|
||||||
```
|
```
|
||||||
|
|
||||||
## Cloud Datastore [![GoDoc](https://godoc.org/cloud.google.com/go/datastore?status.svg)](https://godoc.org/cloud.google.com/go/datastore)
|
|
||||||
|
|
||||||
- [About Cloud Datastore][cloud-datastore]
|
|
||||||
- [Activating the API for your project][cloud-datastore-activation]
|
|
||||||
- [API documentation][cloud-datastore-docs]
|
|
||||||
- [Go client documentation](https://godoc.org/cloud.google.com/go/datastore)
|
|
||||||
- [Complete sample program](https://github.com/GoogleCloudPlatform/golang-samples/tree/master/datastore/tasks)
|
|
||||||
|
|
||||||
### Example Usage
|
|
||||||
|
|
||||||
First create a `datastore.Client` to use throughout your application:
|
|
||||||
|
|
||||||
[snip]:# (datastore-1)
|
|
||||||
```go
|
|
||||||
client, err := datastore.NewClient(ctx, "my-project-id")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Then use that client to interact with the API:
|
|
||||||
|
|
||||||
[snip]:# (datastore-2)
|
|
||||||
```go
|
|
||||||
type Post struct {
|
|
||||||
Title string
|
|
||||||
Body string `datastore:",noindex"`
|
|
||||||
PublishedAt time.Time
|
|
||||||
}
|
|
||||||
keys := []*datastore.Key{
|
|
||||||
datastore.NameKey("Post", "post1", nil),
|
|
||||||
datastore.NameKey("Post", "post2", nil),
|
|
||||||
}
|
|
||||||
posts := []*Post{
|
|
||||||
{Title: "Post 1", Body: "...", PublishedAt: time.Now()},
|
|
||||||
{Title: "Post 2", Body: "...", PublishedAt: time.Now()},
|
|
||||||
}
|
|
||||||
if _, err := client.PutMulti(ctx, keys, posts); err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Cloud Storage [![GoDoc](https://godoc.org/cloud.google.com/go/storage?status.svg)](https://godoc.org/cloud.google.com/go/storage)
|
|
||||||
|
|
||||||
- [About Cloud Storage][cloud-storage]
|
|
||||||
- [API documentation][cloud-storage-docs]
|
|
||||||
- [Go client documentation](https://godoc.org/cloud.google.com/go/storage)
|
|
||||||
- [Complete sample programs](https://github.com/GoogleCloudPlatform/golang-samples/tree/master/storage)
|
|
||||||
|
|
||||||
### Example Usage
|
|
||||||
|
|
||||||
First create a `storage.Client` to use throughout your application:
|
|
||||||
|
|
||||||
[snip]:# (storage-1)
|
|
||||||
```go
|
|
||||||
client, err := storage.NewClient(ctx)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
[snip]:# (storage-2)
|
|
||||||
```go
|
|
||||||
// Read the object1 from bucket.
|
|
||||||
rc, err := client.Bucket("bucket").Object("object1").NewReader(ctx)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
defer rc.Close()
|
|
||||||
body, err := ioutil.ReadAll(rc)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Cloud Pub/Sub [![GoDoc](https://godoc.org/cloud.google.com/go/pubsub?status.svg)](https://godoc.org/cloud.google.com/go/pubsub)
|
|
||||||
|
|
||||||
- [About Cloud Pubsub][cloud-pubsub]
|
|
||||||
- [API documentation][cloud-pubsub-docs]
|
|
||||||
- [Go client documentation](https://godoc.org/cloud.google.com/go/pubsub)
|
|
||||||
- [Complete sample programs](https://github.com/GoogleCloudPlatform/golang-samples/tree/master/pubsub)
|
|
||||||
|
|
||||||
### Example Usage
|
|
||||||
|
|
||||||
First create a `pubsub.Client` to use throughout your application:
|
|
||||||
|
|
||||||
[snip]:# (pubsub-1)
|
|
||||||
```go
|
|
||||||
client, err := pubsub.NewClient(ctx, "project-id")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Then use the client to publish and subscribe:
|
|
||||||
|
|
||||||
[snip]:# (pubsub-2)
|
|
||||||
```go
|
|
||||||
// Publish "hello world" on topic1.
|
|
||||||
topic := client.Topic("topic1")
|
|
||||||
res := topic.Publish(ctx, &pubsub.Message{
|
|
||||||
Data: []byte("hello world"),
|
|
||||||
})
|
|
||||||
// The publish happens asynchronously.
|
|
||||||
// Later, you can get the result from res:
|
|
||||||
...
|
|
||||||
msgID, err := res.Get(ctx)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use a callback to receive messages via subscription1.
|
|
||||||
sub := client.Subscription("subscription1")
|
|
||||||
err = sub.Receive(ctx, func(ctx context.Context, m *pubsub.Message) {
|
|
||||||
fmt.Println(m.Data)
|
|
||||||
m.Ack() // Acknowledge that we've consumed the message.
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## BigQuery [![GoDoc](https://godoc.org/cloud.google.com/go/bigquery?status.svg)](https://godoc.org/cloud.google.com/go/bigquery)
|
|
||||||
|
|
||||||
- [About BigQuery][cloud-bigquery]
|
|
||||||
- [API documentation][cloud-bigquery-docs]
|
|
||||||
- [Go client documentation][cloud-bigquery-ref]
|
|
||||||
- [Complete sample programs](https://github.com/GoogleCloudPlatform/golang-samples/tree/master/bigquery)
|
|
||||||
|
|
||||||
### Example Usage
|
|
||||||
|
|
||||||
First create a `bigquery.Client` to use throughout your application:
|
|
||||||
[snip]:# (bq-1)
|
|
||||||
```go
|
|
||||||
c, err := bigquery.NewClient(ctx, "my-project-ID")
|
|
||||||
if err != nil {
|
|
||||||
// TODO: Handle error.
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Then use that client to interact with the API:
|
|
||||||
[snip]:# (bq-2)
|
|
||||||
```go
|
|
||||||
// Construct a query.
|
|
||||||
q := c.Query(`
|
|
||||||
SELECT year, SUM(number)
|
|
||||||
FROM [bigquery-public-data:usa_names.usa_1910_2013]
|
|
||||||
WHERE name = "William"
|
|
||||||
GROUP BY year
|
|
||||||
ORDER BY year
|
|
||||||
`)
|
|
||||||
// Execute the query.
|
|
||||||
it, err := q.Read(ctx)
|
|
||||||
if err != nil {
|
|
||||||
// TODO: Handle error.
|
|
||||||
}
|
|
||||||
// Iterate through the results.
|
|
||||||
for {
|
|
||||||
var values []bigquery.Value
|
|
||||||
err := it.Next(&values)
|
|
||||||
if err == iterator.Done {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
// TODO: Handle error.
|
|
||||||
}
|
|
||||||
fmt.Println(values)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Stackdriver Logging [![GoDoc](https://godoc.org/cloud.google.com/go/logging?status.svg)](https://godoc.org/cloud.google.com/go/logging)
|
|
||||||
|
|
||||||
- [About Stackdriver Logging][cloud-logging]
|
|
||||||
- [API documentation][cloud-logging-docs]
|
|
||||||
- [Go client documentation][cloud-logging-ref]
|
|
||||||
- [Complete sample programs](https://github.com/GoogleCloudPlatform/golang-samples/tree/master/logging)
|
|
||||||
|
|
||||||
### Example Usage
|
|
||||||
|
|
||||||
First create a `logging.Client` to use throughout your application:
|
|
||||||
[snip]:# (logging-1)
|
|
||||||
```go
|
|
||||||
ctx := context.Background()
|
|
||||||
client, err := logging.NewClient(ctx, "my-project")
|
|
||||||
if err != nil {
|
|
||||||
// TODO: Handle error.
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Usually, you'll want to add log entries to a buffer to be periodically flushed
|
|
||||||
(automatically and asynchronously) to the Stackdriver Logging service.
|
|
||||||
[snip]:# (logging-2)
|
|
||||||
```go
|
|
||||||
logger := client.Logger("my-log")
|
|
||||||
logger.Log(logging.Entry{Payload: "something happened!"})
|
|
||||||
```
|
|
||||||
|
|
||||||
Close your client before your program exits, to flush any buffered log entries.
|
|
||||||
[snip]:# (logging-3)
|
|
||||||
```go
|
|
||||||
err = client.Close()
|
|
||||||
if err != nil {
|
|
||||||
// TODO: Handle error.
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Cloud Spanner [![GoDoc](https://godoc.org/cloud.google.com/go/spanner?status.svg)](https://godoc.org/cloud.google.com/go/spanner)
|
|
||||||
|
|
||||||
- [About Cloud Spanner][cloud-spanner]
|
|
||||||
- [API documentation][cloud-spanner-docs]
|
|
||||||
- [Go client documentation](https://godoc.org/cloud.google.com/go/spanner)
|
|
||||||
|
|
||||||
### Example Usage
|
|
||||||
|
|
||||||
First create a `spanner.Client` to use throughout your application:
|
|
||||||
|
|
||||||
[snip]:# (spanner-1)
|
|
||||||
```go
|
|
||||||
client, err := spanner.NewClient(ctx, "projects/P/instances/I/databases/D")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
[snip]:# (spanner-2)
|
|
||||||
```go
|
|
||||||
// Simple Reads And Writes
|
|
||||||
_, err = client.Apply(ctx, []*spanner.Mutation{
|
|
||||||
spanner.Insert("Users",
|
|
||||||
[]string{"name", "email"},
|
|
||||||
[]interface{}{"alice", "a@example.com"})})
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
row, err := client.Single().ReadRow(ctx, "Users",
|
|
||||||
spanner.Key{"alice"}, []string{"email"})
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Contributions are welcome. Please, see the
|
Contributions are welcome. Please, see the
|
||||||
|
@ -394,32 +123,23 @@ for more information.
|
||||||
|
|
||||||
[cloud-datastore]: https://cloud.google.com/datastore/
|
[cloud-datastore]: https://cloud.google.com/datastore/
|
||||||
[cloud-datastore-ref]: https://godoc.org/cloud.google.com/go/datastore
|
[cloud-datastore-ref]: https://godoc.org/cloud.google.com/go/datastore
|
||||||
[cloud-datastore-docs]: https://cloud.google.com/datastore/docs
|
|
||||||
[cloud-datastore-activation]: https://cloud.google.com/datastore/docs/activate
|
|
||||||
|
|
||||||
[cloud-firestore]: https://cloud.google.com/firestore/
|
[cloud-firestore]: https://cloud.google.com/firestore/
|
||||||
[cloud-firestore-ref]: https://godoc.org/cloud.google.com/go/firestore
|
[cloud-firestore-ref]: https://godoc.org/cloud.google.com/go/firestore
|
||||||
[cloud-firestore-docs]: https://cloud.google.com/firestore/docs
|
|
||||||
[cloud-firestore-activation]: https://cloud.google.com/firestore/docs/activate
|
|
||||||
|
|
||||||
[cloud-pubsub]: https://cloud.google.com/pubsub/
|
[cloud-pubsub]: https://cloud.google.com/pubsub/
|
||||||
[cloud-pubsub-ref]: https://godoc.org/cloud.google.com/go/pubsub
|
[cloud-pubsub-ref]: https://godoc.org/cloud.google.com/go/pubsub
|
||||||
[cloud-pubsub-docs]: https://cloud.google.com/pubsub/docs
|
|
||||||
|
|
||||||
[cloud-storage]: https://cloud.google.com/storage/
|
[cloud-storage]: https://cloud.google.com/storage/
|
||||||
[cloud-storage-ref]: https://godoc.org/cloud.google.com/go/storage
|
[cloud-storage-ref]: https://godoc.org/cloud.google.com/go/storage
|
||||||
[cloud-storage-docs]: https://cloud.google.com/storage/docs
|
|
||||||
[cloud-storage-create-bucket]: https://cloud.google.com/storage/docs/cloud-console#_creatingbuckets
|
|
||||||
|
|
||||||
[cloud-bigtable]: https://cloud.google.com/bigtable/
|
[cloud-bigtable]: https://cloud.google.com/bigtable/
|
||||||
[cloud-bigtable-ref]: https://godoc.org/cloud.google.com/go/bigtable
|
[cloud-bigtable-ref]: https://godoc.org/cloud.google.com/go/bigtable
|
||||||
|
|
||||||
[cloud-bigquery]: https://cloud.google.com/bigquery/
|
[cloud-bigquery]: https://cloud.google.com/bigquery/
|
||||||
[cloud-bigquery-docs]: https://cloud.google.com/bigquery/docs
|
|
||||||
[cloud-bigquery-ref]: https://godoc.org/cloud.google.com/go/bigquery
|
[cloud-bigquery-ref]: https://godoc.org/cloud.google.com/go/bigquery
|
||||||
|
|
||||||
[cloud-logging]: https://cloud.google.com/logging/
|
[cloud-logging]: https://cloud.google.com/logging/
|
||||||
[cloud-logging-docs]: https://cloud.google.com/logging/docs
|
|
||||||
[cloud-logging-ref]: https://godoc.org/cloud.google.com/go/logging
|
[cloud-logging-ref]: https://godoc.org/cloud.google.com/go/logging
|
||||||
|
|
||||||
[cloud-monitoring]: https://cloud.google.com/monitoring/
|
[cloud-monitoring]: https://cloud.google.com/monitoring/
|
||||||
|
@ -432,17 +152,16 @@ for more information.
|
||||||
[cloud-language-ref]: https://godoc.org/cloud.google.com/go/language/apiv1
|
[cloud-language-ref]: https://godoc.org/cloud.google.com/go/language/apiv1
|
||||||
|
|
||||||
[cloud-oslogin]: https://cloud.google.com/compute/docs/oslogin/rest
|
[cloud-oslogin]: https://cloud.google.com/compute/docs/oslogin/rest
|
||||||
[cloud-oslogin-ref]: https://cloud.google.com/compute/docs/oslogin/rest
|
[cloud-oslogin-ref]: https://cloud.google.com/go/oslogin/apiv1
|
||||||
|
|
||||||
[cloud-speech]: https://cloud.google.com/speech
|
[cloud-speech]: https://cloud.google.com/speech
|
||||||
[cloud-speech-ref]: https://godoc.org/cloud.google.com/go/speech/apiv1
|
[cloud-speech-ref]: https://godoc.org/cloud.google.com/go/speech/apiv1
|
||||||
|
|
||||||
[cloud-spanner]: https://cloud.google.com/spanner/
|
[cloud-spanner]: https://cloud.google.com/spanner/
|
||||||
[cloud-spanner-ref]: https://godoc.org/cloud.google.com/go/spanner
|
[cloud-spanner-ref]: https://godoc.org/cloud.google.com/go/spanner
|
||||||
[cloud-spanner-docs]: https://cloud.google.com/spanner/docs
|
|
||||||
|
|
||||||
[cloud-translation]: https://cloud.google.com/translation
|
[cloud-translate]: https://cloud.google.com/translate
|
||||||
[cloud-translation-ref]: https://godoc.org/cloud.google.com/go/translation
|
[cloud-translate-ref]: https://godoc.org/cloud.google.com/go/translate
|
||||||
|
|
||||||
[cloud-video]: https://cloud.google.com/video-intelligence/
|
[cloud-video]: https://cloud.google.com/video-intelligence/
|
||||||
[cloud-video-ref]: https://godoc.org/cloud.google.com/go/videointelligence/apiv1beta1
|
[cloud-video-ref]: https://godoc.org/cloud.google.com/go/videointelligence/apiv1beta1
|
||||||
|
@ -459,47 +178,50 @@ for more information.
|
||||||
[cloud-dlp]: https://cloud.google.com/dlp/
|
[cloud-dlp]: https://cloud.google.com/dlp/
|
||||||
[cloud-dlp-ref]: https://godoc.org/cloud.google.com/go/dlp/apiv2beta1
|
[cloud-dlp-ref]: https://godoc.org/cloud.google.com/go/dlp/apiv2beta1
|
||||||
|
|
||||||
[default-creds]: https://developers.google.com/identity/protocols/application-default-credentials
|
|
||||||
|
|
||||||
[cloud-dataproc]: https://cloud.google.com/dataproc/
|
[cloud-dataproc]: https://cloud.google.com/dataproc/
|
||||||
[cloud-dataproc-docs]: https://cloud.google.com/dataproc/docs
|
|
||||||
[cloud-dataproc-ref]: https://godoc.org/cloud.google.com/go/dataproc/apiv1
|
[cloud-dataproc-ref]: https://godoc.org/cloud.google.com/go/dataproc/apiv1
|
||||||
|
|
||||||
[cloud-iam]: https://cloud.google.com/iam/
|
[cloud-iam]: https://cloud.google.com/iam/
|
||||||
[cloud-iam-docs]: https://cloud.google.com/iam/docs
|
|
||||||
[cloud-iam-ref]: https://godoc.org/cloud.google.com/go/iam
|
[cloud-iam-ref]: https://godoc.org/cloud.google.com/go/iam
|
||||||
|
|
||||||
[cloud-kms]: https://cloud.google.com/kms/
|
[cloud-kms]: https://cloud.google.com/kms/
|
||||||
[cloud-kms-docs]: https://cloud.google.com/kms/docs
|
|
||||||
[cloud-kms-ref]: https://godoc.org/cloud.google.com/go/kms/apiv1
|
[cloud-kms-ref]: https://godoc.org/cloud.google.com/go/kms/apiv1
|
||||||
|
|
||||||
[cloud-natural-language]: https://cloud.google.com/natural-language/
|
[cloud-natural-language]: https://cloud.google.com/natural-language/
|
||||||
[cloud-natural-language-docs]: https://cloud.google.com/natural-language/docs
|
|
||||||
[cloud-natural-language-ref]: https://godoc.org/cloud.google.com/go/language/apiv1
|
[cloud-natural-language-ref]: https://godoc.org/cloud.google.com/go/language/apiv1
|
||||||
|
|
||||||
[cloud-memorystore]: https://cloud.google.com/memorystore/
|
[cloud-memorystore]: https://cloud.google.com/memorystore/
|
||||||
[cloud-memorystore-docs]: https://cloud.google.com/memorystore/docs
|
[cloud-memorystore-ref]: https://godoc.org/cloud.google.com/go/redis/apiv1
|
||||||
[cloud-memorystore-ref]: https://godoc.org/cloud.google.com/go/redis/apiv1beta1
|
|
||||||
|
|
||||||
[cloud-texttospeech]: https://cloud.google.com/texttospeech/
|
[cloud-texttospeech]: https://cloud.google.com/texttospeech/
|
||||||
[cloud-texttospeech-docs]: https://cloud.google.com/texttospeech/docs
|
|
||||||
[cloud-texttospeech-ref]: https://godoc.org/cloud.google.com/go/texttospeech/apiv1
|
[cloud-texttospeech-ref]: https://godoc.org/cloud.google.com/go/texttospeech/apiv1
|
||||||
|
|
||||||
[cloud-trace]: https://cloud.google.com/trace/
|
[cloud-trace]: https://cloud.google.com/trace/
|
||||||
[cloud-trace-docs]: https://cloud.google.com/trace/docs
|
[cloud-trace-ref]: https://godoc.org/cloud.google.com/go/trace/apiv2
|
||||||
[cloud-trace-ref]: https://godoc.org/cloud.google.com/go/trace/apiv1
|
|
||||||
|
|
||||||
[cloud-dialogflow]: https://cloud.google.com/dialogflow-enterprise/
|
[cloud-dialogflow]: https://cloud.google.com/dialogflow-enterprise/
|
||||||
[cloud-dialogflow-docs]: https://cloud.google.com/dialogflow-enterprise/docs/
|
|
||||||
[cloud-dialogflow-ref]: https://godoc.org/cloud.google.com/go/dialogflow/apiv2
|
[cloud-dialogflow-ref]: https://godoc.org/cloud.google.com/go/dialogflow/apiv2
|
||||||
|
|
||||||
[cloud-containeranalysis]: https://cloud.google.com/container-registry/docs/container-analysis
|
[cloud-containeranalysis]: https://cloud.google.com/container-registry/docs/container-analysis
|
||||||
[cloud-containeranalysis-docs]: https://cloud.google.com/container-analysis/api/reference/rest/
|
|
||||||
[cloud-containeranalysis-ref]: https://godoc.org/cloud.google.com/go/devtools/containeranalysis/apiv1beta1
|
[cloud-containeranalysis-ref]: https://godoc.org/cloud.google.com/go/devtools/containeranalysis/apiv1beta1
|
||||||
|
|
||||||
[cloud-asset]: https://cloud.google.com/security-command-center/docs/how-to-asset-inventory
|
[cloud-asset]: https://cloud.google.com/security-command-center/docs/how-to-asset-inventory
|
||||||
[cloud-asset-docs]: https://cloud.google.com/security-command-center/docs/how-to-asset-inventory
|
|
||||||
[cloud-asset-ref]: https://godoc.org/cloud.google.com/go/asset/apiv1
|
[cloud-asset-ref]: https://godoc.org/cloud.google.com/go/asset/apiv1
|
||||||
|
|
||||||
[cloud-tasks]: https://cloud.google.com/tasks/
|
[cloud-tasks]: https://cloud.google.com/tasks/
|
||||||
[cloud-tasks-ref]: https://godoc.org/cloud.google.com/go/cloudtasks/apiv2beta3
|
[cloud-tasks-ref]: https://godoc.org/cloud.google.com/go/cloudtasks/apiv2
|
||||||
|
|
||||||
|
[cloud-scheduler]: https://cloud.google.com/scheduler
|
||||||
|
[cloud-scheduler-ref]: https://godoc.org/cloud.google.com/go/scheduler/apiv1
|
||||||
|
|
||||||
|
[cloud-iot]: https://cloud.google.com/iot-core/
|
||||||
|
[cloud-iot-ref]: https://godoc.org/cloud.google.com/go/iot/apiv1
|
||||||
|
|
||||||
|
[cloud-phishingprotection]: https://cloud.google.com/phishing-protection/
|
||||||
|
[cloud-phishingprotection-ref]: https://cloud.google.com/go/phishingprotection/apiv1beta1
|
||||||
|
|
||||||
|
[cloud-recaptcha]: https://cloud.google.com/recaptcha-enterprise/
|
||||||
|
[cloud-recaptcha-ref]: https://cloud.google.com/go/recaptchaenterprise/apiv1beta1
|
||||||
|
|
||||||
|
[cloud-talent]: https://cloud.google.com/solutions/talent-solution/
|
||||||
|
[cloud-talent-ref]: https://godoc.org/cloud.google.com/go/talent/apiv4beta1
|
||||||
|
|
|
@ -137,7 +137,7 @@ func testOnGCE() bool {
|
||||||
resc := make(chan bool, 2)
|
resc := make(chan bool, 2)
|
||||||
|
|
||||||
// Try two strategies in parallel.
|
// Try two strategies in parallel.
|
||||||
// See https://github.com/GoogleCloudPlatform/google-cloud-go/issues/194
|
// See https://github.com/googleapis/google-cloud-go/issues/194
|
||||||
go func() {
|
go func() {
|
||||||
req, _ := http.NewRequest("GET", "http://"+metadataIP, nil)
|
req, _ := http.NewRequest("GET", "http://"+metadataIP, nil)
|
||||||
req.Header.Set("User-Agent", userAgent)
|
req.Header.Set("User-Agent", userAgent)
|
||||||
|
@ -300,8 +300,8 @@ func (c *Client) getETag(suffix string) (value, etag string, err error) {
|
||||||
// being stable anyway.
|
// being stable anyway.
|
||||||
host = metadataIP
|
host = metadataIP
|
||||||
}
|
}
|
||||||
url := "http://" + host + "/computeMetadata/v1/" + suffix
|
u := "http://" + host + "/computeMetadata/v1/" + suffix
|
||||||
req, _ := http.NewRequest("GET", url, nil)
|
req, _ := http.NewRequest("GET", u, nil)
|
||||||
req.Header.Set("Metadata-Flavor", "Google")
|
req.Header.Set("Metadata-Flavor", "Google")
|
||||||
req.Header.Set("User-Agent", userAgent)
|
req.Header.Set("User-Agent", userAgent)
|
||||||
res, err := c.hc.Do(req)
|
res, err := c.hc.Do(req)
|
||||||
|
@ -312,13 +312,13 @@ func (c *Client) getETag(suffix string) (value, etag string, err error) {
|
||||||
if res.StatusCode == http.StatusNotFound {
|
if res.StatusCode == http.StatusNotFound {
|
||||||
return "", "", NotDefinedError(suffix)
|
return "", "", NotDefinedError(suffix)
|
||||||
}
|
}
|
||||||
if res.StatusCode != 200 {
|
|
||||||
return "", "", fmt.Errorf("status code %d trying to fetch %s", res.StatusCode, url)
|
|
||||||
}
|
|
||||||
all, err := ioutil.ReadAll(res.Body)
|
all, err := ioutil.ReadAll(res.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", err
|
return "", "", err
|
||||||
}
|
}
|
||||||
|
if res.StatusCode != 200 {
|
||||||
|
return "", "", &Error{Code: res.StatusCode, Message: string(all)}
|
||||||
|
}
|
||||||
return string(all), res.Header.Get("Etag"), nil
|
return string(all), res.Header.Get("Etag"), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,3 +499,15 @@ func (c *Client) Subscribe(suffix string, fn func(v string, ok bool) error) erro
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Error contains an error response from the server.
|
||||||
|
type Error struct {
|
||||||
|
// Code is the HTTP response status code.
|
||||||
|
Code int
|
||||||
|
// Message is the server response message.
|
||||||
|
Message string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Error) Error() string {
|
||||||
|
return fmt.Sprintf("compute: Received %d `%s`", e.Code, e.Message)
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
module cloud.google.com/go
|
||||||
|
|
||||||
|
go 1.9
|
||||||
|
|
||||||
|
require (
|
||||||
|
cloud.google.com/go/datastore v1.0.0
|
||||||
|
github.com/golang/mock v1.3.1
|
||||||
|
github.com/golang/protobuf v1.3.2
|
||||||
|
github.com/google/btree v1.0.0
|
||||||
|
github.com/google/go-cmp v0.3.0
|
||||||
|
github.com/google/martian v2.1.0+incompatible
|
||||||
|
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f
|
||||||
|
github.com/googleapis/gax-go/v2 v2.0.5
|
||||||
|
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024
|
||||||
|
go.opencensus.io v0.22.0
|
||||||
|
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522
|
||||||
|
golang.org/x/lint v0.0.0-20190409202823-959b441ac422
|
||||||
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859
|
||||||
|
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
|
||||||
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58
|
||||||
|
golang.org/x/text v0.3.2
|
||||||
|
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
|
||||||
|
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0
|
||||||
|
google.golang.org/api v0.8.0
|
||||||
|
google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64
|
||||||
|
google.golang.org/grpc v1.21.1
|
||||||
|
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a
|
||||||
|
rsc.io/binaryregexp v0.2.0
|
||||||
|
)
|
|
@ -1,94 +0,0 @@
|
||||||
package types // import "github.com/docker/docker/api/types"
|
|
||||||
|
|
||||||
// Seccomp represents the config for a seccomp profile for syscall restriction.
|
|
||||||
type Seccomp struct {
|
|
||||||
DefaultAction Action `json:"defaultAction"`
|
|
||||||
// Architectures is kept to maintain backward compatibility with the old
|
|
||||||
// seccomp profile.
|
|
||||||
Architectures []Arch `json:"architectures,omitempty"`
|
|
||||||
ArchMap []Architecture `json:"archMap,omitempty"`
|
|
||||||
Syscalls []*Syscall `json:"syscalls"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Architecture is used to represent a specific architecture
|
|
||||||
// and its sub-architectures
|
|
||||||
type Architecture struct {
|
|
||||||
Arch Arch `json:"architecture"`
|
|
||||||
SubArches []Arch `json:"subArchitectures"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Arch used for architectures
|
|
||||||
type Arch string
|
|
||||||
|
|
||||||
// Additional architectures permitted to be used for system calls
|
|
||||||
// By default only the native architecture of the kernel is permitted
|
|
||||||
const (
|
|
||||||
ArchX86 Arch = "SCMP_ARCH_X86"
|
|
||||||
ArchX86_64 Arch = "SCMP_ARCH_X86_64"
|
|
||||||
ArchX32 Arch = "SCMP_ARCH_X32"
|
|
||||||
ArchARM Arch = "SCMP_ARCH_ARM"
|
|
||||||
ArchAARCH64 Arch = "SCMP_ARCH_AARCH64"
|
|
||||||
ArchMIPS Arch = "SCMP_ARCH_MIPS"
|
|
||||||
ArchMIPS64 Arch = "SCMP_ARCH_MIPS64"
|
|
||||||
ArchMIPS64N32 Arch = "SCMP_ARCH_MIPS64N32"
|
|
||||||
ArchMIPSEL Arch = "SCMP_ARCH_MIPSEL"
|
|
||||||
ArchMIPSEL64 Arch = "SCMP_ARCH_MIPSEL64"
|
|
||||||
ArchMIPSEL64N32 Arch = "SCMP_ARCH_MIPSEL64N32"
|
|
||||||
ArchPPC Arch = "SCMP_ARCH_PPC"
|
|
||||||
ArchPPC64 Arch = "SCMP_ARCH_PPC64"
|
|
||||||
ArchPPC64LE Arch = "SCMP_ARCH_PPC64LE"
|
|
||||||
ArchS390 Arch = "SCMP_ARCH_S390"
|
|
||||||
ArchS390X Arch = "SCMP_ARCH_S390X"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Action taken upon Seccomp rule match
|
|
||||||
type Action string
|
|
||||||
|
|
||||||
// Define actions for Seccomp rules
|
|
||||||
const (
|
|
||||||
ActKill Action = "SCMP_ACT_KILL"
|
|
||||||
ActTrap Action = "SCMP_ACT_TRAP"
|
|
||||||
ActErrno Action = "SCMP_ACT_ERRNO"
|
|
||||||
ActTrace Action = "SCMP_ACT_TRACE"
|
|
||||||
ActAllow Action = "SCMP_ACT_ALLOW"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Operator used to match syscall arguments in Seccomp
|
|
||||||
type Operator string
|
|
||||||
|
|
||||||
// Define operators for syscall arguments in Seccomp
|
|
||||||
const (
|
|
||||||
OpNotEqual Operator = "SCMP_CMP_NE"
|
|
||||||
OpLessThan Operator = "SCMP_CMP_LT"
|
|
||||||
OpLessEqual Operator = "SCMP_CMP_LE"
|
|
||||||
OpEqualTo Operator = "SCMP_CMP_EQ"
|
|
||||||
OpGreaterEqual Operator = "SCMP_CMP_GE"
|
|
||||||
OpGreaterThan Operator = "SCMP_CMP_GT"
|
|
||||||
OpMaskedEqual Operator = "SCMP_CMP_MASKED_EQ"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Arg used for matching specific syscall arguments in Seccomp
|
|
||||||
type Arg struct {
|
|
||||||
Index uint `json:"index"`
|
|
||||||
Value uint64 `json:"value"`
|
|
||||||
ValueTwo uint64 `json:"valueTwo"`
|
|
||||||
Op Operator `json:"op"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Filter is used to conditionally apply Seccomp rules
|
|
||||||
type Filter struct {
|
|
||||||
Caps []string `json:"caps,omitempty"`
|
|
||||||
Arches []string `json:"arches,omitempty"`
|
|
||||||
MinKernel string `json:"minKernel,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Syscall is used to match a group of syscalls in Seccomp
|
|
||||||
type Syscall struct {
|
|
||||||
Name string `json:"name,omitempty"`
|
|
||||||
Names []string `json:"names,omitempty"`
|
|
||||||
Action Action `json:"action"`
|
|
||||||
Args []*Arg `json:"args"`
|
|
||||||
Comment string `json:"comment"`
|
|
||||||
Includes Filter `json:"includes"`
|
|
||||||
Excludes Filter `json:"excludes"`
|
|
||||||
}
|
|
|
@ -7,8 +7,8 @@ https://docs.docker.com/engine/reference/api/
|
||||||
Usage
|
Usage
|
||||||
|
|
||||||
You use the library by creating a client object and calling methods on it. The
|
You use the library by creating a client object and calling methods on it. The
|
||||||
client can be created either from environment variables with NewEnvClient, or
|
client can be created either from environment variables with NewClientWithOpts(client.FromEnv),
|
||||||
configured manually with NewClient.
|
or configured manually with NewClient().
|
||||||
|
|
||||||
For example, to list running containers (the equivalent of "docker ps"):
|
For example, to list running containers (the equivalent of "docker ps"):
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// +build !windows
|
||||||
|
|
||||||
package system // import "github.com/docker/docker/pkg/system"
|
package system // import "github.com/docker/docker/pkg/system"
|
||||||
|
|
||||||
import (
|
import (
|
|
@ -0,0 +1,6 @@
|
||||||
|
package system
|
||||||
|
|
||||||
|
import "os"
|
||||||
|
|
||||||
|
// EnsureRemoveAll is an alias to os.RemoveAll on Windows
|
||||||
|
var EnsureRemoveAll = os.RemoveAll
|
|
@ -1,6 +1,6 @@
|
||||||
github.com/Azure/go-ansiterm d6e3b3328b783f23731bc4d058875b0371ff8109
|
github.com/Azure/go-ansiterm d6e3b3328b783f23731bc4d058875b0371ff8109
|
||||||
github.com/Microsoft/hcsshim 9dcb42f100215f8d375b4a9265e5bba009217a85 # moby branch
|
github.com/Microsoft/hcsshim 9dcb42f100215f8d375b4a9265e5bba009217a85 # moby branch
|
||||||
github.com/Microsoft/go-winio 6c72808b55902eae4c5943626030429ff20f3b63 # v0.4.14
|
github.com/Microsoft/go-winio 5b44b70ab3ab4d291a7c1d28afe7b4afeced0ed4 # v0.4.15-0.20200908182639-5b44b70ab3ab
|
||||||
github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a
|
github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a
|
||||||
github.com/golang/gddo 72a348e765d293ed6d1ded7b699591f14d6cd921
|
github.com/golang/gddo 72a348e765d293ed6d1ded7b699591f14d6cd921
|
||||||
github.com/google/uuid 0cd6bf5da1e1c83f8b45653022c74f71af0538a4 # v1.1.1
|
github.com/google/uuid 0cd6bf5da1e1c83f8b45653022c74f71af0538a4 # v1.1.1
|
||||||
|
@ -10,11 +10,10 @@ github.com/moby/locker 281af2d563954745bea9d1487c96
|
||||||
github.com/moby/term 7f0af18e79f2784809e9cef63d0df5aa2c79d76e
|
github.com/moby/term 7f0af18e79f2784809e9cef63d0df5aa2c79d76e
|
||||||
|
|
||||||
github.com/creack/pty 3a6a957789163cacdfe0e291617a1c8e80612c11 # v1.1.9
|
github.com/creack/pty 3a6a957789163cacdfe0e291617a1c8e80612c11 # v1.1.9
|
||||||
github.com/konsorten/go-windows-terminal-sequences edb144dfd453055e1e49a3d8b410a660b5a87613 # v1.0.3
|
github.com/sirupsen/logrus 6699a89a232f3db797f2e280639854bbc4b89725 # v1.7.0
|
||||||
github.com/sirupsen/logrus 60c74ad9be0d874af0ab0daef6ab07c5c5911f0d # v1.6.0
|
|
||||||
github.com/tchap/go-patricia a7f0089c6f496e8e70402f61733606daa326cac5 # v2.3.0
|
github.com/tchap/go-patricia a7f0089c6f496e8e70402f61733606daa326cac5 # v2.3.0
|
||||||
golang.org/x/net ab34263943818b32f575efc978a3d24e80b04bd7
|
golang.org/x/net ab34263943818b32f575efc978a3d24e80b04bd7
|
||||||
golang.org/x/sys 196b9ba8737a10c9253b04174f25881e562da5b8
|
golang.org/x/sys aee5d888a86055dc6ab0342f9cdc7b53aaeaec62
|
||||||
github.com/docker/go-units 519db1ee28dcc9fd2474ae59fca29a810482bfb1 # v0.4.0
|
github.com/docker/go-units 519db1ee28dcc9fd2474ae59fca29a810482bfb1 # v0.4.0
|
||||||
github.com/docker/go-connections 7395e3f8aa162843a74ed6d48e79627d9792ac55 # v0.4.0
|
github.com/docker/go-connections 7395e3f8aa162843a74ed6d48e79627d9792ac55 # v0.4.0
|
||||||
github.com/moby/sys 6154f11e6840c0d6b0dbb23f4125a6134b3013c9 # mountinfo/v0.1.3
|
github.com/moby/sys 6154f11e6840c0d6b0dbb23f4125a6134b3013c9 # mountinfo/v0.1.3
|
||||||
|
@ -35,13 +34,13 @@ github.com/opentracing/opentracing-go 1361b9cd60be79c4c3a7fa9841b3
|
||||||
github.com/google/shlex e7afc7fbc51079733e9468cdfd1efcd7d196cd1d
|
github.com/google/shlex e7afc7fbc51079733e9468cdfd1efcd7d196cd1d
|
||||||
github.com/opentracing-contrib/go-stdlib b1a47cfbdd7543e70e9ef3e73d0802ad306cc1cc
|
github.com/opentracing-contrib/go-stdlib b1a47cfbdd7543e70e9ef3e73d0802ad306cc1cc
|
||||||
github.com/mitchellh/hashstructure 2bca23e0e452137f789efbc8610126fd8b94f73b
|
github.com/mitchellh/hashstructure 2bca23e0e452137f789efbc8610126fd8b94f73b
|
||||||
github.com/gofrs/flock 392e7fae8f1b0bdbd67dad7237d23f618feb6dbb # v0.7.1
|
github.com/gofrs/flock 6caa7350c26b838538005fae7dbee4e69d9398db # v0.7.3
|
||||||
github.com/grpc-ecosystem/go-grpc-middleware 3c51f7f332123e8be5a157c0802a228ac85bf9db # v1.2.0
|
github.com/grpc-ecosystem/go-grpc-middleware 3c51f7f332123e8be5a157c0802a228ac85bf9db # v1.2.0
|
||||||
|
|
||||||
# libnetwork
|
# libnetwork
|
||||||
|
|
||||||
# When updating, also update LIBNETWORK_COMMIT in hack/dockerfile/install/proxy.installer accordingly
|
# When updating, also update LIBNETWORK_COMMIT in hack/dockerfile/install/proxy.installer accordingly
|
||||||
github.com/docker/libnetwork 9e99af28df21367340c95a3863e31808d689c92a
|
github.com/docker/libnetwork d0951081b35fa4216fc4f0064bf065beeb55a74b
|
||||||
github.com/docker/go-events e31b211e4f1cd09aa76fe4ac244571fab96ae47f
|
github.com/docker/go-events e31b211e4f1cd09aa76fe4ac244571fab96ae47f
|
||||||
github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80
|
github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80
|
||||||
github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec
|
github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec
|
||||||
|
@ -71,8 +70,8 @@ go.etcd.io/bbolt 232d8fc87f50244f9c808f474575
|
||||||
|
|
||||||
# get graph and distribution packages
|
# get graph and distribution packages
|
||||||
github.com/docker/distribution 0d3efadf0154c2b8a4e7b6621fff9809655cc580
|
github.com/docker/distribution 0d3efadf0154c2b8a4e7b6621fff9809655cc580
|
||||||
github.com/vbatts/tar-split 620714a4c508c880ac1bdda9c8370a2b19af1a55 # v0.11.0
|
github.com/vbatts/tar-split 620714a4c508c880ac1bdda9c8370a2b19af1a55 # v0.11.1
|
||||||
github.com/opencontainers/go-digest 279bed98673dd5bef374d3b6e4b09e2af76183bf # v1.0.0-rc1
|
github.com/opencontainers/go-digest ea51bea511f75cfa3ef6098cc253c5c3609b037a # v1.0.0
|
||||||
|
|
||||||
# get go-zfs packages
|
# get go-zfs packages
|
||||||
github.com/mistifyio/go-zfs f784269be439d704d3dfa1906f45dd848fed2beb
|
github.com/mistifyio/go-zfs f784269be439d704d3dfa1906f45dd848fed2beb
|
||||||
|
@ -116,10 +115,11 @@ github.com/bsphere/le_go 7a984a84b5492ae539b79b62fb4a
|
||||||
|
|
||||||
# gcplogs deps
|
# gcplogs deps
|
||||||
golang.org/x/oauth2 bf48bf16ab8d622ce64ec6ce98d2c98f916b6303
|
golang.org/x/oauth2 bf48bf16ab8d622ce64ec6ce98d2c98f916b6303
|
||||||
google.golang.org/api de943baf05a022a8f921b544b7827bacaba1aed5
|
google.golang.org/api dec2ee309f5b09fc59bc40676447c15736284d78 # v0.8.0
|
||||||
go.opencensus.io c3ed530f775d85e577ca652cb052a52c078aad26 # v0.11.0
|
github.com/golang/groupcache 869f871628b6baa9cfbc11732cdf6546b17c1298
|
||||||
cloud.google.com/go 0fd7230b2a7505833d5f69b75cbd6c9582401479 # v0.23.0
|
go.opencensus.io d835ff86be02193d324330acdb7d65546b05f814 # v0.22.3
|
||||||
github.com/googleapis/gax-go 317e0006254c44a0ac427cc52a0e083ff0b9622f # v2.0.0
|
cloud.google.com/go ceeb313ad77b789a7fa5287b36a1d127b69b7093 # v0.44.3
|
||||||
|
github.com/googleapis/gax-go bd5b16380fd03dc758d11cef74ba2e3bc8b0e8c2 # v2.0.5
|
||||||
google.golang.org/genproto 3f1135a288c9a07e340ae8ba4cc6c7065a3160e8
|
google.golang.org/genproto 3f1135a288c9a07e340ae8ba4cc6c7065a3160e8
|
||||||
|
|
||||||
# containerd
|
# containerd
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Copyright (c) 2015, Tim Heckman
|
Copyright (c) 2015-2020, Tim Heckman
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -11,9 +11,9 @@ modification, are permitted provided that the following conditions are met:
|
||||||
this list of conditions and the following disclaimer in the documentation
|
this list of conditions and the following disclaimer in the documentation
|
||||||
and/or other materials provided with the distribution.
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
* Neither the name of linode-netint nor the names of its
|
* Neither the name of gofrs nor the names of its contributors may be used
|
||||||
contributors may be used to endorse or promote products derived from
|
to endorse or promote products derived from this software without
|
||||||
this software without specific prior written permission.
|
specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# flock
|
# flock
|
||||||
[![TravisCI Build Status](https://img.shields.io/travis/gofrs/flock/master.svg?style=flat)](https://travis-ci.org/gofrs/flock)
|
[![TravisCI Build Status](https://img.shields.io/travis/gofrs/flock/master.svg?style=flat)](https://travis-ci.org/gofrs/flock)
|
||||||
[![GoDoc](https://img.shields.io/badge/godoc-go--flock-blue.svg?style=flat)](https://godoc.org/github.com/gofrs/flock)
|
[![GoDoc](https://img.shields.io/badge/godoc-flock-blue.svg?style=flat)](https://godoc.org/github.com/gofrs/flock)
|
||||||
[![License](https://img.shields.io/badge/license-BSD_3--Clause-brightgreen.svg?style=flat)](https://github.com/gofrs/flock/blob/master/LICENSE)
|
[![License](https://img.shields.io/badge/license-BSD_3--Clause-brightgreen.svg?style=flat)](https://github.com/gofrs/flock/blob/master/LICENSE)
|
||||||
[![Go Report Card](https://goreportcard.com/badge/github.com/gofrs/flock)](https://goreportcard.com/report/github.com/gofrs/flock)
|
[![Go Report Card](https://goreportcard.com/badge/github.com/gofrs/flock)](https://goreportcard.com/report/github.com/gofrs/flock)
|
||||||
|
|
||||||
|
|
|
@ -125,3 +125,11 @@ func (f *Flock) setFh() error {
|
||||||
f.fh = fh
|
f.fh = fh
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ensure the file handle is closed if no lock is held
|
||||||
|
func (f *Flock) ensureFhState() {
|
||||||
|
if !f.l && !f.r && f.fh != nil {
|
||||||
|
f.fh.Close()
|
||||||
|
f.fh = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ func (f *Flock) lock(locked *bool, flag int) error {
|
||||||
if err := f.setFh(); err != nil {
|
if err := f.setFh(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer f.ensureFhState()
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := syscall.Flock(int(f.fh.Fd()), flag); err != nil {
|
if err := syscall.Flock(int(f.fh.Fd()), flag); err != nil {
|
||||||
|
@ -142,6 +143,7 @@ func (f *Flock) try(locked *bool, flag int) (bool, error) {
|
||||||
if err := f.setFh(); err != nil {
|
if err := f.setFh(); err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
defer f.ensureFhState()
|
||||||
}
|
}
|
||||||
|
|
||||||
var retried bool
|
var retried bool
|
||||||
|
|
|
@ -46,6 +46,7 @@ func (f *Flock) lock(locked *bool, flag uint32) error {
|
||||||
if err := f.setFh(); err != nil {
|
if err := f.setFh(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer f.ensureFhState()
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, errNo := lockFileEx(syscall.Handle(f.fh.Fd()), flag, 0, 1, 0, &syscall.Overlapped{}); errNo > 0 {
|
if _, errNo := lockFileEx(syscall.Handle(f.fh.Fd()), flag, 0, 1, 0, &syscall.Overlapped{}); errNo > 0 {
|
||||||
|
@ -122,6 +123,7 @@ func (f *Flock) try(locked *bool, flag uint32) (bool, error) {
|
||||||
if err := f.setFh(); err != nil {
|
if err := f.setFh(); err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
defer f.ensureFhState()
|
||||||
}
|
}
|
||||||
|
|
||||||
_, errNo := lockFileEx(syscall.Handle(f.fh.Fd()), flag|winLockfileFailImmediately, 0, 1, 0, &syscall.Overlapped{})
|
_, errNo := lockFileEx(syscall.Handle(f.fh.Fd()), flag|winLockfileFailImmediately, 0, 1, 0, &syscall.Overlapped{})
|
||||||
|
|
|
@ -176,6 +176,7 @@
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
Copyright 2019, 2020 OCI Contributors
|
||||||
Copyright 2016 Docker, Inc.
|
Copyright 2016 Docker, Inc.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
@ -8,20 +8,16 @@ Please see the [godoc](https://godoc.org/github.com/opencontainers/go-digest) fo
|
||||||
|
|
||||||
# What is a digest?
|
# What is a digest?
|
||||||
|
|
||||||
A digest is just a hash.
|
A digest is just a [hash](https://en.wikipedia.org/wiki/Hash_function).
|
||||||
|
|
||||||
The most common use case for a digest is to create a content
|
The most common use case for a digest is to create a content identifier for use in [Content Addressable Storage](https://en.wikipedia.org/wiki/Content-addressable_storage) systems:
|
||||||
identifier for use in [Content Addressable Storage](https://en.wikipedia.org/wiki/Content-addressable_storage)
|
|
||||||
systems:
|
|
||||||
|
|
||||||
```go
|
```go
|
||||||
id := digest.FromBytes([]byte("my content"))
|
id := digest.FromBytes([]byte("my content"))
|
||||||
```
|
```
|
||||||
|
|
||||||
In the example above, the id can be used to uniquely identify
|
In the example above, the id can be used to uniquely identify the byte slice "my content".
|
||||||
the byte slice "my content". This allows two disparate applications
|
This allows two disparate applications to agree on a verifiable identifier without having to trust one another.
|
||||||
to agree on a verifiable identifier without having to trust one
|
|
||||||
another.
|
|
||||||
|
|
||||||
An identifying digest can be verified, as follows:
|
An identifying digest can be verified, as follows:
|
||||||
|
|
||||||
|
@ -31,8 +27,7 @@ if id != digest.FromBytes([]byte("my content")) {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
A `Verifier` type can be used to handle cases where an `io.Reader`
|
A `Verifier` type can be used to handle cases where an `io.Reader` makes more sense:
|
||||||
makes more sense:
|
|
||||||
|
|
||||||
```go
|
```go
|
||||||
rd := getContent()
|
rd := getContent()
|
||||||
|
@ -44,18 +39,14 @@ if !verifier.Verified() {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Using [Merkle DAGs](https://en.wikipedia.org/wiki/Merkle_tree), this
|
Using [Merkle DAGs](https://en.wikipedia.org/wiki/Merkle_tree), this can power a rich, safe, content distribution system.
|
||||||
can power a rich, safe, content distribution system.
|
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
While the [godoc](https://godoc.org/github.com/opencontainers/go-digest) is
|
While the [godoc](https://godoc.org/github.com/opencontainers/go-digest) is considered the best resource, a few important items need to be called out when using this package.
|
||||||
considered the best resource, a few important items need to be called
|
|
||||||
out when using this package.
|
|
||||||
|
|
||||||
1. Make sure to import the hash implementations into your application
|
1. Make sure to import the hash implementations into your application or the package will panic.
|
||||||
or the package will panic. You should have something like the
|
You should have something like the following in the main (or other entrypoint) of your application:
|
||||||
following in the main (or other entrypoint) of your application:
|
|
||||||
|
|
||||||
```go
|
```go
|
||||||
import (
|
import (
|
||||||
|
@ -66,11 +57,10 @@ out when using this package.
|
||||||
This may seem inconvenient but it allows you replace the hash
|
This may seem inconvenient but it allows you replace the hash
|
||||||
implementations with others, such as https://github.com/stevvooe/resumable.
|
implementations with others, such as https://github.com/stevvooe/resumable.
|
||||||
|
|
||||||
2. Even though `digest.Digest` may be assemable as a string, _always_
|
2. Even though `digest.Digest` may be assemblable as a string, _always_ verify your input with `digest.Parse` or use `Digest.Validate` when accepting untrusted input.
|
||||||
verify your input with `digest.Parse` or use `Digest.Validate`
|
While there are measures to avoid common problems, this will ensure you have valid digests in the rest of your application.
|
||||||
when accepting untrusted input. While there are measures to
|
|
||||||
avoid common problems, this will ensure you have valid digests
|
3. While alternative encodings of hash values (digests) are possible (for example, base64), this package deals exclusively with hex-encoded digests.
|
||||||
in the rest of your application.
|
|
||||||
|
|
||||||
# Stability
|
# Stability
|
||||||
|
|
||||||
|
@ -80,25 +70,27 @@ As always, before using a package export, read the [godoc](https://godoc.org/git
|
||||||
|
|
||||||
# Contributing
|
# Contributing
|
||||||
|
|
||||||
This package is considered fairly complete. It has been in production
|
This package is considered fairly complete.
|
||||||
in thousands (millions?) of deployments and is fairly battle-hardened.
|
It has been in production in thousands (millions?) of deployments and is fairly battle-hardened.
|
||||||
New additions will be met with skepticism. If you think there is a
|
New additions will be met with skepticism.
|
||||||
missing feature, please file a bug clearly describing the problem and
|
If you think there is a missing feature, please file a bug clearly describing the problem and the alternatives you tried before submitting a PR.
|
||||||
the alternatives you tried before submitting a PR.
|
|
||||||
|
|
||||||
# Reporting security issues
|
## Code of Conduct
|
||||||
|
|
||||||
Please DO NOT file a public issue, instead send your report privately to
|
Participation in the OpenContainers community is governed by [OpenContainer's Code of Conduct][code-of-conduct].
|
||||||
security@opencontainers.org.
|
|
||||||
|
|
||||||
The maintainers take security seriously. If you discover a security issue,
|
## Security
|
||||||
please bring it to their attention right away!
|
|
||||||
|
|
||||||
If you are reporting a security issue, do not create an issue or file a pull
|
If you find an issue, please follow the [security][security] protocol to report it.
|
||||||
request on GitHub. Instead, disclose the issue responsibly by sending an email
|
|
||||||
to security@opencontainers.org (which is inhabited only by the maintainers of
|
|
||||||
the various OCI projects).
|
|
||||||
|
|
||||||
# Copyright and license
|
# Copyright and license
|
||||||
|
|
||||||
Copyright © 2016 Docker, Inc. All rights reserved, except as follows. Code is released under the [Apache 2.0 license](LICENSE.code). This `README.md` file and the [`CONTRIBUTING.md`](CONTRIBUTING.md) file are licensed under the Creative Commons Attribution 4.0 International License under the terms and conditions set forth in the file [`LICENSE.docs`](LICENSE.docs). You may obtain a duplicate copy of the same license, titled CC BY-SA 4.0, at http://creativecommons.org/licenses/by-sa/4.0/.
|
Copyright © 2019, 2020 OCI Contributors
|
||||||
|
Copyright © 2016 Docker, Inc.
|
||||||
|
All rights reserved, except as follows.
|
||||||
|
Code is released under the [Apache 2.0 license](LICENSE).
|
||||||
|
This `README.md` file and the [`CONTRIBUTING.md`](CONTRIBUTING.md) file are licensed under the Creative Commons Attribution 4.0 International License under the terms and conditions set forth in the file [`LICENSE.docs`](LICENSE.docs).
|
||||||
|
You may obtain a duplicate copy of the same license, titled CC BY-SA 4.0, at http://creativecommons.org/licenses/by-sa/4.0/.
|
||||||
|
|
||||||
|
[security]: https://github.com/opencontainers/org/blob/master/security
|
||||||
|
[code-of-conduct]: https://github.com/opencontainers/org/blob/master/CODE_OF_CONDUCT.md
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// Copyright 2019, 2020 OCI Contributors
|
||||||
// Copyright 2017 Docker, Inc.
|
// Copyright 2017 Docker, Inc.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// Copyright 2019, 2020 OCI Contributors
|
||||||
// Copyright 2017 Docker, Inc.
|
// Copyright 2017 Docker, Inc.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// Copyright 2019, 2020 OCI Contributors
|
||||||
// Copyright 2017 Docker, Inc.
|
// Copyright 2017 Docker, Inc.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// Copyright 2019, 2020 OCI Contributors
|
||||||
// Copyright 2017 Docker, Inc.
|
// Copyright 2017 Docker, Inc.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@ -29,8 +30,13 @@
|
||||||
//
|
//
|
||||||
// sha256:7173b809ca12ec5dee4506cd86be934c4596dd234ee82c0662eac04a8c2c71dc
|
// sha256:7173b809ca12ec5dee4506cd86be934c4596dd234ee82c0662eac04a8c2c71dc
|
||||||
//
|
//
|
||||||
// In this case, the string "sha256" is the algorithm and the hex bytes are
|
// The "algorithm" portion defines both the hashing algorithm used to calculate
|
||||||
// the "digest".
|
// the digest and the encoding of the resulting digest, which defaults to "hex"
|
||||||
|
// if not otherwise specified. Currently, all supported algorithms have their
|
||||||
|
// digests encoded in hex strings.
|
||||||
|
//
|
||||||
|
// In the example above, the string "sha256" is the algorithm and the hex bytes
|
||||||
|
// are the "digest".
|
||||||
//
|
//
|
||||||
// Because the Digest type is simply a string, once a valid Digest is
|
// Because the Digest type is simply a string, once a valid Digest is
|
||||||
// obtained, comparisons are cheap, quick and simple to express with the
|
// obtained, comparisons are cheap, quick and simple to express with the
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
module github.com/opencontainers/go-digest
|
||||||
|
|
||||||
|
go 1.13
|
|
@ -1,3 +1,4 @@
|
||||||
|
// Copyright 2019, 2020 OCI Contributors
|
||||||
// Copyright 2017 Docker, Inc.
|
// Copyright 2017 Docker, Inc.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|
Loading…
Reference in New Issue