From 9b1405b875c40c3a561d90da69adeea1fd8c57a9 Mon Sep 17 00:00:00 2001 From: Iman Tung Date: Thu, 24 May 2018 11:42:11 +0800 Subject: [PATCH] glide up --- cmds/receiver.go | 3 +- glide.lock | 14 +- vendor/github.com/olivere/elastic/README.md | 4 + .../github.com/olivere/elastic/cat_aliases.go | 166 +++++++++ .../olivere/elastic/cat_aliases_test.go | 43 +++ .../olivere/elastic/cat_allocation.go | 185 ++++++++++ .../olivere/elastic/cat_allocation_test.go | 28 ++ .../github.com/olivere/elastic/cat_count.go | 161 +++++++++ .../olivere/elastic/cat_count_test.go | 28 ++ .../github.com/olivere/elastic/cat_health.go | 157 +++++++++ .../olivere/elastic/cat_health_test.go | 28 ++ .../github.com/olivere/elastic/cat_indices.go | 315 ++++++++++++++++++ .../olivere/elastic/cat_indices_test.go | 28 ++ vendor/github.com/olivere/elastic/client.go | 50 ++- vendor/github.com/olivere/elastic/script.go | 8 +- .../olivere/elastic/script_delete.go | 134 ++++++++ .../olivere/elastic/script_delete_test.go | 84 +++++ .../github.com/olivere/elastic/script_get.go | 117 +++++++ .../olivere/elastic/script_get_test.go | 91 +++++ .../github.com/olivere/elastic/script_put.go | 174 ++++++++++ .../olivere/elastic/script_put_test.go | 66 ++++ .../github.com/olivere/elastic/script_test.go | 20 -- .../elastic/update_integration_test.go | 66 ++++ vendor/github.com/sirupsen/logrus/README.md | 58 +--- .../x/crypto/acme/autocert/autocert.go | 24 ++ .../x/crypto/acme/autocert/autocert_test.go | 99 ++++++ vendor/golang.org/x/crypto/openpgp/keys.go | 19 +- .../golang.org/x/crypto/openpgp/keys_test.go | 14 + vendor/golang.org/x/net/http2/server.go | 5 +- vendor/golang.org/x/net/http2/server_test.go | 19 ++ .../golang.org/x/sys/unix/dev_openbsd_test.go | 7 +- .../golang.org/x/sys/unix/dev_solaris_test.go | 51 --- vendor/golang.org/x/sys/unix/mkerrors.sh | 4 +- .../golang.org/x/sys/unix/openbsd_pledge.go | 4 +- .../golang.org/x/sys/unix/syscall_darwin.go | 86 ++++- .../x/sys/unix/syscall_freebsd_test.go | 15 + .../x/sys/unix/syscall_linux_test.go | 16 +- .../x/sys/unix/syscall_openbsd_amd64.go | 4 + vendor/golang.org/x/sys/unix/xattr_test.go | 26 ++ .../x/sys/unix/zerrors_darwin_386.go | 6 + .../x/sys/unix/zerrors_darwin_amd64.go | 6 + .../x/sys/unix/zerrors_darwin_arm.go | 6 + .../x/sys/unix/zerrors_darwin_arm64.go | 6 + .../x/sys/unix/zerrors_openbsd_amd64.go | 251 ++++++++++---- .../x/sys/unix/zsyscall_darwin_386.go | 77 +++++ .../x/sys/unix/zsyscall_darwin_amd64.go | 77 +++++ .../x/sys/unix/zsyscall_darwin_arm.go | 79 ++++- .../x/sys/unix/zsyscall_darwin_arm64.go | 77 +++++ .../x/sys/unix/zsysctl_openbsd_amd64.go | 51 ++- .../x/sys/unix/zsysnum_openbsd_amd64.go | 24 +- .../x/sys/unix/ztypes_openbsd_amd64.go | 91 +++-- .../x/sys/windows/asm_windows_amd64.s | 2 +- vendor/gopkg.in/olivere/elastic.v6/README.md | 4 + vendor/gopkg.in/olivere/elastic.v6/client.go | 20 +- vendor/gopkg.in/olivere/elastic.v6/script.go | 8 +- .../olivere/elastic.v6/script_delete.go | 134 ++++++++ .../olivere/elastic.v6/script_delete_test.go | 84 +++++ .../gopkg.in/olivere/elastic.v6/script_get.go | 117 +++++++ .../olivere/elastic.v6/script_get_test.go | 91 +++++ .../gopkg.in/olivere/elastic.v6/script_put.go | 174 ++++++++++ .../olivere/elastic.v6/script_put_test.go | 66 ++++ .../olivere/elastic.v6/script_test.go | 20 -- .../elastic.v6/update_integration_test.go | 66 ++++ 63 files changed, 3600 insertions(+), 358 deletions(-) create mode 100644 vendor/github.com/olivere/elastic/cat_aliases.go create mode 100644 vendor/github.com/olivere/elastic/cat_aliases_test.go create mode 100644 vendor/github.com/olivere/elastic/cat_allocation.go create mode 100644 vendor/github.com/olivere/elastic/cat_allocation_test.go create mode 100644 vendor/github.com/olivere/elastic/cat_count.go create mode 100644 vendor/github.com/olivere/elastic/cat_count_test.go create mode 100644 vendor/github.com/olivere/elastic/cat_health.go create mode 100644 vendor/github.com/olivere/elastic/cat_health_test.go create mode 100644 vendor/github.com/olivere/elastic/cat_indices.go create mode 100644 vendor/github.com/olivere/elastic/cat_indices_test.go create mode 100644 vendor/github.com/olivere/elastic/script_delete.go create mode 100644 vendor/github.com/olivere/elastic/script_delete_test.go create mode 100644 vendor/github.com/olivere/elastic/script_get.go create mode 100644 vendor/github.com/olivere/elastic/script_get_test.go create mode 100644 vendor/github.com/olivere/elastic/script_put.go create mode 100644 vendor/github.com/olivere/elastic/script_put_test.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_solaris_test.go create mode 100644 vendor/gopkg.in/olivere/elastic.v6/script_delete.go create mode 100644 vendor/gopkg.in/olivere/elastic.v6/script_delete_test.go create mode 100644 vendor/gopkg.in/olivere/elastic.v6/script_get.go create mode 100644 vendor/gopkg.in/olivere/elastic.v6/script_get_test.go create mode 100644 vendor/gopkg.in/olivere/elastic.v6/script_put.go create mode 100644 vendor/gopkg.in/olivere/elastic.v6/script_put_test.go diff --git a/cmds/receiver.go b/cmds/receiver.go index eb83e461..e5fb0856 100644 --- a/cmds/receiver.go +++ b/cmds/receiver.go @@ -6,7 +6,8 @@ import ( "github.com/BaritoLog/barito-flow/flow" "github.com/Shopify/sarama" - "github.com/containous/traefik/log" + log "github.com/sirupsen/logrus" + "github.com/urfave/cli" ) diff --git a/glide.lock b/glide.lock index a2539803..6a672815 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ hash: 5ba2eb8cfa2ee42da0491cd6cf3ba8e0780c118e11105a274943de768a9d0ef5 -updated: 2018-05-22T15:24:36.337438+08:00 +updated: 2018-05-24T11:41:37.945121+08:00 imports: - name: github.com/BaritoLog/go-boilerplate version: 87386a2e8135fbc6ac10a2a47daf6da1fb6c8fc0 @@ -36,7 +36,7 @@ imports: - jlexer - jwriter - name: github.com/olivere/elastic - version: 44bae82109267d22e07c6eb6937806ebb0cd9699 + version: 33ad30f61610dad54dc9a24b0e1fa875e89a2639 subpackages: - config - uritemplates @@ -55,22 +55,22 @@ imports: subpackages: - mocks - name: github.com/sirupsen/logrus - version: 0dad3b6953e73d351ec8ebfd8a8c6b088d320381 + version: ea8897e79973357ba785ac2533559a6297e83c44 - name: github.com/urfave/cli version: 8e01ec4cd3e2d84ab2fe90d8210528ffbb06d8ff - name: golang.org/x/crypto - version: 1a580b3eff7814fc9b40602fd35256c63b50f491 + version: 75e913eb8a8e3d31a97b216de09de106a7b07681 subpackages: - ssh/terminal - name: golang.org/x/net - version: 8e0cdda24ed423affc8f35c241e5e9b16180338e + version: 9ef9f5bb98a1fdc41f8cf6c250a4404b4085e389 subpackages: - http/httpguts - http2 - http2/hpack - idna - name: golang.org/x/sys - version: 7c87d13f8e835d2fb3a70a2912c811ed0c1d241b + version: 77b0e4315053a57ed2962443614bdb28db152054 subpackages: - unix - windows @@ -82,5 +82,5 @@ imports: - unicode/bidi - unicode/norm - name: gopkg.in/olivere/elastic.v6 - version: 44bae82109267d22e07c6eb6937806ebb0cd9699 + version: f6c25d4a1713cf170f84eff4d70485dd8108d2e7 testImports: [] diff --git a/vendor/github.com/olivere/elastic/README.md b/vendor/github.com/olivere/elastic/README.md index 6e840385..f9bfae25 100644 --- a/vendor/github.com/olivere/elastic/README.md +++ b/vendor/github.com/olivere/elastic/README.md @@ -363,6 +363,10 @@ The cat APIs are not implemented as of now. We think they are better suited for - [ ] Snapshot status - [ ] Monitoring snapshot/restore status - [ ] Stopping currently running snapshot and restore +- Scripting + - [x] GetScript + - [x] PutScript + - [x] DeleteScript ### Sorting diff --git a/vendor/github.com/olivere/elastic/cat_aliases.go b/vendor/github.com/olivere/elastic/cat_aliases.go new file mode 100644 index 00000000..2c5d66b3 --- /dev/null +++ b/vendor/github.com/olivere/elastic/cat_aliases.go @@ -0,0 +1,166 @@ +// Copyright 2012-present Oliver Eilhard. All rights reserved. +// Use of this source code is governed by a MIT-license. +// See http://olivere.mit-license.org/license.txt for details. + +package elastic + +import ( + "context" + "fmt" + "net/url" + "strings" + + "github.com/olivere/elastic/uritemplates" +) + +// CatAliasesService shows information about currently configured aliases +// to indices including filter and routing infos. +// +// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/cat-aliases.html +// for details. +type CatAliasesService struct { + client *Client + pretty bool + local *bool + masterTimeout string + aliases []string + columns []string + sort []string // list of columns for sort order +} + +// NewCatAliasesService creates a new CatAliasesService. +func NewCatAliasesService(client *Client) *CatAliasesService { + return &CatAliasesService{ + client: client, + } +} + +// Alias specifies one or more aliases to which information should be returned. +func (s *CatAliasesService) Alias(alias ...string) *CatAliasesService { + s.aliases = alias + return s +} + +// Local indicates to return local information, i.e. do not retrieve +// the state from master node (default: false). +func (s *CatAliasesService) Local(local bool) *CatAliasesService { + s.local = &local + return s +} + +// MasterTimeout is the explicit operation timeout for connection to master node. +func (s *CatAliasesService) MasterTimeout(masterTimeout string) *CatAliasesService { + s.masterTimeout = masterTimeout + return s +} + +// Columns to return in the response. +// To get a list of all possible columns to return, run the following command +// in your terminal: +// +// Example: +// curl 'http://localhost:9200/_cat/aliases?help' +// +// You can use Columns("*") to return all possible columns. That might take +// a little longer than the default set of columns. +func (s *CatAliasesService) Columns(columns ...string) *CatAliasesService { + s.columns = columns + return s +} + +// Sort is a list of fields to sort by. +func (s *CatAliasesService) Sort(fields ...string) *CatAliasesService { + s.sort = fields + return s +} + +// Pretty indicates that the JSON response be indented and human readable. +func (s *CatAliasesService) Pretty(pretty bool) *CatAliasesService { + s.pretty = pretty + return s +} + +// buildURL builds the URL for the operation. +func (s *CatAliasesService) buildURL() (string, url.Values, error) { + // Build URL + var ( + path string + err error + ) + + if len(s.aliases) > 0 { + path, err = uritemplates.Expand("/_cat/indices/{name}", map[string]string{ + "name": strings.Join(s.aliases, ","), + }) + } else { + path = "/_cat/aliases" + } + if err != nil { + return "", url.Values{}, err + } + + // Add query string parameters + params := url.Values{ + "format": []string{"json"}, // always returns as JSON + } + if s.pretty { + params.Set("pretty", "true") + } + if v := s.local; v != nil { + params.Set("local", fmt.Sprint(*v)) + } + if s.masterTimeout != "" { + params.Set("master_timeout", s.masterTimeout) + } + if len(s.sort) > 0 { + params.Set("s", strings.Join(s.sort, ",")) + } + return path, params, nil +} + +// Do executes the operation. +func (s *CatAliasesService) Do(ctx context.Context) (CatAliasesResponse, error) { + // Get URL for request + path, params, err := s.buildURL() + if err != nil { + return nil, err + } + + // Get HTTP response + res, err := s.client.PerformRequest(ctx, PerformRequestOptions{ + Method: "GET", + Path: path, + Params: params, + }) + if err != nil { + return nil, err + } + + // Return operation response + var ret CatAliasesResponse + if err := s.client.decoder.Decode(res.Body, &ret); err != nil { + return nil, err + } + return ret, nil +} + +// -- Result of a get request. + +// CatAliasesResponse is the outcome of CatAliasesService.Do. +type CatAliasesResponse []CatAliasesResponseRow + +// CatAliasesResponseRow is a single row in a CatAliasesResponse. +// Notice that not all of these fields might be filled; that depends +// on the number of columns chose in the request (see CatAliasesService.Columns). +type CatAliasesResponseRow struct { + // Alias name. + Alias string `json:"alias"` + // Index the alias points to. + Index string `json:"index"` + // Filter, e.g. "*" or "-". + Filter string `json:"filter"` + // RoutingIndex specifies the index routing (or "-"). + RoutingIndex string `json:"routing.index"` + // RoutingSearch specifies the search routing (or "-"). + RoutingSearch string `json:"routing.search"` +} diff --git a/vendor/github.com/olivere/elastic/cat_aliases_test.go b/vendor/github.com/olivere/elastic/cat_aliases_test.go new file mode 100644 index 00000000..aaabcf7a --- /dev/null +++ b/vendor/github.com/olivere/elastic/cat_aliases_test.go @@ -0,0 +1,43 @@ +// Copyright 2012-present Oliver Eilhard. All rights reserved. +// Use of this source code is governed by a MIT-license. +// See http://olivere.mit-license.org/license.txt for details. + +package elastic + +import ( + "context" + "testing" +) + +func TestCatAliases(t *testing.T) { + client := setupTestClientAndCreateIndexAndAddDocs(t) // , SetTraceLog(log.New(os.Stdout, "", 0))) + ctx := context.Background() + + // Add two aliases + _, err := client.Alias(). + Add(testIndexName, testAliasName). + Action(NewAliasAddAction(testAliasName).Index(testIndexName2)). + Do(context.TODO()) + if err != nil { + t.Fatal(err) + } + defer func() { + // Remove aliases + client.Alias(). + Remove(testIndexName, testAliasName). + Remove(testIndexName2, testAliasName). + Do(context.TODO()) + }() + + // Check the response + res, err := client.CatAliases().Pretty(true).Do(ctx) + if err != nil { + t.Fatal(err) + } + if res == nil { + t.Fatal("want response, have nil") + } + if want, have := 2, len(res); want != have { + t.Fatalf("want len=%d, have %d", want, have) + } +} diff --git a/vendor/github.com/olivere/elastic/cat_allocation.go b/vendor/github.com/olivere/elastic/cat_allocation.go new file mode 100644 index 00000000..ec15dcaf --- /dev/null +++ b/vendor/github.com/olivere/elastic/cat_allocation.go @@ -0,0 +1,185 @@ +// Copyright 2012-present Oliver Eilhard. All rights reserved. +// Use of this source code is governed by a MIT-license. +// See http://olivere.mit-license.org/license.txt for details. + +package elastic + +import ( + "context" + "fmt" + "net/url" + "strings" + + "github.com/olivere/elastic/uritemplates" +) + +// CatAllocationService provides a snapshot of how many shards are allocated +// to each data node and how much disk space they are using. +// +// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/cat-allocation.html +// for details. +type CatAllocationService struct { + client *Client + pretty bool + bytes string // b, k, m, or g + local *bool + masterTimeout string + nodes []string + columns []string + sort []string // list of columns for sort order +} + +// NewCatAllocationService creates a new CatAllocationService. +func NewCatAllocationService(client *Client) *CatAllocationService { + return &CatAllocationService{ + client: client, + } +} + +// NodeID specifies one or more node IDs to for information should be returned. +func (s *CatAllocationService) NodeID(nodes ...string) *CatAllocationService { + s.nodes = nodes + return s +} + +// Bytes represents the unit in which to display byte values. +// Valid values are: "b", "k", "m", or "g". +func (s *CatAllocationService) Bytes(bytes string) *CatAllocationService { + s.bytes = bytes + return s +} + +// Local indicates to return local information, i.e. do not retrieve +// the state from master node (default: false). +func (s *CatAllocationService) Local(local bool) *CatAllocationService { + s.local = &local + return s +} + +// MasterTimeout is the explicit operation timeout for connection to master node. +func (s *CatAllocationService) MasterTimeout(masterTimeout string) *CatAllocationService { + s.masterTimeout = masterTimeout + return s +} + +// Columns to return in the response. +// To get a list of all possible columns to return, run the following command +// in your terminal: +// +// Example: +// curl 'http://localhost:9200/_cat/aliases?help' +// +// You can use Columns("*") to return all possible columns. That might take +// a little longer than the default set of columns. +func (s *CatAllocationService) Columns(columns ...string) *CatAllocationService { + s.columns = columns + return s +} + +// Sort is a list of fields to sort by. +func (s *CatAllocationService) Sort(fields ...string) *CatAllocationService { + s.sort = fields + return s +} + +// Pretty indicates that the JSON response be indented and human readable. +func (s *CatAllocationService) Pretty(pretty bool) *CatAllocationService { + s.pretty = pretty + return s +} + +// buildURL builds the URL for the operation. +func (s *CatAllocationService) buildURL() (string, url.Values, error) { + // Build URL + var ( + path string + err error + ) + + if len(s.nodes) > 0 { + path, err = uritemplates.Expand("/_cat/allocation/{node_id}", map[string]string{ + "node_id": strings.Join(s.nodes, ","), + }) + } else { + path = "/_cat/allocation" + } + if err != nil { + return "", url.Values{}, err + } + + // Add query string parameters + params := url.Values{ + "format": []string{"json"}, // always returns as JSON + } + if s.pretty { + params.Set("pretty", "true") + } + if s.bytes != "" { + params.Set("bytes", s.bytes) + } + if v := s.local; v != nil { + params.Set("local", fmt.Sprint(*v)) + } + if s.masterTimeout != "" { + params.Set("master_timeout", s.masterTimeout) + } + if len(s.sort) > 0 { + params.Set("s", strings.Join(s.sort, ",")) + } + return path, params, nil +} + +// Do executes the operation. +func (s *CatAllocationService) Do(ctx context.Context) (CatAllocationResponse, error) { + // Get URL for request + path, params, err := s.buildURL() + if err != nil { + return nil, err + } + + // Get HTTP response + res, err := s.client.PerformRequest(ctx, PerformRequestOptions{ + Method: "GET", + Path: path, + Params: params, + }) + if err != nil { + return nil, err + } + + // Return operation response + var ret CatAllocationResponse + if err := s.client.decoder.Decode(res.Body, &ret); err != nil { + return nil, err + } + return ret, nil +} + +// -- Result of a get request. + +// CatAllocationResponse is the outcome of CatAllocationService.Do. +type CatAllocationResponse []CatAllocationResponseRow + +// CatAllocationResponseRow is a single row in a CatAllocationResponse. +// Notice that not all of these fields might be filled; that depends +// on the number of columns chose in the request (see CatAllocationService.Columns). +type CatAllocationResponseRow struct { + // Shards represents the number of shards on a node. + Shards int `json:"shards,string"` + // DiskIndices represents the disk used by ES indices, e.g. "46.1kb". + DiskIndices string `json:"disk.indices"` + // DiskUsed represents the disk used (total, not just ES), e.g. "34.5gb" + DiskUsed string `json:"disk.used"` + // DiskAvail represents the disk available, e.g. "53.2gb". + DiskAvail string `json:"disk.avail"` + // DiskTotal represents the total capacity of all volumes, e.g. "87.7gb". + DiskTotal string `json:"disk.total"` + // DiskPercent represents the percent of disk used, e.g. 39. + DiskPercent int `json:"disk.percent,string"` + // Host represents the hostname of the node. + Host string `json:"host"` + // IP represents the IP address of the node. + IP string `json:"ip"` + // Node represents the node ID. + Node string `json:"node"` +} diff --git a/vendor/github.com/olivere/elastic/cat_allocation_test.go b/vendor/github.com/olivere/elastic/cat_allocation_test.go new file mode 100644 index 00000000..b0e358ee --- /dev/null +++ b/vendor/github.com/olivere/elastic/cat_allocation_test.go @@ -0,0 +1,28 @@ +// Copyright 2012-present Oliver Eilhard. All rights reserved. +// Use of this source code is governed by a MIT-license. +// See http://olivere.mit-license.org/license.txt for details. + +package elastic + +import ( + "context" + "testing" +) + +func TestCatAllocation(t *testing.T) { + client := setupTestClientAndCreateIndexAndAddDocs(t) // , SetTraceLog(log.New(os.Stdout, "", 0))) + ctx := context.Background() + res, err := client.CatAllocation().Do(ctx) + if err != nil { + t.Fatal(err) + } + if res == nil { + t.Fatal("want response, have nil") + } + if len(res) == 0 { + t.Fatalf("want response, have: %v", res) + } + if have := res[0].IP; have == "" { + t.Fatalf("IP[0]: want != %q, have %q", "", have) + } +} diff --git a/vendor/github.com/olivere/elastic/cat_count.go b/vendor/github.com/olivere/elastic/cat_count.go new file mode 100644 index 00000000..87d67c8e --- /dev/null +++ b/vendor/github.com/olivere/elastic/cat_count.go @@ -0,0 +1,161 @@ +// Copyright 2012-present Oliver Eilhard. All rights reserved. +// Use of this source code is governed by a MIT-license. +// See http://olivere.mit-license.org/license.txt for details. + +package elastic + +import ( + "context" + "fmt" + "net/url" + "strings" + + "github.com/olivere/elastic/uritemplates" +) + +// CatCountService provides quick access to the document count of the entire cluster, +// or individual indices. +// +// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/cat-count.html +// for details. +type CatCountService struct { + client *Client + pretty bool + index []string + local *bool + masterTimeout string + columns []string + sort []string // list of columns for sort order +} + +// NewCatCountService creates a new CatCountService. +func NewCatCountService(client *Client) *CatCountService { + return &CatCountService{ + client: client, + } +} + +// Index specifies zero or more indices for which to return counts +// (by default counts for all indices are returned). +func (s *CatCountService) Index(index ...string) *CatCountService { + s.index = index + return s +} + +// Local indicates to return local information, i.e. do not retrieve +// the state from master node (default: false). +func (s *CatCountService) Local(local bool) *CatCountService { + s.local = &local + return s +} + +// MasterTimeout is the explicit operation timeout for connection to master node. +func (s *CatCountService) MasterTimeout(masterTimeout string) *CatCountService { + s.masterTimeout = masterTimeout + return s +} + +// Columns to return in the response. +// To get a list of all possible columns to return, run the following command +// in your terminal: +// +// Example: +// curl 'http://localhost:9200/_cat/count?help' +// +// You can use Columns("*") to return all possible columns. That might take +// a little longer than the default set of columns. +func (s *CatCountService) Columns(columns ...string) *CatCountService { + s.columns = columns + return s +} + +// Sort is a list of fields to sort by. +func (s *CatCountService) Sort(fields ...string) *CatCountService { + s.sort = fields + return s +} + +// Pretty indicates that the JSON response be indented and human readable. +func (s *CatCountService) Pretty(pretty bool) *CatCountService { + s.pretty = pretty + return s +} + +// buildURL builds the URL for the operation. +func (s *CatCountService) buildURL() (string, url.Values, error) { + // Build URL + var ( + path string + err error + ) + + if len(s.index) > 0 { + path, err = uritemplates.Expand("/_cat/count/{index}", map[string]string{ + "index": strings.Join(s.index, ","), + }) + } else { + path = "/_cat/count" + } + if err != nil { + return "", url.Values{}, err + } + + // Add query string parameters + params := url.Values{ + "format": []string{"json"}, // always returns as JSON + } + if s.pretty { + params.Set("pretty", "true") + } + if v := s.local; v != nil { + params.Set("local", fmt.Sprint(*v)) + } + if s.masterTimeout != "" { + params.Set("master_timeout", s.masterTimeout) + } + if len(s.sort) > 0 { + params.Set("s", strings.Join(s.sort, ",")) + } + return path, params, nil +} + +// Do executes the operation. +func (s *CatCountService) Do(ctx context.Context) (CatCountResponse, error) { + // Get URL for request + path, params, err := s.buildURL() + if err != nil { + return nil, err + } + + // Get HTTP response + res, err := s.client.PerformRequest(ctx, PerformRequestOptions{ + Method: "GET", + Path: path, + Params: params, + }) + if err != nil { + return nil, err + } + + // Return operation response + var ret CatCountResponse + if err := s.client.decoder.Decode(res.Body, &ret); err != nil { + return nil, err + } + return ret, nil +} + +// -- Result of a get request. + +// CatCountResponse is the outcome of CatCountService.Do. +type CatCountResponse []CatCountResponseRow + +// CatCountResponseRow specifies the data returned for one index +// of a CatCountResponse. Notice that not all of these fields might +// be filled; that depends on the number of columns chose in the +// request (see CatCountService.Columns). +type CatCountResponseRow struct { + Epoch int64 `json:"epoch,string"` // e.g. 1527077996 + Timestamp string `json:"timestamp"` // e.g. "12:19:56" + Count int `json:"count,string"` // number of documents +} diff --git a/vendor/github.com/olivere/elastic/cat_count_test.go b/vendor/github.com/olivere/elastic/cat_count_test.go new file mode 100644 index 00000000..38c75990 --- /dev/null +++ b/vendor/github.com/olivere/elastic/cat_count_test.go @@ -0,0 +1,28 @@ +// Copyright 2012-present Oliver Eilhard. All rights reserved. +// Use of this source code is governed by a MIT-license. +// See http://olivere.mit-license.org/license.txt for details. + +package elastic + +import ( + "context" + "testing" +) + +func TestCatCount(t *testing.T) { + client := setupTestClientAndCreateIndexAndAddDocs(t) // , SetTraceLog(log.New(os.Stdout, "", 0))) + ctx := context.Background() + res, err := client.CatCount().Pretty(true).Do(ctx) + if err != nil { + t.Fatal(err) + } + if res == nil { + t.Fatal("want response, have nil") + } + if len(res) == 0 { + t.Fatalf("want response, have: %v", res) + } + if have := res[0].Count; have <= 0 { + t.Fatalf("Count[0]: want > %d, have %d", 0, have) + } +} diff --git a/vendor/github.com/olivere/elastic/cat_health.go b/vendor/github.com/olivere/elastic/cat_health.go new file mode 100644 index 00000000..55dd79bd --- /dev/null +++ b/vendor/github.com/olivere/elastic/cat_health.go @@ -0,0 +1,157 @@ +// Copyright 2012-present Oliver Eilhard. All rights reserved. +// Use of this source code is governed by a MIT-license. +// See http://olivere.mit-license.org/license.txt for details. + +package elastic + +import ( + "context" + "fmt" + "net/url" + "strings" +) + +// CatHealthService returns a terse representation of the same information +// as /_cluster/health. +// +// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/cat-health.html +// for details. +type CatHealthService struct { + client *Client + pretty bool + local *bool + masterTimeout string + columns []string + sort []string // list of columns for sort order + disableTimestamping *bool +} + +// NewCatHealthService creates a new CatHealthService. +func NewCatHealthService(client *Client) *CatHealthService { + return &CatHealthService{ + client: client, + } +} + +// Local indicates to return local information, i.e. do not retrieve +// the state from master node (default: false). +func (s *CatHealthService) Local(local bool) *CatHealthService { + s.local = &local + return s +} + +// MasterTimeout is the explicit operation timeout for connection to master node. +func (s *CatHealthService) MasterTimeout(masterTimeout string) *CatHealthService { + s.masterTimeout = masterTimeout + return s +} + +// Columns to return in the response. +// To get a list of all possible columns to return, run the following command +// in your terminal: +// +// Example: +// curl 'http://localhost:9200/_cat/indices?help' +// +// You can use Columns("*") to return all possible columns. That might take +// a little longer than the default set of columns. +func (s *CatHealthService) Columns(columns ...string) *CatHealthService { + s.columns = columns + return s +} + +// Sort is a list of fields to sort by. +func (s *CatHealthService) Sort(fields ...string) *CatHealthService { + s.sort = fields + return s +} + +// DisableTimestamping disables timestamping (default: true). +func (s *CatHealthService) DisableTimestamping(disable bool) *CatHealthService { + s.disableTimestamping = &disable + return s +} + +// Pretty indicates that the JSON response be indented and human readable. +func (s *CatHealthService) Pretty(pretty bool) *CatHealthService { + s.pretty = pretty + return s +} + +// buildURL builds the URL for the operation. +func (s *CatHealthService) buildURL() (string, url.Values, error) { + // Build URL + path := "/_cat/health" + + // Add query string parameters + params := url.Values{ + "format": []string{"json"}, // always returns as JSON + } + if s.pretty { + params.Set("pretty", "true") + } + if v := s.local; v != nil { + params.Set("local", fmt.Sprint(*v)) + } + if s.masterTimeout != "" { + params.Set("master_timeout", s.masterTimeout) + } + if len(s.sort) > 0 { + params.Set("s", strings.Join(s.sort, ",")) + } + if v := s.disableTimestamping; v != nil { + params.Set("ts", fmt.Sprint(*v)) + } + return path, params, nil +} + +// Do executes the operation. +func (s *CatHealthService) Do(ctx context.Context) (CatHealthResponse, error) { + // Get URL for request + path, params, err := s.buildURL() + if err != nil { + return nil, err + } + + // Get HTTP response + res, err := s.client.PerformRequest(ctx, PerformRequestOptions{ + Method: "GET", + Path: path, + Params: params, + }) + if err != nil { + return nil, err + } + + // Return operation response + var ret CatHealthResponse + if err := s.client.decoder.Decode(res.Body, &ret); err != nil { + return nil, err + } + return ret, nil +} + +// -- Result of a get request. + +// CatHealthResponse is the outcome of CatHealthService.Do. +type CatHealthResponse []CatHealthResponseRow + +// CatHealthResponseRow is a single row in a CatHealthResponse. +// Notice that not all of these fields might be filled; that depends +// on the number of columns chose in the request (see CatHealthService.Columns). +type CatHealthResponseRow struct { + Epoch int64 `json:"epoch,string"` // e.g. 1527077996 + Timestamp string `json:"timestamp"` // e.g. "12:19:56" + Cluster string `json:"cluster"` // cluster name, e.g. "elasticsearch" + Status string `json:"status"` // health status, e.g. "green", "yellow", or "red" + NodeTotal int `json:"node.total,string"` // total number of nodes + NodeData int `json:"node.data,string"` // number of nodes that can store data + Shards int `json:"shards,string"` // total number of shards + Pri int `json:"pri,string"` // number of primary shards + Relo int `json:"relo,string"` // number of relocating nodes + Init int `json:"init,string"` // number of initializing nodes + Unassign int `json:"unassign,string"` // number of unassigned shards + PendingTasks int `json:"pending_tasks,string"` // number of pending tasks + MaxTaskWaitTime string `json:"max_task_wait_time"` // wait time of longest task pending, e.g. "-" or time in millis + ActiveShardsPercent string `json:"active_shards_percent"` // active number of shards in percent, e.g. "100%" +} diff --git a/vendor/github.com/olivere/elastic/cat_health_test.go b/vendor/github.com/olivere/elastic/cat_health_test.go new file mode 100644 index 00000000..6eacb846 --- /dev/null +++ b/vendor/github.com/olivere/elastic/cat_health_test.go @@ -0,0 +1,28 @@ +// Copyright 2012-present Oliver Eilhard. All rights reserved. +// Use of this source code is governed by a MIT-license. +// See http://olivere.mit-license.org/license.txt for details. + +package elastic + +import ( + "context" + "testing" +) + +func TestCatHealth(t *testing.T) { + client := setupTestClientAndCreateIndexAndAddDocs(t) // , SetTraceLog(log.New(os.Stdout, "", 0))) + ctx := context.Background() + res, err := client.CatHealth().Do(ctx) + if err != nil { + t.Fatal(err) + } + if res == nil { + t.Fatal("want response, have nil") + } + if len(res) == 0 { + t.Fatalf("want response, have: %v", res) + } + if have := res[0].Cluster; have == "" { + t.Fatalf("Cluster[0]: want != %q, have %q", "", have) + } +} diff --git a/vendor/github.com/olivere/elastic/cat_indices.go b/vendor/github.com/olivere/elastic/cat_indices.go new file mode 100644 index 00000000..70eb08a2 --- /dev/null +++ b/vendor/github.com/olivere/elastic/cat_indices.go @@ -0,0 +1,315 @@ +// Copyright 2012-present Oliver Eilhard. All rights reserved. +// Use of this source code is governed by a MIT-license. +// See http://olivere.mit-license.org/license.txt for details. + +package elastic + +import ( + "context" + "fmt" + "net/url" + "strings" + + "github.com/olivere/elastic/uritemplates" +) + +// CatIndicesService returns the list of indices plus some additional +// information about them. +// +// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/cat-indices.html +// for details. +type CatIndicesService struct { + client *Client + pretty bool + index string + bytes string // b, k, m, or g + local *bool + masterTimeout string + columns []string + health string // green, yellow, or red + primaryOnly *bool // true for primary shards only + sort []string // list of columns for sort order +} + +// NewCatIndicesService creates a new CatIndicesService. +func NewCatIndicesService(client *Client) *CatIndicesService { + return &CatIndicesService{ + client: client, + } +} + +// Index is the name of the index to list (by default all indices are returned). +func (s *CatIndicesService) Index(index string) *CatIndicesService { + s.index = index + return s +} + +// Bytes represents the unit in which to display byte values. +// Valid values are: "b", "k", "m", or "g". +func (s *CatIndicesService) Bytes(bytes string) *CatIndicesService { + s.bytes = bytes + return s +} + +// Local indicates to return local information, i.e. do not retrieve +// the state from master node (default: false). +func (s *CatIndicesService) Local(local bool) *CatIndicesService { + s.local = &local + return s +} + +// MasterTimeout is the explicit operation timeout for connection to master node. +func (s *CatIndicesService) MasterTimeout(masterTimeout string) *CatIndicesService { + s.masterTimeout = masterTimeout + return s +} + +// Columns to return in the response. +// To get a list of all possible columns to return, run the following command +// in your terminal: +// +// Example: +// curl 'http://localhost:9200/_cat/indices?help' +// +// You can use Columns("*") to return all possible columns. That might take +// a little longer than the default set of columns. +func (s *CatIndicesService) Columns(columns ...string) *CatIndicesService { + s.columns = columns + return s +} + +// Health filters indices by their health status. +// Valid values are: "green", "yellow", or "red". +func (s *CatIndicesService) Health(healthState string) *CatIndicesService { + s.health = healthState + return s +} + +// PrimaryOnly when set to true returns stats only for primary shards (default: false). +func (s *CatIndicesService) PrimaryOnly(primaryOnly bool) *CatIndicesService { + s.primaryOnly = &primaryOnly + return s +} + +// Sort is a list of fields to sort by. +func (s *CatIndicesService) Sort(fields ...string) *CatIndicesService { + s.sort = fields + return s +} + +// Pretty indicates that the JSON response be indented and human readable. +func (s *CatIndicesService) Pretty(pretty bool) *CatIndicesService { + s.pretty = pretty + return s +} + +// buildURL builds the URL for the operation. +func (s *CatIndicesService) buildURL() (string, url.Values, error) { + // Build URL + var ( + path string + err error + ) + + if s.index != "" { + path, err = uritemplates.Expand("/_cat/indices/{index}", map[string]string{ + "index": s.index, + }) + } else { + path = "/_cat/indices" + } + if err != nil { + return "", url.Values{}, err + } + + // Add query string parameters + params := url.Values{ + "format": []string{"json"}, // always returns as JSON + } + if s.pretty { + params.Set("pretty", "true") + } + if s.bytes != "" { + params.Set("bytes", s.bytes) + } + if v := s.local; v != nil { + params.Set("local", fmt.Sprint(*v)) + } + if s.masterTimeout != "" { + params.Set("master_timeout", s.masterTimeout) + } + if s.health != "" { + params.Set("health", s.health) + } + if v := s.primaryOnly; v != nil { + params.Set("pri", fmt.Sprint(*v)) + } + if len(s.sort) > 0 { + params.Set("s", strings.Join(s.sort, ",")) + } + return path, params, nil +} + +// Do executes the operation. +func (s *CatIndicesService) Do(ctx context.Context) (CatIndicesResponse, error) { + // Get URL for request + path, params, err := s.buildURL() + if err != nil { + return nil, err + } + + // Get HTTP response + res, err := s.client.PerformRequest(ctx, PerformRequestOptions{ + Method: "GET", + Path: path, + Params: params, + }) + if err != nil { + return nil, err + } + + // Return operation response + var ret CatIndicesResponse + if err := s.client.decoder.Decode(res.Body, &ret); err != nil { + return nil, err + } + return ret, nil +} + +// -- Result of a get request. + +// CatIndicesResponse is the outcome of CatIndicesService.Do. +type CatIndicesResponse []CatIndicesResponseRow + +// CatIndicesResponseRow specifies the data returned for one index +// of a CatIndicesResponse. Notice that not all of these fields might +// be filled; that depends on the number of columns chose in the +// request (see CatIndicesService.Columns). +type CatIndicesResponseRow struct { + Health string `json:"health"` // "green", "yellow", or "red" + Status string `json:"status"` // "open" or "closed" + Index string `json:"index"` // index name + UUID string `json:"uuid"` // index uuid + Pri int `json:"pri,string"` // number of primary shards + Rep int `json:"rep,string"` // number of replica shards + DocsCount int `json:"docs.count,string"` // number of available documents + DocsDeleted int `json:"docs.deleted,string"` // number of deleted documents + CreationDate int64 `json:"creation.date,string"` // index creation date (millisecond value), e.g. 1527077221644 + CreationDateString string `json:"creation.date.string"` // index creation date (as string), e.g. "2018-05-23T12:07:01.644Z" + StoreSize string `json:"store.size"` // store size of primaries & replicas, e.g. "4.6kb" + PriStoreSize string `json:"pri.store.size"` // store size of primaries, e.g. "230b" + CompletionSize string `json:"completion.size"` // size of completion on primaries & replicas + PriCompletionSize string `json:"pri.completion.size"` // size of completion on primaries + FielddataMemorySize string `json:"fielddata.memory_size"` // used fielddata cache on primaries & replicas + PriFielddataMemorySize string `json:"pri.fielddata.memory_size"` // used fielddata cache on primaries + FielddataEvictions int `json:"fielddata.evictions,string"` // fielddata evictions on primaries & replicas + PriFielddataEvictions int `json:"pri.fielddata.evictions,string"` // fielddata evictions on primaries + QueryCacheMemorySize string `json:"query_cache.memory_size"` // used query cache on primaries & replicas + PriQueryCacheMemorySize string `json:"pri.query_cache.memory_size"` // used query cache on primaries + QueryCacheEvictions int `json:"query_cache.evictions,string"` // query cache evictions on primaries & replicas + PriQueryCacheEvictions int `json:"pri.query_cache.evictions,string"` // query cache evictions on primaries + RequestCacheMemorySize string `json:"request_cache.memory_size"` // used request cache on primaries & replicas + PriRequestCacheMemorySize string `json:"pri.request_cache.memory_size"` // used request cache on primaries + RequestCacheEvictions int `json:"request_cache.evictions,string"` // request cache evictions on primaries & replicas + PriRequestCacheEvictions int `json:"pri.request_cache.evictions,string"` // request cache evictions on primaries + RequestCacheHitCount int `json:"request_cache.hit_count,string"` // request cache hit count on primaries & replicas + PriRequestCacheHitCount int `json:"pri.request_cache.hit_count,string"` // request cache hit count on primaries + RequestCacheMissCount int `json:"request_cache.miss_count,string"` // request cache miss count on primaries & replicas + PriRequestCacheMissCount int `json:"pri.request_cache.miss_count,string"` // request cache miss count on primaries + FlushTotal int `json:"flush.total"` // number of flushes on primaries & replicas + PriFlushTotal int `json:"pri.flush.total"` // number of flushes on primaries + FlushTotalTime string `json:"flush.total_time"` // time spent in flush on primaries & replicas + PriFlushTotalTime string `json:"pri.flush.total_time"` // time spent in flush on primaries + GetCurrent int `json:"get.current,string"` // number of current get ops on primaries & replicas + PriGetCurrent int `json:"pri.get.current,string"` // number of current get ops on primaries + GetTime string `json:"get.time"` // time spent in get on primaries & replicas + PriGetTime string `json:"pri.get.time"` // time spent in get on primaries + GetTotal int `json:"get.total,string"` // number of get ops on primaries & replicas + PriGetTotal int `json:"pri.get.total,string"` // number of get ops on primaries + GetExistsTime string `json:"get.exists_time"` // time spent in successful gets on primaries & replicas + PriGetExistsTime string `json:"pri.get.exists_time"` // time spent in successful gets on primaries + GetExistsTotal int `json:"get.exists_total,string"` // number of successful gets on primaries & replicas + PriGetExistsTotal int `json:"pri.get.exists_total,string"` // number of successful gets on primaries + GetMissingTime string `json:"get.missing_time"` // time spent in failed gets on primaries & replicas + PriGetMissingTime string `json:"pri.get.missing_time"` // time spent in failed gets on primaries + GetMissingTotal int `json:"get.missing_total,string"` // number of failed gets on primaries & replicas + PriGetMissingTotal int `json:"pri.get.missing_total,string"` // number of failed gets on primaries + IndexingDeleteCurrent int `json:"indexing.delete_current,string"` // number of current deletions on primaries & replicas + PriIndexingDeleteCurrent int `json:"pri.indexing.delete_current,string"` // number of current deletions on primaries + IndexingDeleteTime string `json:"indexing.delete_time"` // time spent in deletions on primaries & replicas + PriIndexingDeleteTime string `json:"pri.indexing.delete_time"` // time spent in deletions on primaries + IndexingDeleteTotal int `json:"indexing.delete_total,string"` // number of delete ops on primaries & replicas + PriIndexingDeleteTotal int `json:"pri.indexing.delete_total,string"` // number of delete ops on primaries + IndexingIndexCurrent int `json:"indexing.index_current,string"` // number of current indexing on primaries & replicas + PriIndexingIndexCurrent int `json:"pri.indexing.index_current,string"` // number of current indexing on primaries + IndexingIndexTime string `json:"indexing.index_time"` // time spent in indexing on primaries & replicas + PriIndexingIndexTime string `json:"pri.indexing.index_time"` // time spent in indexing on primaries + IndexingIndexTotal int `json:"indexing.index_total,string"` // number of index ops on primaries & replicas + PriIndexingIndexTotal int `json:"pri.indexing.index_total,string"` // number of index ops on primaries + IndexingIndexFailed int `json:"indexing.index_failed,string"` // number of failed indexing ops on primaries & replicas + PriIndexingIndexFailed int `json:"pri.indexing.index_failed,string"` // number of failed indexing ops on primaries + MergesCurrent int `json:"merges.current,string"` // number of current merges on primaries & replicas + PriMergesCurrent int `json:"pri.merges.current,string"` // number of current merges on primaries + MergesCurrentDocs int `json:"merges.current_docs,string"` // number of current merging docs on primaries & replicas + PriMergesCurrentDocs int `json:"pri.merges.current_docs,string"` // number of current merging docs on primaries + MergesCurrentSize string `json:"merges.current_size"` // size of current merges on primaries & replicas + PriMergesCurrentSize string `json:"pri.merges.current_size"` // size of current merges on primaries + MergesTotal int `json:"merges.total,string"` // number of completed merge ops on primaries & replicas + PriMergesTotal int `json:"pri.merges.total,string"` // number of completed merge ops on primaries + MergesTotalDocs int `json:"merges.total_docs,string"` // docs merged on primaries & replicas + PriMergesTotalDocs int `json:"pri.merges.total_docs,string"` // docs merged on primaries + MergesTotalSize string `json:"merges.total_size"` // size merged on primaries & replicas + PriMergesTotalSize string `json:"pri.merges.total_size"` // size merged on primaries + MergesTotalTime string `json:"merges.total_time"` // time spent in merges on primaries & replicas + PriMergesTotalTime string `json:"pri.merges.total_time"` // time spent in merges on primaries + RefreshTotal int `json:"refresh.total,string"` // total refreshes on primaries & replicas + PriRefreshTotal int `json:"pri.refresh.total,string"` // total refreshes on primaries + RefreshTime string `json:"refresh.time"` // time spent in refreshes on primaries & replicas + PriRefreshTime string `json:"pri.refresh.time"` // time spent in refreshes on primaries + RefreshListeners int `json:"refresh.listeners,string"` // number of pending refresh listeners on primaries & replicas + PriRefreshListeners int `json:"pri.refresh.listeners,string"` // number of pending refresh listeners on primaries + SearchFetchCurrent int `json:"search.fetch_current,string"` // current fetch phase ops on primaries & replicas + PriSearchFetchCurrent int `json:"pri.search.fetch_current,string"` // current fetch phase ops on primaries + SearchFetchTime string `json:"search.fetch_time"` // time spent in fetch phase on primaries & replicas + PriSearchFetchTime string `json:"pri.search.fetch_time"` // time spent in fetch phase on primaries + SearchFetchTotal int `json:"search.fetch_total,string"` // total fetch ops on primaries & replicas + PriSearchFetchTotal int `json:"pri.search.fetch_total,string"` // total fetch ops on primaries + SearchOpenContexts int `json:"search.open_contexts,string"` // open search contexts on primaries & replicas + PriSearchOpenContexts int `json:"pri.search.open_contexts,string"` // open search contexts on primaries + SearchQueryCurrent int `json:"search.query_current,string"` // current query phase ops on primaries & replicas + PriSearchQueryCurrent int `json:"pri.search.query_current,string"` // current query phase ops on primaries + SearchQueryTime string `json:"search.query_time"` // time spent in query phase on primaries & replicas, e.g. "0s" + PriSearchQueryTime string `json:"pri.search.query_time"` // time spent in query phase on primaries, e.g. "0s" + SearchQueryTotal int `json:"search.query_total,string"` // total query phase ops on primaries & replicas + PriSearchQueryTotal int `json:"pri.search.query_total,string"` // total query phase ops on primaries + SearchScrollCurrent int `json:"search.scroll_current,string"` // open scroll contexts on primaries & replicas + PriSearchScrollCurrent int `json:"pri.search.scroll_current,string"` // open scroll contexts on primaries + SearchScrollTime string `json:"search.scroll_time"` // time scroll contexts held open on primaries & replicas, e.g. "0s" + PriSearchScrollTime string `json:"pri.search.scroll_time"` // time scroll contexts held open on primaries, e.g. "0s" + SearchScrollTotal int `json:"search.scroll_total,string"` // completed scroll contexts on primaries & replicas + PriSearchScrollTotal int `json:"pri.search.scroll_total,string"` // completed scroll contexts on primaries + SegmentsCount int `json:"segments.count,string"` // number of segments on primaries & replicas + PriSegmentsCount int `json:"pri.segments.count,string"` // number of segments on primaries + SegmentsMemory string `json:"segments.memory"` // memory used by segments on primaries & replicas, e.g. "1.3kb" + PriSegmentsMemory string `json:"pri.segments.memory"` // memory used by segments on primaries, e.g. "1.3kb" + SegmentsIndexWriterMemory string `json:"segments.index_writer_memory"` // memory used by index writer on primaries & replicas, e.g. "0b" + PriSegmentsIndexWriterMemory string `json:"pri.segments.index_writer_memory"` // memory used by index writer on primaries, e.g. "0b" + SegmentsVersionMapMemory string `json:"segments.version_map_memory"` // memory used by version map on primaries & replicas, e.g. "0b" + PriSegmentsVersionMapMemory string `json:"pri.segments.version_map_memory"` // memory used by version map on primaries, e.g. "0b" + SegmentsFixedBitsetMemory string `json:"segments.fixed_bitset_memory"` // memory used by fixed bit sets for nested object field types and type filters for types referred in _parent fields on primaries & replicas, e.g. "0b" + PriSegmentsFixedBitsetMemory string `json:"pri.segments.fixed_bitset_memory"` // memory used by fixed bit sets for nested object field types and type filters for types referred in _parent fields on primaries, e.g. "0b" + WarmerCurrent int `json:"warmer.count,string"` // current warmer ops on primaries & replicas + PriWarmerCurrent int `json:"pri.warmer.count,string"` // current warmer ops on primaries + WarmerTotal int `json:"warmer.total,string"` // total warmer ops on primaries & replicas + PriWarmerTotal int `json:"pri.warmer.total,string"` // total warmer ops on primaries + WarmerTotalTime string `json:"warmer.total_time"` // time spent in warmers on primaries & replicas, e.g. "47s" + PriWarmerTotalTime string `json:"pri.warmer.total_time"` // time spent in warmers on primaries, e.g. "47s" + SuggestCurrent int `json:"suggest.current,string"` // number of current suggest ops on primaries & replicas + PriSuggestCurrent int `json:"pri.suggest.current,string"` // number of current suggest ops on primaries + SuggestTime string `json:"suggest.time"` // time spend in suggest on primaries & replicas, "31s" + PriSuggestTime string `json:"pri.suggest.time"` // time spend in suggest on primaries, e.g. "31s" + SuggestTotal int `json:"suggest.total,string"` // number of suggest ops on primaries & replicas + PriSuggestTotal int `json:"pri.suggest.total,string"` // number of suggest ops on primaries + MemoryTotal string `json:"memory.total"` // total user memory on primaries & replicas, e.g. "1.5kb" + PriMemoryTotal string `json:"pri.memory.total"` // total user memory on primaries, e.g. "1.5kb" +} diff --git a/vendor/github.com/olivere/elastic/cat_indices_test.go b/vendor/github.com/olivere/elastic/cat_indices_test.go new file mode 100644 index 00000000..492251a4 --- /dev/null +++ b/vendor/github.com/olivere/elastic/cat_indices_test.go @@ -0,0 +1,28 @@ +// Copyright 2012-present Oliver Eilhard. All rights reserved. +// Use of this source code is governed by a MIT-license. +// See http://olivere.mit-license.org/license.txt for details. + +package elastic + +import ( + "context" + "testing" +) + +func TestCatIndices(t *testing.T) { + client := setupTestClientAndCreateIndexAndAddDocs(t) // , SetTraceLog(log.New(os.Stdout, "", 0))) + ctx := context.Background() + res, err := client.CatIndices().Do(ctx) + if err != nil { + t.Fatal(err) + } + if res == nil { + t.Fatal("want response, have nil") + } + if len(res) == 0 { + t.Fatalf("want response, have: %v", res) + } + if have := res[0].Index; have == "" { + t.Fatalf("Index[0]: want != %q, have %q", "", have) + } +} diff --git a/vendor/github.com/olivere/elastic/client.go b/vendor/github.com/olivere/elastic/client.go index 3b0a79a4..f6c8ce5d 100644 --- a/vendor/github.com/olivere/elastic/client.go +++ b/vendor/github.com/olivere/elastic/client.go @@ -26,7 +26,7 @@ import ( const ( // Version is the current version of Elastic. - Version = "6.1.21" + Version = "6.1.22" // DefaultURL is the default endpoint of Elasticsearch on the local machine. // It is used e.g. when initializing a new Client without a specific URL. @@ -1618,12 +1618,7 @@ func (c *Client) GetFieldMapping() *IndicesGetFieldMappingService { // -- cat APIs -- -// TODO cat aliases -// TODO cat allocation -// TODO cat count // TODO cat fielddata -// TODO cat health -// TODO cat indices // TODO cat master // TODO cat nodes // TODO cat pending tasks @@ -1633,6 +1628,31 @@ func (c *Client) GetFieldMapping() *IndicesGetFieldMappingService { // TODO cat shards // TODO cat segments +// CatAliases returns information about aliases. +func (c *Client) CatAliases() *CatAliasesService { + return NewCatAliasesService(c) +} + +// CatAllocation returns information about the allocation across nodes. +func (c *Client) CatAllocation() *CatAllocationService { + return NewCatAllocationService(c) +} + +// CatCount returns document counts for indices. +func (c *Client) CatCount() *CatCountService { + return NewCatCountService(c) +} + +// CatHealth returns information about cluster health. +func (c *Client) CatHealth() *CatHealthService { + return NewCatHealthService(c) +} + +// CatIndices returns information about indices. +func (c *Client) CatIndices() *CatIndicesService { + return NewCatIndicesService(c) +} + // -- Ingest APIs -- // IngestPutPipeline adds pipelines and updates existing pipelines in @@ -1737,6 +1757,24 @@ func (c *Client) SnapshotVerifyRepository(repository string) *SnapshotVerifyRepo return NewSnapshotVerifyRepositoryService(c).Repository(repository) } +// -- Scripting APIs -- + +// GetScript reads a stored script in Elasticsearch. +// Use PutScript for storing a script. +func (c *Client) GetScript() *GetScriptService { + return NewGetScriptService(c) +} + +// PutScript allows saving a stored script in Elasticsearch. +func (c *Client) PutScript() *PutScriptService { + return NewPutScriptService(c) +} + +// DeleteScript allows removing a stored script from Elasticsearch. +func (c *Client) DeleteScript() *DeleteScriptService { + return NewDeleteScriptService(c) +} + // -- Helpers and shortcuts -- // ElasticsearchVersion returns the version number of Elasticsearch diff --git a/vendor/github.com/olivere/elastic/script.go b/vendor/github.com/olivere/elastic/script.go index 615c41df..192c3c3f 100644 --- a/vendor/github.com/olivere/elastic/script.go +++ b/vendor/github.com/olivere/elastic/script.go @@ -18,7 +18,8 @@ type Script struct { params map[string]interface{} } -// NewScript creates and initializes a new Script. +// NewScript creates and initializes a new Script. By default, it is of +// type "inline". Use NewScriptStored for a stored script (where type is "id"). func NewScript(script string) *Script { return &Script{ script: script, @@ -89,10 +90,7 @@ func (s *Script) Source() (interface{}, error) { } else { source["id"] = s.script } - if s.lang == "null" || s.lang == "nil" { - // HACK(oe) Hotfix for https://github.com/elastic/elasticsearch/issues/28002; remove when 6.3 and/or 7.x are out. - source["lang"] = nil - } else if s.lang != "" { + if s.lang != "" { source["lang"] = s.lang } if len(s.params) > 0 { diff --git a/vendor/github.com/olivere/elastic/script_delete.go b/vendor/github.com/olivere/elastic/script_delete.go new file mode 100644 index 00000000..f71b31d5 --- /dev/null +++ b/vendor/github.com/olivere/elastic/script_delete.go @@ -0,0 +1,134 @@ +// Copyright 2012-present Oliver Eilhard. All rights reserved. +// Use of this source code is governed by a MIT-license. +// See http://olivere.mit-license.org/license.txt for details. + +package elastic + +import ( + "context" + "fmt" + "net/url" + + "github.com/olivere/elastic/uritemplates" +) + +// DeleteScriptService removes a stored script in Elasticsearch. +// +// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/modules-scripting.html +// for details. +type DeleteScriptService struct { + client *Client + pretty bool + id string + timeout string + masterTimeout string +} + +// NewDeleteScriptService creates a new DeleteScriptService. +func NewDeleteScriptService(client *Client) *DeleteScriptService { + return &DeleteScriptService{ + client: client, + } +} + +// Id is the script ID. +func (s *DeleteScriptService) Id(id string) *DeleteScriptService { + s.id = id + return s +} + +// Timeout is an explicit operation timeout. +func (s *DeleteScriptService) Timeout(timeout string) *DeleteScriptService { + s.timeout = timeout + return s +} + +// MasterTimeout is the timeout for connecting to master. +func (s *DeleteScriptService) MasterTimeout(masterTimeout string) *DeleteScriptService { + s.masterTimeout = masterTimeout + return s +} + +// Pretty indicates that the JSON response be indented and human readable. +func (s *DeleteScriptService) Pretty(pretty bool) *DeleteScriptService { + s.pretty = pretty + return s +} + +// buildURL builds the URL for the operation. +func (s *DeleteScriptService) buildURL() (string, string, url.Values, error) { + var ( + err error + method = "DELETE" + path string + ) + + path, err = uritemplates.Expand("/_scripts/{id}", map[string]string{ + "id": s.id, + }) + if err != nil { + return "", "", url.Values{}, err + } + + // Add query string parameters + params := url.Values{} + if s.pretty { + params.Set("pretty", "true") + } + if s.timeout != "" { + params.Set("timeout", s.timeout) + } + if s.masterTimeout != "" { + params.Set("master_timestamp", s.masterTimeout) + } + return method, path, params, nil +} + +// Validate checks if the operation is valid. +func (s *DeleteScriptService) Validate() error { + var invalid []string + if s.id == "" { + invalid = append(invalid, "Id") + } + if len(invalid) > 0 { + return fmt.Errorf("missing required fields: %v", invalid) + } + return nil +} + +// Do executes the operation. +func (s *DeleteScriptService) Do(ctx context.Context) (*DeleteScriptResponse, error) { + // Check pre-conditions + if err := s.Validate(); err != nil { + return nil, err + } + + // Get URL for request + method, path, params, err := s.buildURL() + if err != nil { + return nil, err + } + + // Get HTTP response + res, err := s.client.PerformRequest(ctx, PerformRequestOptions{ + Method: method, + Path: path, + Params: params, + }) + if err != nil { + return nil, err + } + + // Return operation response + ret := new(DeleteScriptResponse) + if err := s.client.decoder.Decode(res.Body, ret); err != nil { + return nil, err + } + return ret, nil +} + +// DeleteScriptResponse is the result of deleting a stored script +// in Elasticsearch. +type DeleteScriptResponse struct { + AcknowledgedResponse +} diff --git a/vendor/github.com/olivere/elastic/script_delete_test.go b/vendor/github.com/olivere/elastic/script_delete_test.go new file mode 100644 index 00000000..88e12bb4 --- /dev/null +++ b/vendor/github.com/olivere/elastic/script_delete_test.go @@ -0,0 +1,84 @@ +// Copyright 2012-present Oliver Eilhard. All rights reserved. +// Use of this source code is governed by a MIT-license. +// See http://olivere.mit-license.org/license.txt for details. + +package elastic + +import ( + "context" + "testing" +) + +func TestDeleteScript(t *testing.T) { + client := setupTestClientAndCreateIndex(t) + + scriptID := "example-delete-script-id" + + // Ensure the script does not exist + _, err := client.PerformRequest( + context.Background(), + PerformRequestOptions{ + Method: "DELETE", + Path: "/_scripts/" + scriptID, + }) + if err != nil && !IsNotFound(err) { + t.Fatal(err) + } + + // PutScript API + script := `{ + "script": { + "lang": "painless", + "source": "ctx._source.message = params.new_message" + } + }` + putRes, err := client.PutScript(). + Id(scriptID). + BodyString(script). + Do(context.Background()) + if err != nil { + t.Fatal(err) + } + if putRes == nil { + t.Errorf("expected result to be != nil; got: %v", putRes) + } + if !putRes.Acknowledged { + t.Errorf("expected ack for PutScript op; got %v", putRes.Acknowledged) + } + + // Must exist now + _, err = client.PerformRequest( + context.Background(), + PerformRequestOptions{ + Method: "GET", + Path: "/_scripts/" + scriptID, + }) + if err != nil { + t.Fatal(err) + } + + // DeleteScript API + res, err := client.DeleteScript(). + Id(scriptID). + Do(context.Background()) + if err != nil { + t.Fatal(err) + } + if res == nil { + t.Errorf("expected result to be != nil; got: %v", res) + } + if !res.Acknowledged { + t.Errorf("expected ack for DeleteScript op; got %v", res.Acknowledged) + } + + // Must not exist now + _, err = client.PerformRequest( + context.Background(), + PerformRequestOptions{ + Method: "DELETE", + Path: "/_scripts/" + scriptID, + }) + if err != nil && !IsNotFound(err) { + t.Fatal(err) + } +} diff --git a/vendor/github.com/olivere/elastic/script_get.go b/vendor/github.com/olivere/elastic/script_get.go new file mode 100644 index 00000000..313d5398 --- /dev/null +++ b/vendor/github.com/olivere/elastic/script_get.go @@ -0,0 +1,117 @@ +// Copyright 2012-present Oliver Eilhard. All rights reserved. +// Use of this source code is governed by a MIT-license. +// See http://olivere.mit-license.org/license.txt for details. + +package elastic + +import ( + "context" + "encoding/json" + "fmt" + "net/url" + + "github.com/olivere/elastic/uritemplates" +) + +// GetScriptService reads a stored script in Elasticsearch. +// +// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/modules-scripting.html +// for details. +type GetScriptService struct { + client *Client + pretty bool + id string +} + +// NewGetScriptService creates a new GetScriptService. +func NewGetScriptService(client *Client) *GetScriptService { + return &GetScriptService{ + client: client, + } +} + +// Id is the script ID. +func (s *GetScriptService) Id(id string) *GetScriptService { + s.id = id + return s +} + +// Pretty indicates that the JSON response be indented and human readable. +func (s *GetScriptService) Pretty(pretty bool) *GetScriptService { + s.pretty = pretty + return s +} + +// buildURL builds the URL for the operation. +func (s *GetScriptService) buildURL() (string, string, url.Values, error) { + var ( + err error + method = "GET" + path string + ) + + path, err = uritemplates.Expand("/_scripts/{id}", map[string]string{ + "id": s.id, + }) + if err != nil { + return "", "", url.Values{}, err + } + + // Add query string parameters + params := url.Values{} + if s.pretty { + params.Set("pretty", "true") + } + return method, path, params, nil +} + +// Validate checks if the operation is valid. +func (s *GetScriptService) Validate() error { + var invalid []string + if s.id == "" { + invalid = append(invalid, "Id") + } + if len(invalid) > 0 { + return fmt.Errorf("missing required fields: %v", invalid) + } + return nil +} + +// Do executes the operation. +func (s *GetScriptService) Do(ctx context.Context) (*GetScriptResponse, error) { + // Check pre-conditions + if err := s.Validate(); err != nil { + return nil, err + } + + // Get URL for request + method, path, params, err := s.buildURL() + if err != nil { + return nil, err + } + + // Get HTTP response + res, err := s.client.PerformRequest(ctx, PerformRequestOptions{ + Method: method, + Path: path, + Params: params, + }) + if err != nil { + return nil, err + } + + // Return operation response + ret := new(GetScriptResponse) + if err := s.client.decoder.Decode(res.Body, ret); err != nil { + return nil, err + } + return ret, nil +} + +// GetScriptResponse is the result of deleting a stored script +// in Elasticsearch. +type GetScriptResponse struct { + Id string `json:"_id"` + Found bool `json:"found"` + Script json.RawMessage `json:"script"` +} diff --git a/vendor/github.com/olivere/elastic/script_get_test.go b/vendor/github.com/olivere/elastic/script_get_test.go new file mode 100644 index 00000000..478e816d --- /dev/null +++ b/vendor/github.com/olivere/elastic/script_get_test.go @@ -0,0 +1,91 @@ +// Copyright 2012-present Oliver Eilhard. All rights reserved. +// Use of this source code is governed by a MIT-license. +// See http://olivere.mit-license.org/license.txt for details. + +package elastic + +import ( + "context" + "testing" +) + +func TestGetScript(t *testing.T) { + client := setupTestClientAndCreateIndex(t) + + scriptID := "example-get-script-id" + + // Ensure the script does not exist + _, err := client.PerformRequest( + context.Background(), + PerformRequestOptions{ + Method: "DELETE", + Path: "/_scripts/" + scriptID, + }) + if err != nil && !IsNotFound(err) { + t.Fatal(err) + } + + // PutScript API + script := `{ + "script": { + "lang": "painless", + "source": "ctx._source.message = params.new_message" + } + }` + putRes, err := client.PutScript(). + Id(scriptID). + BodyString(script). + Do(context.Background()) + if err != nil { + t.Fatal(err) + } + if putRes == nil { + t.Errorf("expected result to be != nil; got: %v", putRes) + } + if !putRes.Acknowledged { + t.Errorf("expected ack for PutScript op; got %v", putRes.Acknowledged) + } + + // Must exist now + _, err = client.PerformRequest( + context.Background(), + PerformRequestOptions{ + Method: "GET", + Path: "/_scripts/" + scriptID, + }) + if err != nil { + t.Fatal(err) + } + + // GetScript API + res, err := client.GetScript(). + Id(scriptID). + Do(context.Background()) + if err != nil { + t.Fatal(err) + } + if res == nil { + t.Errorf("expected result to be != nil; got: %v", res) + } + if want, have := scriptID, res.Id; want != have { + t.Fatalf("expected _id = %q; got: %q", want, have) + } + if want, have := true, res.Found; want != have { + t.Fatalf("expected found = %v; got: %v", want, have) + } + if res.Script == nil { + t.Fatal("expected script; got: nil") + } + outScript := `{"lang":"painless","source":"ctx._source.message = params.new_message"}` + if want, have := outScript, string(res.Script); want != have { + t.Fatalf("expected script = %q; got: %q", want, have) + } + + // Cleanup + client.PerformRequest( + context.Background(), + PerformRequestOptions{ + Method: "DELETE", + Path: "/_scripts/" + scriptID, + }) +} diff --git a/vendor/github.com/olivere/elastic/script_put.go b/vendor/github.com/olivere/elastic/script_put.go new file mode 100644 index 00000000..c7310f5f --- /dev/null +++ b/vendor/github.com/olivere/elastic/script_put.go @@ -0,0 +1,174 @@ +// Copyright 2012-present Oliver Eilhard. All rights reserved. +// Use of this source code is governed by a MIT-license. +// See http://olivere.mit-license.org/license.txt for details. + +package elastic + +import ( + "context" + "fmt" + "net/url" + + "github.com/olivere/elastic/uritemplates" +) + +// PutScriptService adds or updates a stored script in Elasticsearch. +// +// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/modules-scripting.html +// for details. +type PutScriptService struct { + client *Client + pretty bool + id string + context string + timeout string + masterTimeout string + bodyJson interface{} + bodyString string +} + +// NewPutScriptService creates a new PutScriptService. +func NewPutScriptService(client *Client) *PutScriptService { + return &PutScriptService{ + client: client, + } +} + +// Id is the script ID. +func (s *PutScriptService) Id(id string) *PutScriptService { + s.id = id + return s +} + +// Context specifies the script context (optional). +func (s *PutScriptService) Context(context string) *PutScriptService { + s.context = context + return s +} + +// Timeout is an explicit operation timeout. +func (s *PutScriptService) Timeout(timeout string) *PutScriptService { + s.timeout = timeout + return s +} + +// MasterTimeout is the timeout for connecting to master. +func (s *PutScriptService) MasterTimeout(masterTimeout string) *PutScriptService { + s.masterTimeout = masterTimeout + return s +} + +// Pretty indicates that the JSON response be indented and human readable. +func (s *PutScriptService) Pretty(pretty bool) *PutScriptService { + s.pretty = pretty + return s +} + +// BodyJson is the document as a serializable JSON interface. +func (s *PutScriptService) BodyJson(body interface{}) *PutScriptService { + s.bodyJson = body + return s +} + +// BodyString is the document encoded as a string. +func (s *PutScriptService) BodyString(body string) *PutScriptService { + s.bodyString = body + return s +} + +// buildURL builds the URL for the operation. +func (s *PutScriptService) buildURL() (string, string, url.Values, error) { + var ( + err error + method = "PUT" + path string + ) + + if s.context != "" { + path, err = uritemplates.Expand("/_scripts/{id}/{context}", map[string]string{ + "id": s.id, + "context": s.context, + }) + } else { + path, err = uritemplates.Expand("/_scripts/{id}", map[string]string{ + "id": s.id, + }) + } + if err != nil { + return "", "", url.Values{}, err + } + + // Add query string parameters + params := url.Values{} + if s.pretty { + params.Set("pretty", "true") + } + if s.timeout != "" { + params.Set("timeout", s.timeout) + } + if s.masterTimeout != "" { + params.Set("master_timestamp", s.masterTimeout) + } + return method, path, params, nil +} + +// Validate checks if the operation is valid. +func (s *PutScriptService) Validate() error { + var invalid []string + if s.id == "" { + invalid = append(invalid, "Id") + } + if s.bodyString == "" && s.bodyJson == nil { + invalid = append(invalid, "BodyJson") + } + if len(invalid) > 0 { + return fmt.Errorf("missing required fields: %v", invalid) + } + return nil +} + +// Do executes the operation. +func (s *PutScriptService) Do(ctx context.Context) (*PutScriptResponse, error) { + // Check pre-conditions + if err := s.Validate(); err != nil { + return nil, err + } + + // Get URL for request + method, path, params, err := s.buildURL() + if err != nil { + return nil, err + } + + // Setup HTTP request body + var body interface{} + if s.bodyJson != nil { + body = s.bodyJson + } else { + body = s.bodyString + } + + // Get HTTP response + res, err := s.client.PerformRequest(ctx, PerformRequestOptions{ + Method: method, + Path: path, + Params: params, + Body: body, + }) + if err != nil { + return nil, err + } + + // Return operation response + ret := new(PutScriptResponse) + if err := s.client.decoder.Decode(res.Body, ret); err != nil { + return nil, err + } + return ret, nil +} + +// PutScriptResponse is the result of saving a stored script +// in Elasticsearch. +type PutScriptResponse struct { + AcknowledgedResponse +} diff --git a/vendor/github.com/olivere/elastic/script_put_test.go b/vendor/github.com/olivere/elastic/script_put_test.go new file mode 100644 index 00000000..051046e3 --- /dev/null +++ b/vendor/github.com/olivere/elastic/script_put_test.go @@ -0,0 +1,66 @@ +// Copyright 2012-present Oliver Eilhard. All rights reserved. +// Use of this source code is governed by a MIT-license. +// See http://olivere.mit-license.org/license.txt for details. + +package elastic + +import ( + "context" + "testing" +) + +func TestPutScript(t *testing.T) { + client := setupTestClientAndCreateIndex(t) + + scriptID := "example-put-script-id" + + // Ensure the script does not exist + _, err := client.PerformRequest( + context.Background(), + PerformRequestOptions{ + Method: "DELETE", + Path: "/_scripts/" + scriptID, + }) + if err != nil && !IsNotFound(err) { + t.Fatal(err) + } + + // PutScript API + script := `{ + "script": { + "lang": "painless", + "source": "ctx._source.message = params.new_message" + } + }` + res, err := client.PutScript(). + Id(scriptID). + BodyString(script). + Do(context.Background()) + if err != nil { + t.Fatal(err) + } + if res == nil { + t.Errorf("expected result to be != nil; got: %v", res) + } + if !res.Acknowledged { + t.Errorf("expected ack for PutScript op; got %v", res.Acknowledged) + } + + // Must exist now + _, err = client.PerformRequest( + context.Background(), + PerformRequestOptions{ + Method: "GET", + Path: "/_scripts/" + scriptID, + }) + if err != nil { + t.Fatal(err) + } + // Cleanup + client.PerformRequest( + context.Background(), + PerformRequestOptions{ + Method: "DELETE", + Path: "/_scripts/" + scriptID, + }) +} diff --git a/vendor/github.com/olivere/elastic/script_test.go b/vendor/github.com/olivere/elastic/script_test.go index 2126d27e..aa475d7e 100644 --- a/vendor/github.com/olivere/elastic/script_test.go +++ b/vendor/github.com/olivere/elastic/script_test.go @@ -59,23 +59,3 @@ func TestScriptingStored(t *testing.T) { t.Errorf("expected\n%s\n,got:\n%s", expected, got) } } - -// TestScriptingBug28002 is a workaround for -// https://github.com/elastic/elasticsearch/issues/28002 -// in that it allows to use a Script with ID but a language of "null". -func TestScriptingBug28002(t *testing.T) { - builder := NewScriptStored("script-with-id").Lang("null").Param("factor", 2.0) - src, err := builder.Source() - if err != nil { - t.Fatal(err) - } - data, err := json.Marshal(src) - if err != nil { - t.Fatalf("marshaling to JSON failed: %v", err) - } - got := string(data) - expected := `{"id":"script-with-id","lang":null,"params":{"factor":2}}` - if got != expected { - t.Errorf("expected\n%s\n,got:\n%s", expected, got) - } -} diff --git a/vendor/github.com/olivere/elastic/update_integration_test.go b/vendor/github.com/olivere/elastic/update_integration_test.go index f3692529..22b9d09e 100644 --- a/vendor/github.com/olivere/elastic/update_integration_test.go +++ b/vendor/github.com/olivere/elastic/update_integration_test.go @@ -56,3 +56,69 @@ func TestUpdateWithScript(t *testing.T) { t.Fatalf("want Message = %q, have %v", want, have) } } + +func TestUpdateWithScriptID(t *testing.T) { + client := setupTestClientAndCreateIndexAndAddDocs(t) //, SetTraceLog(log.New(os.Stdout, "", 0))) + + // Get original + getRes, err := client.Get().Index(testIndexName).Type("doc").Id("1").Do(context.TODO()) + if err != nil { + t.Fatal(err) + } + var original tweet + if err := json.Unmarshal(*getRes.Source, &original); err != nil { + t.Fatal(err) + } + + // Set script with ID + scriptID := "example-script-id" + _, err = client.DeleteScript().Id(scriptID).Do(context.Background()) + if err != nil && !IsNotFound(err) { + t.Fatal(err) + } + _, err = client.PutScript(). + Id(scriptID). + BodyString(`{ + "script": { + "lang": "painless", + "source": "ctx._source.message = params.new_message" + } + }`). + Do(context.Background()) + if err != nil { + t.Fatal(err) + } + + // Update with script + updRes, err := client.Update().Index(testIndexName).Type("doc").Id("1"). + Script( + NewScriptStored(scriptID).Param("new_message", "Updated message text."), + ). + Do(context.TODO()) + if err != nil { + t.Fatal(err) + } + if updRes == nil { + t.Fatal("response is nil") + } + if want, have := "updated", updRes.Result; want != have { + t.Fatalf("want Result = %q, have %v", want, have) + } + + // Get new version + getRes, err = client.Get().Index(testIndexName).Type("doc").Id("1").Do(context.TODO()) + if err != nil { + t.Fatal(err) + } + var updated tweet + if err := json.Unmarshal(*getRes.Source, &updated); err != nil { + t.Fatal(err) + } + + if want, have := original.User, updated.User; want != have { + t.Fatalf("want User = %q, have %v", want, have) + } + if want, have := "Updated message text.", updated.Message; want != have { + t.Fatalf("want Message = %q, have %v", want, have) + } +} diff --git a/vendor/github.com/sirupsen/logrus/README.md b/vendor/github.com/sirupsen/logrus/README.md index 7f862542..072e99be 100644 --- a/vendor/github.com/sirupsen/logrus/README.md +++ b/vendor/github.com/sirupsen/logrus/README.md @@ -241,62 +241,8 @@ func init() { ``` Note: Syslog hook also support connecting to local syslog (Ex. "/dev/log" or "/var/run/syslog" or "/var/run/log"). For the detail, please check the [syslog hook README](hooks/syslog/README.md). -| Hook | Description | -| ----- | ----------- | -| [Airbrake "legacy"](https://github.com/gemnasium/logrus-airbrake-legacy-hook) | Send errors to an exception tracking service compatible with the Airbrake API V2. Uses [`airbrake-go`](https://github.com/tobi/airbrake-go) behind the scenes. | -| [Airbrake](https://github.com/gemnasium/logrus-airbrake-hook) | Send errors to the Airbrake API V3. Uses the official [`gobrake`](https://github.com/airbrake/gobrake) behind the scenes. | -| [Amazon Kinesis](https://github.com/evalphobia/logrus_kinesis) | Hook for logging to [Amazon Kinesis](https://aws.amazon.com/kinesis/) | -| [Amqp-Hook](https://github.com/vladoatanasov/logrus_amqp) | Hook for logging to Amqp broker (Like RabbitMQ) | -| [Anexia CloudLog](https://github.com/anexia-it/go-logrus-cloudlog) | Hook for logging to Anexia CloudLog | -| [Application Insights](https://github.com/jjcollinge/logrus-appinsights) | Hook for logging to [Application Insights](https://azure.microsoft.com/en-us/services/application-insights/) -| [AzureTableHook](https://github.com/kpfaulkner/azuretablehook/) | Hook for logging to Azure Table Storage| -| [Bugsnag](https://github.com/Shopify/logrus-bugsnag/blob/master/bugsnag.go) | Send errors to the Bugsnag exception tracking service. | -| [ClickHouse](https://github.com/oxgrouby/logrus-clickhouse-hook) | Send logs to [ClickHouse](https://clickhouse.yandex/) | -| [DeferPanic](https://github.com/deferpanic/dp-logrus) | Hook for logging to DeferPanic | -| [Discordrus](https://github.com/kz/discordrus) | Hook for logging to [Discord](https://discordapp.com/) | -| [ElasticSearch](https://github.com/sohlich/elogrus) | Hook for logging to ElasticSearch| -| [Firehose](https://github.com/beaubrewer/logrus_firehose) | Hook for logging to [Amazon Firehose](https://aws.amazon.com/kinesis/firehose/) -| [Fluentd](https://github.com/evalphobia/logrus_fluent) | Hook for logging to fluentd | -| [Go-Slack](https://github.com/multiplay/go-slack) | Hook for logging to [Slack](https://slack.com) | -| [Graylog](https://github.com/gemnasium/logrus-graylog-hook) | Hook for logging to [Graylog](http://graylog2.org/) | -| [Hiprus](https://github.com/nubo/hiprus) | Send errors to a channel in hipchat. | -| [Honeybadger](https://github.com/agonzalezro/logrus_honeybadger) | Hook for sending exceptions to Honeybadger | -| [InfluxDB](https://github.com/Abramovic/logrus_influxdb) | Hook for logging to influxdb | -| [Influxus](http://github.com/vlad-doru/influxus) | Hook for concurrently logging to [InfluxDB](http://influxdata.com/) | -| [Journalhook](https://github.com/wercker/journalhook) | Hook for logging to `systemd-journald` | -| [KafkaLogrus](https://github.com/tracer0tong/kafkalogrus) | Hook for logging to Kafka | -| [Kafka REST Proxy](https://github.com/Nordstrom/logrus-kafka-rest-proxy) | Hook for logging to [Kafka REST Proxy](https://docs.confluent.io/current/kafka-rest/docs) | -| [LFShook](https://github.com/rifflock/lfshook) | Hook for logging to the local filesystem | -| [Logbeat](https://github.com/macandmia/logbeat) | Hook for logging to [Opbeat](https://opbeat.com/) | -| [Logentries](https://github.com/jcftang/logentriesrus) | Hook for logging to [Logentries](https://logentries.com/) | -| [Logentrus](https://github.com/puddingfactory/logentrus) | Hook for logging to [Logentries](https://logentries.com/) | -| [Logmatic.io](https://github.com/logmatic/logmatic-go) | Hook for logging to [Logmatic.io](http://logmatic.io/) | -| [Logrusly](https://github.com/sebest/logrusly) | Send logs to [Loggly](https://www.loggly.com/) | -| [Logstash](https://github.com/bshuster-repo/logrus-logstash-hook) | Hook for logging to [Logstash](https://www.elastic.co/products/logstash) | -| [Mail](https://github.com/zbindenren/logrus_mail) | Hook for sending exceptions via mail | -| [Mattermost](https://github.com/shuLhan/mattermost-integration/tree/master/hooks/logrus) | Hook for logging to [Mattermost](https://mattermost.com/) | -| [Mongodb](https://github.com/weekface/mgorus) | Hook for logging to mongodb | -| [MySQL](https://github.com/LyricTian/logrus-mysql-hook) | Hook for logging to mysql | -| [NATS-Hook](https://github.com/rybit/nats_logrus_hook) | Hook for logging to [NATS](https://nats.io) | -| [Octokit](https://github.com/dorajistyle/logrus-octokit-hook) | Hook for logging to github via octokit | -| [Papertrail](https://github.com/polds/logrus-papertrail-hook) | Send errors to the [Papertrail](https://papertrailapp.com) hosted logging service via UDP. | -| [PostgreSQL](https://github.com/gemnasium/logrus-postgresql-hook) | Send logs to [PostgreSQL](http://postgresql.org) | -| [Promrus](https://github.com/weaveworks/promrus) | Expose number of log messages as [Prometheus](https://prometheus.io/) metrics | -| [Pushover](https://github.com/toorop/logrus_pushover) | Send error via [Pushover](https://pushover.net) | -| [Raygun](https://github.com/squirkle/logrus-raygun-hook) | Hook for logging to [Raygun.io](http://raygun.io/) | -| [Redis-Hook](https://github.com/rogierlommers/logrus-redis-hook) | Hook for logging to a ELK stack (through Redis) | -| [Rollrus](https://github.com/heroku/rollrus) | Hook for sending errors to rollbar | -| [Scribe](https://github.com/sagar8192/logrus-scribe-hook) | Hook for logging to [Scribe](https://github.com/facebookarchive/scribe)| -| [Sentry](https://github.com/evalphobia/logrus_sentry) | Send errors to the Sentry error logging and aggregation service. | -| [Slackrus](https://github.com/johntdyer/slackrus) | Hook for Slack chat. | -| [Stackdriver](https://github.com/knq/sdhook) | Hook for logging to [Google Stackdriver](https://cloud.google.com/logging/) | -| [Sumorus](https://github.com/doublefree/sumorus) | Hook for logging to [SumoLogic](https://www.sumologic.com/)| -| [Syslog](https://github.com/sirupsen/logrus/blob/master/hooks/syslog/syslog.go) | Send errors to remote syslog server. Uses standard library `log/syslog` behind the scenes. | -| [Syslog TLS](https://github.com/shinji62/logrus-syslog-ng) | Send errors to remote syslog server with TLS support. | -| [Telegram](https://github.com/rossmcdonald/telegram_hook) | Hook for logging errors to [Telegram](https://telegram.org/) | -| [TraceView](https://github.com/evalphobia/logrus_appneta) | Hook for logging to [AppNeta TraceView](https://www.appneta.com/products/traceview/) | -| [Typetalk](https://github.com/dragon3/logrus-typetalk-hook) | Hook for logging to [Typetalk](https://www.typetalk.in/) | -| [SQS-Hook](https://github.com/tsarpaul/logrus_sqs) | Hook for logging to [Amazon Simple Queue Service (SQS)](https://aws.amazon.com/sqs/) | +A list of currently known of service hook can be found in this wiki [page](https://github.com/sirupsen/logrus/wiki/Hooks) + #### Level logging diff --git a/vendor/golang.org/x/crypto/acme/autocert/autocert.go b/vendor/golang.org/x/crypto/acme/autocert/autocert.go index 263b2913..97281d84 100644 --- a/vendor/golang.org/x/crypto/acme/autocert/autocert.go +++ b/vendor/golang.org/x/crypto/acme/autocert/autocert.go @@ -542,6 +542,20 @@ func (m *Manager) authorizedCert(ctx context.Context, key crypto.Signer, domain return der, leaf, nil } +// revokePending revokes all provided authorizations (passed as a map of URIs) +func (m *Manager) revokePending(ctx context.Context, pendingAuthzURIs map[string]bool) { + f := func(ctx context.Context) { + for uri := range pendingAuthzURIs { + m.Client.RevokeAuthorization(ctx, uri) + } + } + if waitForRevocations { + f(ctx) + } else { + go f(context.Background()) + } +} + // verify runs the identifier (domain) authorization flow // using each applicable ACME challenge type. func (m *Manager) verify(ctx context.Context, client *acme.Client, domain string) error { @@ -554,6 +568,10 @@ func (m *Manager) verify(ctx context.Context, client *acme.Client, domain string } m.tokensMu.RUnlock() + // we keep track of pending authzs and revoke the ones that did not validate. + pendingAuthzs := make(map[string]bool) + defer m.revokePending(ctx, pendingAuthzs) + var nextTyp int // challengeType index of the next challenge type to try for { // Start domain authorization and get the challenge. @@ -570,6 +588,8 @@ func (m *Manager) verify(ctx context.Context, client *acme.Client, domain string return fmt.Errorf("acme/autocert: invalid authorization %q", authz.URI) } + pendingAuthzs[authz.URI] = true + // Pick the next preferred challenge. var chal *acme.Challenge for chal == nil && nextTyp < len(challengeTypes) { @@ -590,6 +610,7 @@ func (m *Manager) verify(ctx context.Context, client *acme.Client, domain string // A challenge is fulfilled and accepted: wait for the CA to validate. if _, err := client.WaitAuthorization(ctx, authz.URI); err == nil { + delete(pendingAuthzs, authz.URI) return nil } } @@ -959,4 +980,7 @@ var ( // Called when a state is removed. testDidRemoveState = func(domain string) {} + + // make testing of revokePending synchronous + waitForRevocations = false ) diff --git a/vendor/golang.org/x/crypto/acme/autocert/autocert_test.go b/vendor/golang.org/x/crypto/acme/autocert/autocert_test.go index 2da1912e..54d38e23 100644 --- a/vendor/golang.org/x/crypto/acme/autocert/autocert_test.go +++ b/vendor/golang.org/x/crypto/acme/autocert/autocert_test.go @@ -19,10 +19,12 @@ import ( "fmt" "html/template" "io" + "io/ioutil" "math/big" "net/http" "net/http/httptest" "reflect" + "strconv" "strings" "sync" "testing" @@ -529,6 +531,103 @@ func TestVerifyHTTP01(t *testing.T) { } } +func TestRevokeFailedAuth(t *testing.T) { + var ( + authzCount int // num. of created authorizations + revoked [3]bool // there will be three different authorization attempts; see below + ) + + // make cleanup revocations synchronous + waitForRevocations = true + + // ACME CA server stub, only the needed bits. + // TODO: Merge this with startACMEServerStub, making it a configurable CA for testing. + var ca *httptest.Server + ca = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Replay-Nonce", "nonce") + if r.Method == "HEAD" { + // a nonce request + return + } + + switch r.URL.Path { + // Discovery. + case "/": + if err := discoTmpl.Execute(w, ca.URL); err != nil { + t.Errorf("discoTmpl: %v", err) + } + // Client key registration. + case "/new-reg": + w.Write([]byte("{}")) + // New domain authorization. + case "/new-authz": + w.Header().Set("Location", fmt.Sprintf("%s/authz/%d", ca.URL, authzCount)) + w.WriteHeader(http.StatusCreated) + if err := authzTmpl.Execute(w, ca.URL); err != nil { + t.Errorf("authzTmpl: %v", err) + } + authzCount++ + // force error on Accept() + case "/challenge/2": + http.Error(w, "won't accept tls-sni-02 challenge", http.StatusBadRequest) + // accept; authorization will be expired (404; see /authz/1 below) + case "/challenge/1": + w.Write([]byte("{}")) + // Authorization statuses. + case "/authz/0", "/authz/1", "/authz/2": + if r.Method == "POST" { + body, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Errorf("could not read request body") + } + if reflect.DeepEqual(body, []byte(`{"status": "deactivated"}`)) { + t.Errorf("unexpected POST to authz: '%s'", body) + } + i, err := strconv.ParseInt(r.URL.Path[len(r.URL.Path)-1:], 10, 64) + if err != nil { + t.Errorf("could not convert authz ID to int") + } + revoked[i] = true + w.Write([]byte(`{"status": "invalid"}`)) + } else { + switch r.URL.Path { + case "/authz/0": + // ensure we get a spurious validation if error forcing did not work (see above) + w.Write([]byte(`{"status": "valid"}`)) + case "/authz/1": + // force error during WaitAuthorization() + w.WriteHeader(http.StatusNotFound) + } + } + default: + http.NotFound(w, r) + t.Errorf("unrecognized r.URL.Path: %s", r.URL.Path) + } + })) + defer ca.Close() + + key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatal(err) + } + m := &Manager{ + Client: &acme.Client{ + Key: key, + DirectoryURL: ca.URL, + }, + } + + // should fail and revoke tsl-sni-02, tls-sni-01 and the third time after not finding any remaining challenges + if err := m.verify(context.Background(), m.Client, "example.org"); err == nil { + t.Errorf("m.verify should have failed!") + } + for i := range revoked { + if !revoked[i] { + t.Errorf("authorization attempt %d not revoked after error", i) + } + } +} + func TestHTTPHandlerDefaultFallback(t *testing.T) { tt := []struct { method, url string diff --git a/vendor/golang.org/x/crypto/openpgp/keys.go b/vendor/golang.org/x/crypto/openpgp/keys.go index fd582a89..aceb1b79 100644 --- a/vendor/golang.org/x/crypto/openpgp/keys.go +++ b/vendor/golang.org/x/crypto/openpgp/keys.go @@ -500,6 +500,10 @@ func NewEntity(name, comment, email string, config *packet.Config) (*Entity, err IssuerKeyId: &e.PrimaryKey.KeyId, }, } + err = e.Identities[uid.Id].SelfSignature.SignUserId(uid.Id, e.PrimaryKey, e.PrivateKey, config) + if err != nil { + return nil, err + } // If the user passes in a DefaultHash via packet.Config, // set the PreferredHash for the SelfSignature. @@ -529,14 +533,17 @@ func NewEntity(name, comment, email string, config *packet.Config) (*Entity, err } e.Subkeys[0].PublicKey.IsSubkey = true e.Subkeys[0].PrivateKey.IsSubkey = true - + err = e.Subkeys[0].Sig.SignKey(e.Subkeys[0].PublicKey, e.PrivateKey, config) + if err != nil { + return nil, err + } return e, nil } // SerializePrivate serializes an Entity, including private key material, to // the given Writer. For now, it must only be used on an Entity returned from // NewEntity. -// If config is nil, sensible defaults will be used. +// config is ignored func (e *Entity) SerializePrivate(w io.Writer, config *packet.Config) (err error) { err = e.PrivateKey.Serialize(w) if err != nil { @@ -547,10 +554,6 @@ func (e *Entity) SerializePrivate(w io.Writer, config *packet.Config) (err error if err != nil { return } - err = ident.SelfSignature.SignUserId(ident.UserId.Id, e.PrimaryKey, e.PrivateKey, config) - if err != nil { - return - } err = ident.SelfSignature.Serialize(w) if err != nil { return @@ -561,10 +564,6 @@ func (e *Entity) SerializePrivate(w io.Writer, config *packet.Config) (err error if err != nil { return } - err = subkey.Sig.SignKey(subkey.PublicKey, e.PrivateKey, config) - if err != nil { - return - } err = subkey.Sig.Serialize(w) if err != nil { return diff --git a/vendor/golang.org/x/crypto/openpgp/keys_test.go b/vendor/golang.org/x/crypto/openpgp/keys_test.go index 3a155063..fd1f6620 100644 --- a/vendor/golang.org/x/crypto/openpgp/keys_test.go +++ b/vendor/golang.org/x/crypto/openpgp/keys_test.go @@ -370,6 +370,20 @@ func TestNewEntityWithoutPreferredSymmetric(t *testing.T) { } } +func TestNewEntityPublicSerialization(t *testing.T) { + entity, err := NewEntity("Golang Gopher", "Test Key", "no-reply@golang.com", nil) + if err != nil { + t.Fatal(err) + } + serializedEntity := bytes.NewBuffer(nil) + entity.Serialize(serializedEntity) + + _, err = ReadEntity(packet.NewReader(bytes.NewBuffer(serializedEntity.Bytes()))) + if err != nil { + t.Fatal(err) + } +} + const expiringKeyHex = "988d0451d1ec5d010400ba3385721f2dc3f4ab096b2ee867ab77213f0a27a8538441c35d2fa225b08798a1439a66a5150e6bdc3f40f5d28d588c712394c632b6299f77db8c0d48d37903fb72ebd794d61be6aa774688839e5fdecfe06b2684cc115d240c98c66cb1ef22ae84e3aa0c2b0c28665c1e7d4d044e7f270706193f5223c8d44e0d70b7b8da830011010001b40f4578706972792074657374206b657988be041301020028050251d1ec5d021b03050900278d00060b090807030206150802090a0b0416020301021e01021780000a091072589ad75e237d8c033503fd10506d72837834eb7f994117740723adc39227104b0d326a1161871c0b415d25b4aedef946ca77ea4c05af9c22b32cf98be86ab890111fced1ee3f75e87b7cc3c00dc63bbc85dfab91c0dc2ad9de2c4d13a34659333a85c6acc1a669c5e1d6cecb0cf1e56c10e72d855ae177ddc9e766f9b2dda57ccbb75f57156438bbdb4e42b88d0451d1ec5d0104009c64906559866c5cb61578f5846a94fcee142a489c9b41e67b12bb54cfe86eb9bc8566460f9a720cb00d6526fbccfd4f552071a8e3f7744b1882d01036d811ee5a3fb91a1c568055758f43ba5d2c6a9676b012f3a1a89e47bbf624f1ad571b208f3cc6224eb378f1645dd3d47584463f9eadeacfd1ce6f813064fbfdcc4b5a53001101000188a504180102000f021b0c050251d1f06b050900093e89000a091072589ad75e237d8c20e00400ab8310a41461425b37889c4da28129b5fae6084fafbc0a47dd1adc74a264c6e9c9cc125f40462ee1433072a58384daef88c961c390ed06426a81b464a53194c4e291ddd7e2e2ba3efced01537d713bd111f48437bde2363446200995e8e0d4e528dda377fd1e8f8ede9c8e2198b393bd86852ce7457a7e3daf74d510461a5b77b88d0451d1ece8010400b3a519f83ab0010307e83bca895170acce8964a044190a2b368892f7a244758d9fc193482648acb1fb9780d28cc22d171931f38bb40279389fc9bf2110876d4f3db4fcfb13f22f7083877fe56592b3b65251312c36f83ffcb6d313c6a17f197dd471f0712aad15a8537b435a92471ba2e5b0c72a6c72536c3b567c558d7b6051001101000188a504180102000f021b0c050251d1f07b050900279091000a091072589ad75e237d8ce69e03fe286026afacf7c97ee20673864d4459a2240b5655219950643c7dba0ac384b1d4359c67805b21d98211f7b09c2a0ccf6410c8c04d4ff4a51293725d8d6570d9d8bb0e10c07d22357caeb49626df99c180be02d77d1fe8ed25e7a54481237646083a9f89a11566cd20b9e995b1487c5f9e02aeb434f3a1897cd416dd0a87861838da3e9e" const subkeyUsageHex = "988d04533a52bc010400d26af43085558f65b9e7dbc90cb9238015259aed5e954637adcfa2181548b2d0b60c65f1f42ec5081cbf1bc0a8aa4900acfb77070837c58f26012fbce297d70afe96e759ad63531f0037538e70dbf8e384569b9720d99d8eb39d8d0a2947233ed242436cb6ac7dfe74123354b3d0119b5c235d3dd9c9d6c004f8ffaf67ad8583001101000188b7041f010200210502533b8552170c8001ce094aa433f7040bb2ddf0be3893cb843d0fe70c020700000a0910a42704b92866382aa98404009d63d916a27543da4221c60087c33f1c44bec9998c5438018ed370cca4962876c748e94b73eb39c58eb698063f3fd6346d58dd2a11c0247934c4a9d71f24754f7468f96fb24c3e791dd2392b62f626148ad724189498cbf993db2df7c0cdc2d677c35da0f16cb16c9ce7c33b4de65a4a91b1d21a130ae9cc26067718910ef8e2b417556d627261203c756d627261407379642e65642e61753e88b80413010200220502533a52bc021b03060b090807030206150802090a0b0416020301021e01021780000a0910a42704b92866382a47840400c0c2bd04f5fca586de408b395b3c280a278259c93eaaa8b79a53b97003f8ed502a8a00446dd9947fb462677e4fcac0dac2f0701847d15130aadb6cd9e0705ea0cf5f92f129136c7be21a718d46c8e641eb7f044f2adae573e11ae423a0a9ca51324f03a8a2f34b91fa40c3cc764bee4dccadedb54c768ba0469b683ea53f1c29b88d04533a52bc01040099c92a5d6f8b744224da27bc2369127c35269b58bec179de6bbc038f749344222f85a31933224f26b70243c4e4b2d242f0c4777eaef7b5502f9dad6d8bf3aaeb471210674b74de2d7078af497d55f5cdad97c7bedfbc1b41e8065a97c9c3d344b21fc81d27723af8e374bc595da26ea242dccb6ae497be26eea57e563ed517e90011010001889f0418010200090502533a52bc021b0c000a0910a42704b92866382afa1403ff70284c2de8a043ff51d8d29772602fa98009b7861c540535f874f2c230af8caf5638151a636b21f8255003997ccd29747fdd06777bb24f9593bd7d98a3e887689bf902f999915fcc94625ae487e5d13e6616f89090ebc4fdc7eb5cad8943e4056995bb61c6af37f8043016876a958ec7ebf39c43d20d53b7f546cfa83e8d2604b88d04533b8283010400c0b529316dbdf58b4c54461e7e669dc11c09eb7f73819f178ccd4177b9182b91d138605fcf1e463262fabefa73f94a52b5e15d1904635541c7ea540f07050ce0fb51b73e6f88644cec86e91107c957a114f69554548a85295d2b70bd0b203992f76eb5d493d86d9eabcaa7ef3fc7db7e458438db3fcdb0ca1cc97c638439a9170011010001889f0418010200090502533b8283021b0c000a0910a42704b92866382adc6d0400cfff6258485a21675adb7a811c3e19ebca18851533f75a7ba317950b9997fda8d1a4c8c76505c08c04b6c2cc31dc704d33da36a21273f2b388a1a706f7c3378b66d887197a525936ed9a69acb57fe7f718133da85ec742001c5d1864e9c6c8ea1b94f1c3759cebfd93b18606066c063a63be86085b7e37bdbc65f9a915bf084bb901a204533b85cd110400aed3d2c52af2b38b5b67904b0ef73d6dd7aef86adb770e2b153cd22489654dcc91730892087bb9856ae2d9f7ed1eb48f214243fe86bfe87b349ebd7c30e630e49c07b21fdabf78b7a95c8b7f969e97e3d33f2e074c63552ba64a2ded7badc05ce0ea2be6d53485f6900c7860c7aa76560376ce963d7271b9b54638a4028b573f00a0d8854bfcdb04986141568046202192263b9b67350400aaa1049dbc7943141ef590a70dcb028d730371d92ea4863de715f7f0f16d168bd3dc266c2450457d46dcbbf0b071547e5fbee7700a820c3750b236335d8d5848adb3c0da010e998908dfd93d961480084f3aea20b247034f8988eccb5546efaa35a92d0451df3aaf1aee5aa36a4c4d462c760ecd9cebcabfbe1412b1f21450f203fd126687cd486496e971a87fd9e1a8a765fe654baa219a6871ab97768596ab05c26c1aeea8f1a2c72395a58dbc12ef9640d2b95784e974a4d2d5a9b17c25fedacfe551bda52602de8f6d2e48443f5dd1a2a2a8e6a5e70ecdb88cd6e766ad9745c7ee91d78cc55c3d06536b49c3fee6c3d0b6ff0fb2bf13a314f57c953b8f4d93bf88e70418010200090502533b85cd021b0200520910a42704b92866382a47200419110200060502533b85cd000a091042ce2c64bc0ba99214b2009e26b26852c8b13b10c35768e40e78fbbb48bd084100a0c79d9ea0844fa5853dd3c85ff3ecae6f2c9dd6c557aa04008bbbc964cd65b9b8299d4ebf31f41cc7264b8cf33a00e82c5af022331fac79efc9563a822497ba012953cefe2629f1242fcdcb911dbb2315985bab060bfd58261ace3c654bdbbe2e8ed27a46e836490145c86dc7bae15c011f7e1ffc33730109b9338cd9f483e7cef3d2f396aab5bd80efb6646d7e778270ee99d934d187dd98" const revokedKeyHex = "988d045331ce82010400c4fdf7b40a5477f206e6ee278eaef888ca73bf9128a9eef9f2f1ddb8b7b71a4c07cfa241f028a04edb405e4d916c61d6beabc333813dc7b484d2b3c52ee233c6a79b1eea4e9cc51596ba9cd5ac5aeb9df62d86ea051055b79d03f8a4fa9f38386f5bd17529138f3325d46801514ea9047977e0829ed728e68636802796801be10011010001889f04200102000905025331d0e3021d03000a0910a401d9f09a34f7c042aa040086631196405b7e6af71026b88e98012eab44aa9849f6ef3fa930c7c9f23deaedba9db1538830f8652fb7648ec3fcade8dbcbf9eaf428e83c6cbcc272201bfe2fbb90d41963397a7c0637a1a9d9448ce695d9790db2dc95433ad7be19eb3de72dacf1d6db82c3644c13eae2a3d072b99bb341debba012c5ce4006a7d34a1f4b94b444526567205265766f6b657220283c52656727732022424d204261726973746122204b657920262530305c303e5c29203c72656740626d626172697374612e636f2e61753e88b704130102002205025331ce82021b03060b090807030206150802090a0b0416020301021e01021780000a0910a401d9f09a34f7c0019c03f75edfbeb6a73e7225ad3cc52724e2872e04260d7daf0d693c170d8c4b243b8767bc7785763533febc62ec2600c30603c433c095453ede59ff2fcabeb84ce32e0ed9d5cf15ffcbc816202b64370d4d77c1e9077d74e94a16fb4fa2e5bec23a56d7a73cf275f91691ae1801a976fcde09e981a2f6327ac27ea1fecf3185df0d56889c04100102000605025331cfb5000a0910fe9645554e8266b64b4303fc084075396674fb6f778d302ac07cef6bc0b5d07b66b2004c44aef711cbac79617ef06d836b4957522d8772dd94bf41a2f4ac8b1ee6d70c57503f837445a74765a076d07b829b8111fc2a918423ddb817ead7ca2a613ef0bfb9c6b3562aec6c3cf3c75ef3031d81d95f6563e4cdcc9960bcb386c5d757b104fcca5fe11fc709df884604101102000605025331cfe7000a09107b15a67f0b3ddc0317f6009e360beea58f29c1d963a22b962b80788c3fa6c84e009d148cfde6b351469b8eae91187eff07ad9d08fcaab88d045331ce820104009f25e20a42b904f3fa555530fe5c46737cf7bd076c35a2a0d22b11f7e0b61a69320b768f4a80fe13980ce380d1cfc4a0cd8fbe2d2e2ef85416668b77208baa65bf973fe8e500e78cc310d7c8705cdb34328bf80e24f0385fce5845c33bc7943cf6b11b02348a23da0bf6428e57c05135f2dc6bd7c1ce325d666d5a5fd2fd5e410011010001889f04180102000905025331ce82021b0c000a0910a401d9f09a34f7c0418003fe34feafcbeaef348a800a0d908a7a6809cc7304017d820f70f0474d5e23cb17e38b67dc6dca282c6ca00961f4ec9edf2738d0f087b1d81e4871ef08e1798010863afb4eac4c44a376cb343be929c5be66a78cfd4456ae9ec6a99d97f4e1c3ff3583351db2147a65c0acef5c003fb544ab3a2e2dc4d43646f58b811a6c3a369d1f" diff --git a/vendor/golang.org/x/net/http2/server.go b/vendor/golang.org/x/net/http2/server.go index abf94e8d..acf3b241 100644 --- a/vendor/golang.org/x/net/http2/server.go +++ b/vendor/golang.org/x/net/http2/server.go @@ -1608,7 +1608,10 @@ func (sc *serverConn) processData(f *DataFrame) error { // Sender sending more than they'd declared? if st.declBodyBytes != -1 && st.bodyBytes+int64(len(data)) > st.declBodyBytes { st.body.CloseWithError(fmt.Errorf("sender tried to send more than declared Content-Length of %d bytes", st.declBodyBytes)) - return streamError(id, ErrCodeStreamClosed) + // RFC 7540, sec 8.1.2.6: A request or response is also malformed if the + // value of a content-length header field does not equal the sum of the + // DATA frame payload lengths that form the body. + return streamError(id, ErrCodeProtocol) } if f.Length > 0 { // Check whether the client has flow control quota. diff --git a/vendor/golang.org/x/net/http2/server_test.go b/vendor/golang.org/x/net/http2/server_test.go index c48d8d38..ffa40c0d 100644 --- a/vendor/golang.org/x/net/http2/server_test.go +++ b/vendor/golang.org/x/net/http2/server_test.go @@ -3764,3 +3764,22 @@ func TestIssue20704Race(t *testing.T) { resp.Body.Close() } } + +func TestServer_Rejects_TooSmall(t *testing.T) { + testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error { + return nil + }, func(st *serverTester) { + st.writeHeaders(HeadersFrameParam{ + StreamID: 1, // clients send odd numbers + BlockFragment: st.encodeHeader( + ":method", "POST", + "content-length", "4", + ), + EndStream: false, // to say DATA frames are coming + EndHeaders: true, + }) + st.writeData(1, true, []byte("12345")) + + st.wantRSTStream(1, ErrCodeProtocol) + }) +} diff --git a/vendor/golang.org/x/sys/unix/dev_openbsd_test.go b/vendor/golang.org/x/sys/unix/dev_openbsd_test.go index e6cb64ff..7c87d7a8 100644 --- a/vendor/golang.org/x/sys/unix/dev_openbsd_test.go +++ b/vendor/golang.org/x/sys/unix/dev_openbsd_test.go @@ -20,15 +20,12 @@ func TestDevices(t *testing.T) { minor uint32 }{ // well known major/minor numbers according to /dev/MAKEDEV on - // OpenBSD 6.0 + // OpenBSD 6.3 {"/dev/null", 2, 2}, {"/dev/zero", 2, 12}, {"/dev/ttyp0", 5, 0}, {"/dev/ttyp1", 5, 1}, - {"/dev/random", 45, 0}, - {"/dev/srandom", 45, 1}, - {"/dev/urandom", 45, 2}, - {"/dev/arandom", 45, 3}, + {"/dev/random", 45, 0}, // symlink to /dev/urandom } for _, tc := range testCases { t.Run(fmt.Sprintf("%s %v:%v", tc.path, tc.major, tc.minor), func(t *testing.T) { diff --git a/vendor/golang.org/x/sys/unix/dev_solaris_test.go b/vendor/golang.org/x/sys/unix/dev_solaris_test.go deleted file mode 100644 index 656508c9..00000000 --- a/vendor/golang.org/x/sys/unix/dev_solaris_test.go +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.7 - -package unix_test - -import ( - "fmt" - "testing" - - "golang.org/x/sys/unix" -) - -func TestDevices(t *testing.T) { - testCases := []struct { - path string - major uint32 - minor uint32 - }{ - // Well-known major/minor numbers on OpenSolaris according to - // /etc/name_to_major - {"/dev/zero", 134, 12}, - {"/dev/null", 134, 2}, - {"/dev/ptyp0", 172, 0}, - {"/dev/ttyp0", 175, 0}, - {"/dev/ttyp1", 175, 1}, - } - for _, tc := range testCases { - t.Run(fmt.Sprintf("%s %v:%v", tc.path, tc.major, tc.minor), func(t *testing.T) { - var stat unix.Stat_t - err := unix.Stat(tc.path, &stat) - if err != nil { - t.Errorf("failed to stat device: %v", err) - return - } - - dev := uint64(stat.Rdev) - if unix.Major(dev) != tc.major { - t.Errorf("for %s Major(%#x) == %d, want %d", tc.path, dev, unix.Major(dev), tc.major) - } - if unix.Minor(dev) != tc.minor { - t.Errorf("for %s Minor(%#x) == %d, want %d", tc.path, dev, unix.Minor(dev), tc.minor) - } - if unix.Mkdev(tc.major, tc.minor) != dev { - t.Errorf("for %s Mkdev(%d, %d) == %#x, want %#x", tc.path, tc.major, tc.minor, unix.Mkdev(tc.major, tc.minor), dev) - } - }) - } -} diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index 374195bf..3b7d6235 100755 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -50,6 +50,7 @@ includes_Darwin=' #include #include #include +#include #include #include #include @@ -428,6 +429,7 @@ ccflags="$@" $2 ~ /^PERF_EVENT_IOC_/ || $2 ~ /^SECCOMP_MODE_/ || $2 ~ /^SPLICE_/ || + $2 !~ /^AUDIT_RECORD_MAGIC/ && $2 ~ /^[A-Z0-9_]+_MAGIC2?$/ || $2 ~ /^(VM|VMADDR)_/ || $2 ~ /^IOCTL_VM_SOCKETS_/ || @@ -436,7 +438,7 @@ ccflags="$@" $2 ~ /^GENL_/ || $2 ~ /^STATX_/ || $2 ~ /^UTIME_/ || - $2 ~ /^XATTR_(CREATE|REPLACE)/ || + $2 ~ /^XATTR_(CREATE|REPLACE|NO(DEFAULT|FOLLOW|SECURITY)|SHOWCOMPRESSION)/ || $2 ~ /^ATTR_(BIT_MAP_COUNT|(CMN|VOL|FILE)_)/ || $2 ~ /^FSOPT_/ || $2 ~ /^WDIOC_/ || diff --git a/vendor/golang.org/x/sys/unix/openbsd_pledge.go b/vendor/golang.org/x/sys/unix/openbsd_pledge.go index db4f72ea..9b1e86a1 100644 --- a/vendor/golang.org/x/sys/unix/openbsd_pledge.go +++ b/vendor/golang.org/x/sys/unix/openbsd_pledge.go @@ -13,7 +13,7 @@ import ( ) const ( - SYS_PLEDGE = 108 + _SYS_PLEDGE = 108 ) // Pledge implements the pledge syscall. For more information see pledge(2). @@ -30,7 +30,7 @@ func Pledge(promises string, paths []string) error { } pathsUnsafe = unsafe.Pointer(&pathsPtr[0]) } - _, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(promisesUnsafe), uintptr(pathsUnsafe), 0) + _, _, e := syscall.Syscall(_SYS_PLEDGE, uintptr(promisesUnsafe), uintptr(pathsUnsafe), 0) if e != 0 { return e } diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go index 693be791..79e94767 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -176,6 +176,88 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { return } +func xattrPointer(dest []byte) *byte { + // It's only when dest is set to NULL that the OS X implementations of + // getxattr() and listxattr() return the current sizes of the named attributes. + // An empty byte array is not sufficient. To maintain the same behaviour as the + // linux implementation, we wrap around the system calls and pass in NULL when + // dest is empty. + var destp *byte + if len(dest) > 0 { + destp = &dest[0] + } + return destp +} + +//sys getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) + +func Getxattr(path string, attr string, dest []byte) (sz int, err error) { + return getxattr(path, attr, xattrPointer(dest), len(dest), 0, 0) +} + +func Lgetxattr(link string, attr string, dest []byte) (sz int, err error) { + return getxattr(link, attr, xattrPointer(dest), len(dest), 0, XATTR_NOFOLLOW) +} + +//sys setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) + +func Setxattr(path string, attr string, data []byte, flags int) (err error) { + // The parameters for the OS X implementation vary slightly compared to the + // linux system call, specifically the position parameter: + // + // linux: + // int setxattr( + // const char *path, + // const char *name, + // const void *value, + // size_t size, + // int flags + // ); + // + // darwin: + // int setxattr( + // const char *path, + // const char *name, + // void *value, + // size_t size, + // u_int32_t position, + // int options + // ); + // + // position specifies the offset within the extended attribute. In the + // current implementation, only the resource fork extended attribute makes + // use of this argument. For all others, position is reserved. We simply + // default to setting it to zero. + return setxattr(path, attr, xattrPointer(data), len(data), 0, flags) +} + +func Lsetxattr(link string, attr string, data []byte, flags int) (err error) { + return setxattr(link, attr, xattrPointer(data), len(data), 0, flags|XATTR_NOFOLLOW) +} + +//sys removexattr(path string, attr string, options int) (err error) + +func Removexattr(path string, attr string) (err error) { + // We wrap around and explicitly zero out the options provided to the OS X + // implementation of removexattr, we do so for interoperability with the + // linux variant. + return removexattr(path, attr, 0) +} + +func Lremovexattr(link string, attr string) (err error) { + return removexattr(link, attr, XATTR_NOFOLLOW) +} + +//sys listxattr(path string, dest *byte, size int, options int) (sz int, err error) + +func Listxattr(path string, dest []byte) (sz int, err error) { + return listxattr(path, xattrPointer(dest), len(dest), 0) +} + +func Llistxattr(link string, dest []byte) (sz int, err error) { + return listxattr(link, xattrPointer(dest), len(dest), XATTR_NOFOLLOW) +} + func setattrlistTimes(path string, times []Timespec, flags int) error { _p0, err := BytePtrFromString(path) if err != nil { @@ -447,13 +529,9 @@ func Uname(uname *Utsname) error { // Watchevent // Waitevent // Modwatch -// Getxattr // Fgetxattr -// Setxattr // Fsetxattr -// Removexattr // Fremovexattr -// Listxattr // Flistxattr // Fsctl // Initgroups diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_test.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_test.go index 654439e0..0fec1a82 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_test.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_test.go @@ -295,3 +295,18 @@ func TestCapRightsSetAndClear(t *testing.T) { t.Fatalf("Wrong rights set") } } + +// stringsFromByteSlice converts a sequence of attributes to a []string. +// On FreeBSD, each entry consists of a single byte containing the length +// of the attribute name, followed by the attribute name. +// The name is _not_ NULL-terminated. +func stringsFromByteSlice(buf []byte) []string { + var result []string + i := 0 + for i < len(buf) { + next := i + 1 + int(buf[i]) + result = append(result, string(buf[i+1:next])) + i = next + } + return result +} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_test.go b/vendor/golang.org/x/sys/unix/syscall_linux_test.go index a2bc4401..9c99893c 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_test.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_test.go @@ -285,7 +285,7 @@ func TestSchedSetaffinity(t *testing.T) { func TestStatx(t *testing.T) { var stx unix.Statx_t err := unix.Statx(unix.AT_FDCWD, ".", 0, 0, &stx) - if err == unix.ENOSYS { + if err == unix.ENOSYS || err == unix.EPERM { t.Skip("statx syscall is not available, skipping test") } else if err != nil { t.Fatalf("Statx: %v", err) @@ -371,3 +371,17 @@ func TestStatx(t *testing.T) { t.Errorf("Statx: returned stat mtime does not match Lstat") } } + +// stringsFromByteSlice converts a sequence of attributes to a []string. +// On Linux, each entry is a NULL-terminated string. +func stringsFromByteSlice(buf []byte) []string { + var result []string + off := 0 + for i, b := range buf { + if b == 0 { + result = append(result, string(buf[off:i])) + off = i + 1 + } + } + return result +} diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go index 649e67fc..9a35334c 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go @@ -31,3 +31,7 @@ func (msghdr *Msghdr) SetControllen(length int) { func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) } + +// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions +// of openbsd/amd64 the syscall is called sysctl instead of __sysctl. +const SYS___SYSCTL = SYS_SYSCTL diff --git a/vendor/golang.org/x/sys/unix/xattr_test.go b/vendor/golang.org/x/sys/unix/xattr_test.go index 78cf9224..fb846a7b 100644 --- a/vendor/golang.org/x/sys/unix/xattr_test.go +++ b/vendor/golang.org/x/sys/unix/xattr_test.go @@ -7,6 +7,7 @@ package unix_test import ( + "os" "runtime" "strings" "testing" @@ -89,4 +90,29 @@ func TestXattr(t *testing.T) { if err != nil { t.Fatalf("Removexattr: %v", err) } + + n := "nonexistent" + err = unix.Lsetxattr(n, xattrName, []byte(xattrDataSet), 0) + if err != unix.ENOENT { + t.Errorf("Lsetxattr: expected %v on non-existent file, got %v", unix.ENOENT, err) + } + + _, err = unix.Lgetxattr(n, xattrName, nil) + if err != unix.ENOENT { + t.Errorf("Lgetxattr: %v", err) + } + + s := "symlink1" + err = os.Symlink(n, s) + if err != nil { + t.Fatal(err) + } + + // Linux doesn't support xattrs on symlink according to xattr(7), so + // just test that we get the proper errors. + + err = unix.Lsetxattr(s, xattrName, []byte(xattrDataSet), 0) + if err != nil && (runtime.GOOS != "linux" || err != unix.EPERM) { + t.Fatalf("Lsetxattr: %v", err) + } } diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go index c5a9b73d..3b39d740 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go @@ -1473,6 +1473,12 @@ const ( WORDSIZE = 0x20 WSTOPPED = 0x8 WUNTRACED = 0x2 + XATTR_CREATE = 0x2 + XATTR_NODEFAULT = 0x10 + XATTR_NOFOLLOW = 0x1 + XATTR_NOSECURITY = 0x8 + XATTR_REPLACE = 0x4 + XATTR_SHOWCOMPRESSION = 0x20 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go index 7de222b6..8fe55477 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go @@ -1473,6 +1473,12 @@ const ( WORDSIZE = 0x40 WSTOPPED = 0x8 WUNTRACED = 0x2 + XATTR_CREATE = 0x2 + XATTR_NODEFAULT = 0x10 + XATTR_NOFOLLOW = 0x1 + XATTR_NOSECURITY = 0x8 + XATTR_REPLACE = 0x4 + XATTR_SHOWCOMPRESSION = 0x20 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go index 33a42e78..7a977770 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go @@ -1473,6 +1473,12 @@ const ( WORDSIZE = 0x40 WSTOPPED = 0x8 WUNTRACED = 0x2 + XATTR_CREATE = 0x2 + XATTR_NODEFAULT = 0x10 + XATTR_NOFOLLOW = 0x1 + XATTR_NOSECURITY = 0x8 + XATTR_REPLACE = 0x4 + XATTR_SHOWCOMPRESSION = 0x20 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go index 71805155..6d56d8a0 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go @@ -1473,6 +1473,12 @@ const ( WORDSIZE = 0x40 WSTOPPED = 0x8 WUNTRACED = 0x2 + XATTR_CREATE = 0x2 + XATTR_NODEFAULT = 0x10 + XATTR_NOFOLLOW = 0x1 + XATTR_NOSECURITY = 0x8 + XATTR_REPLACE = 0x4 + XATTR_SHOWCOMPRESSION = 0x20 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go index 0d50f6b0..acfc6646 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go @@ -45,6 +45,7 @@ const ( AF_SNA = 0xb AF_UNIX = 0x1 AF_UNSPEC = 0x0 + ALTWERASE = 0x200 ARPHRD_ETHER = 0x1 ARPHRD_FRELAY = 0xf ARPHRD_IEEE1394 = 0x18 @@ -146,6 +147,12 @@ const ( BRKINT = 0x2 CFLUSH = 0xf CLOCAL = 0x8000 + CLOCK_BOOTTIME = 0x6 + CLOCK_MONOTONIC = 0x3 + CLOCK_PROCESS_CPUTIME_ID = 0x2 + CLOCK_REALTIME = 0x0 + CLOCK_THREAD_CPUTIME_ID = 0x4 + CLOCK_UPTIME = 0x5 CREAD = 0x800 CRTSCTS = 0x10000 CS5 = 0x0 @@ -178,6 +185,7 @@ const ( DLT_LOOP = 0xc DLT_MPLS = 0xdb DLT_NULL = 0x0 + DLT_OPENFLOW = 0x10b DLT_PFLOG = 0x75 DLT_PFSYNC = 0x12 DLT_PPP = 0x9 @@ -188,6 +196,23 @@ const ( DLT_RAW = 0xe DLT_SLIP = 0x8 DLT_SLIP_BSDOS = 0xf + DLT_USBPCAP = 0xf9 + DLT_USER0 = 0x93 + DLT_USER1 = 0x94 + DLT_USER10 = 0x9d + DLT_USER11 = 0x9e + DLT_USER12 = 0x9f + DLT_USER13 = 0xa0 + DLT_USER14 = 0xa1 + DLT_USER15 = 0xa2 + DLT_USER2 = 0x95 + DLT_USER3 = 0x96 + DLT_USER4 = 0x97 + DLT_USER5 = 0x98 + DLT_USER6 = 0x99 + DLT_USER7 = 0x9a + DLT_USER8 = 0x9b + DLT_USER9 = 0x9c DT_BLK = 0x6 DT_CHR = 0x2 DT_DIR = 0x4 @@ -401,27 +426,38 @@ const ( ETHER_CRC_POLY_LE = 0xedb88320 ETHER_HDR_LEN = 0xe ETHER_MAX_DIX_LEN = 0x600 + ETHER_MAX_HARDMTU_LEN = 0xff9b ETHER_MAX_LEN = 0x5ee ETHER_MIN_LEN = 0x40 ETHER_TYPE_LEN = 0x2 ETHER_VLAN_ENCAP_LEN = 0x4 EVFILT_AIO = -0x3 + EVFILT_DEVICE = -0x8 EVFILT_PROC = -0x5 EVFILT_READ = -0x1 EVFILT_SIGNAL = -0x6 - EVFILT_SYSCOUNT = 0x7 + EVFILT_SYSCOUNT = 0x8 EVFILT_TIMER = -0x7 EVFILT_VNODE = -0x4 EVFILT_WRITE = -0x2 + EVL_ENCAPLEN = 0x4 + EVL_PRIO_BITS = 0xd + EVL_PRIO_MAX = 0x7 + EVL_VLID_MASK = 0xfff + EVL_VLID_MAX = 0xffe + EVL_VLID_MIN = 0x1 + EVL_VLID_NULL = 0x0 EV_ADD = 0x1 EV_CLEAR = 0x20 EV_DELETE = 0x2 EV_DISABLE = 0x8 + EV_DISPATCH = 0x80 EV_ENABLE = 0x4 EV_EOF = 0x8000 EV_ERROR = 0x4000 EV_FLAG1 = 0x2000 EV_ONESHOT = 0x10 + EV_RECEIPT = 0x40 EV_SYSFLAGS = 0xf000 EXTA = 0x4b00 EXTB = 0x9600 @@ -435,7 +471,7 @@ const ( F_GETFL = 0x3 F_GETLK = 0x7 F_GETOWN = 0x5 - F_OK = 0x0 + F_ISATTY = 0xb F_RDLCK = 0x1 F_SETFD = 0x2 F_SETFL = 0x4 @@ -452,7 +488,6 @@ const ( IEXTEN = 0x400 IFAN_ARRIVAL = 0x0 IFAN_DEPARTURE = 0x1 - IFA_ROUTE = 0x1 IFF_ALLMULTI = 0x200 IFF_BROADCAST = 0x2 IFF_CANTCHANGE = 0x8e52 @@ -463,12 +498,12 @@ const ( IFF_LOOPBACK = 0x8 IFF_MULTICAST = 0x8000 IFF_NOARP = 0x80 - IFF_NOTRAILERS = 0x20 IFF_OACTIVE = 0x400 IFF_POINTOPOINT = 0x10 IFF_PROMISC = 0x100 IFF_RUNNING = 0x40 IFF_SIMPLEX = 0x800 + IFF_STATICARP = 0x20 IFF_UP = 0x1 IFNAMSIZ = 0x10 IFT_1822 = 0x2 @@ -597,6 +632,7 @@ const ( IFT_LINEGROUP = 0xd2 IFT_LOCALTALK = 0x2a IFT_LOOP = 0x18 + IFT_MBIM = 0xfa IFT_MEDIAMAILOVERIP = 0x8b IFT_MFSIGLINK = 0xa7 IFT_MIOX25 = 0x26 @@ -721,8 +757,6 @@ const ( IPPROTO_AH = 0x33 IPPROTO_CARP = 0x70 IPPROTO_DIVERT = 0x102 - IPPROTO_DIVERT_INIT = 0x2 - IPPROTO_DIVERT_RESP = 0x1 IPPROTO_DONE = 0x101 IPPROTO_DSTOPTS = 0x3c IPPROTO_EGP = 0x8 @@ -779,6 +813,7 @@ const ( IPV6_LEAVE_GROUP = 0xd IPV6_MAXHLIM = 0xff IPV6_MAXPACKET = 0xffff + IPV6_MINHOPCOUNT = 0x41 IPV6_MMTU = 0x500 IPV6_MULTICAST_HOPS = 0xa IPV6_MULTICAST_IF = 0x9 @@ -818,12 +853,12 @@ const ( IP_DEFAULT_MULTICAST_LOOP = 0x1 IP_DEFAULT_MULTICAST_TTL = 0x1 IP_DF = 0x4000 - IP_DIVERTFL = 0x1022 IP_DROP_MEMBERSHIP = 0xd IP_ESP_NETWORK_LEVEL = 0x16 IP_ESP_TRANS_LEVEL = 0x15 IP_HDRINCL = 0x2 IP_IPCOMP_LEVEL = 0x1d + IP_IPDEFTTL = 0x25 IP_IPSECFLOWINFO = 0x24 IP_IPSEC_LOCAL_AUTH = 0x1b IP_IPSEC_LOCAL_CRED = 0x19 @@ -857,10 +892,12 @@ const ( IP_RETOPTS = 0x8 IP_RF = 0x8000 IP_RTABLE = 0x1021 + IP_SENDSRCADDR = 0x7 IP_TOS = 0x3 IP_TTL = 0x4 ISIG = 0x80 ISTRIP = 0x20 + IUCLC = 0x1000 IXANY = 0x800 IXOFF = 0x400 IXON = 0x200 @@ -881,25 +918,28 @@ const ( MADV_SPACEAVAIL = 0x5 MADV_WILLNEED = 0x3 MAP_ANON = 0x1000 - MAP_COPY = 0x4 + MAP_ANONYMOUS = 0x1000 + MAP_COPY = 0x2 MAP_FILE = 0x0 MAP_FIXED = 0x10 - MAP_FLAGMASK = 0x1ff7 - MAP_HASSEMAPHORE = 0x200 - MAP_INHERIT = 0x80 + MAP_FLAGMASK = 0x7ff7 + MAP_HASSEMAPHORE = 0x0 + MAP_INHERIT = 0x0 MAP_INHERIT_COPY = 0x1 - MAP_INHERIT_DONATE_COPY = 0x3 MAP_INHERIT_NONE = 0x2 MAP_INHERIT_SHARE = 0x0 - MAP_NOEXTEND = 0x100 - MAP_NORESERVE = 0x40 + MAP_INHERIT_ZERO = 0x3 + MAP_NOEXTEND = 0x0 + MAP_NORESERVE = 0x0 MAP_PRIVATE = 0x2 - MAP_RENAME = 0x20 + MAP_RENAME = 0x0 MAP_SHARED = 0x1 - MAP_TRYFIXED = 0x400 + MAP_STACK = 0x4000 + MAP_TRYFIXED = 0x0 MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MSG_BCAST = 0x100 + MSG_CMSG_CLOEXEC = 0x800 MSG_CTRUNC = 0x20 MSG_DONTROUTE = 0x4 MSG_DONTWAIT = 0x80 @@ -917,11 +957,14 @@ const ( NET_RT_DUMP = 0x1 NET_RT_FLAGS = 0x2 NET_RT_IFLIST = 0x3 - NET_RT_MAXID = 0x6 + NET_RT_IFNAMES = 0x6 + NET_RT_MAXID = 0x7 NET_RT_STATS = 0x4 NET_RT_TABLE = 0x5 NOFLSH = 0x80000000 + NOKERNINFO = 0x2000000 NOTE_ATTRIB = 0x8 + NOTE_CHANGE = 0x1 NOTE_CHILD = 0x4 NOTE_DELETE = 0x1 NOTE_EOF = 0x2 @@ -940,11 +983,13 @@ const ( NOTE_TRUNCATE = 0x80 NOTE_WRITE = 0x2 OCRNL = 0x10 + OLCUC = 0x20 ONLCR = 0x2 ONLRET = 0x80 ONOCR = 0x40 ONOEOT = 0x8 OPOST = 0x1 + OXTABS = 0x4 O_ACCMODE = 0x3 O_APPEND = 0x8 O_ASYNC = 0x40 @@ -982,23 +1027,32 @@ const ( RLIMIT_CPU = 0x0 RLIMIT_DATA = 0x2 RLIMIT_FSIZE = 0x1 + RLIMIT_MEMLOCK = 0x6 RLIMIT_NOFILE = 0x8 + RLIMIT_NPROC = 0x7 + RLIMIT_RSS = 0x5 RLIMIT_STACK = 0x3 RLIM_INFINITY = 0x7fffffffffffffff RTAX_AUTHOR = 0x6 + RTAX_BFD = 0xb RTAX_BRD = 0x7 + RTAX_DNS = 0xc RTAX_DST = 0x0 RTAX_GATEWAY = 0x1 RTAX_GENMASK = 0x3 RTAX_IFA = 0x5 RTAX_IFP = 0x4 RTAX_LABEL = 0xa - RTAX_MAX = 0xb + RTAX_MAX = 0xf RTAX_NETMASK = 0x2 + RTAX_SEARCH = 0xe RTAX_SRC = 0x8 RTAX_SRCMASK = 0x9 + RTAX_STATIC = 0xd RTA_AUTHOR = 0x40 + RTA_BFD = 0x800 RTA_BRD = 0x80 + RTA_DNS = 0x1000 RTA_DST = 0x1 RTA_GATEWAY = 0x2 RTA_GENMASK = 0x8 @@ -1006,34 +1060,39 @@ const ( RTA_IFP = 0x10 RTA_LABEL = 0x400 RTA_NETMASK = 0x4 + RTA_SEARCH = 0x4000 RTA_SRC = 0x100 RTA_SRCMASK = 0x200 + RTA_STATIC = 0x2000 RTF_ANNOUNCE = 0x4000 + RTF_BFD = 0x1000000 RTF_BLACKHOLE = 0x1000 + RTF_BROADCAST = 0x400000 + RTF_CACHED = 0x20000 RTF_CLONED = 0x10000 RTF_CLONING = 0x100 + RTF_CONNECTED = 0x800000 RTF_DONE = 0x40 RTF_DYNAMIC = 0x10 - RTF_FMASK = 0x10f808 + RTF_FMASK = 0x110fc08 RTF_GATEWAY = 0x2 RTF_HOST = 0x4 RTF_LLINFO = 0x400 - RTF_MASK = 0x80 + RTF_LOCAL = 0x200000 RTF_MODIFIED = 0x20 RTF_MPATH = 0x40000 RTF_MPLS = 0x100000 + RTF_MULTICAST = 0x200 RTF_PERMANENT_ARP = 0x2000 RTF_PROTO1 = 0x8000 RTF_PROTO2 = 0x4000 RTF_PROTO3 = 0x2000 RTF_REJECT = 0x8 - RTF_SOURCE = 0x20000 RTF_STATIC = 0x800 - RTF_TUNNEL = 0x100000 RTF_UP = 0x1 RTF_USETRAILERS = 0x8000 - RTF_XRESOLVE = 0x200 RTM_ADD = 0x1 + RTM_BFD = 0x12 RTM_CHANGE = 0x3 RTM_DELADDR = 0xd RTM_DELETE = 0x2 @@ -1041,11 +1100,13 @@ const ( RTM_GET = 0x4 RTM_IFANNOUNCE = 0xf RTM_IFINFO = 0xe + RTM_INVALIDATE = 0x11 RTM_LOCK = 0x8 RTM_LOSING = 0x5 RTM_MAXSIZE = 0x800 RTM_MISS = 0x7 RTM_NEWADDR = 0xc + RTM_PROPOSAL = 0x13 RTM_REDIRECT = 0x6 RTM_RESOLVE = 0xb RTM_RTTUNIT = 0xf4240 @@ -1058,6 +1119,8 @@ const ( RTV_RTTVAR = 0x80 RTV_SPIPE = 0x10 RTV_SSTHRESH = 0x20 + RT_TABLEID_BITS = 0x8 + RT_TABLEID_MASK = 0xff RT_TABLEID_MAX = 0xff RUSAGE_CHILDREN = -0x1 RUSAGE_SELF = 0x0 @@ -1070,55 +1133,55 @@ const ( SIOCADDMULTI = 0x80206931 SIOCAIFADDR = 0x8040691a SIOCAIFGROUP = 0x80286987 - SIOCALIFADDR = 0x8218691c SIOCATMARK = 0x40047307 - SIOCBRDGADD = 0x8058693c - SIOCBRDGADDS = 0x80586941 - SIOCBRDGARL = 0x806e694d + SIOCBRDGADD = 0x8060693c + SIOCBRDGADDL = 0x80606949 + SIOCBRDGADDS = 0x80606941 + SIOCBRDGARL = 0x808c694d SIOCBRDGDADDR = 0x81286947 - SIOCBRDGDEL = 0x8058693d - SIOCBRDGDELS = 0x80586942 - SIOCBRDGFLUSH = 0x80586948 - SIOCBRDGFRL = 0x806e694e - SIOCBRDGGCACHE = 0xc0146941 - SIOCBRDGGFD = 0xc0146952 - SIOCBRDGGHT = 0xc0146951 - SIOCBRDGGIFFLGS = 0xc058693e - SIOCBRDGGMA = 0xc0146953 + SIOCBRDGDEL = 0x8060693d + SIOCBRDGDELS = 0x80606942 + SIOCBRDGFLUSH = 0x80606948 + SIOCBRDGFRL = 0x808c694e + SIOCBRDGGCACHE = 0xc0186941 + SIOCBRDGGFD = 0xc0186952 + SIOCBRDGGHT = 0xc0186951 + SIOCBRDGGIFFLGS = 0xc060693e + SIOCBRDGGMA = 0xc0186953 SIOCBRDGGPARAM = 0xc0406958 - SIOCBRDGGPRI = 0xc0146950 + SIOCBRDGGPRI = 0xc0186950 SIOCBRDGGRL = 0xc030694f - SIOCBRDGGSIFS = 0xc058693c - SIOCBRDGGTO = 0xc0146946 - SIOCBRDGIFS = 0xc0586942 + SIOCBRDGGTO = 0xc0186946 + SIOCBRDGIFS = 0xc0606942 SIOCBRDGRTS = 0xc0206943 SIOCBRDGSADDR = 0xc1286944 - SIOCBRDGSCACHE = 0x80146940 - SIOCBRDGSFD = 0x80146952 - SIOCBRDGSHT = 0x80146951 - SIOCBRDGSIFCOST = 0x80586955 - SIOCBRDGSIFFLGS = 0x8058693f - SIOCBRDGSIFPRIO = 0x80586954 - SIOCBRDGSMA = 0x80146953 - SIOCBRDGSPRI = 0x80146950 - SIOCBRDGSPROTO = 0x8014695a - SIOCBRDGSTO = 0x80146945 - SIOCBRDGSTXHC = 0x80146959 + SIOCBRDGSCACHE = 0x80186940 + SIOCBRDGSFD = 0x80186952 + SIOCBRDGSHT = 0x80186951 + SIOCBRDGSIFCOST = 0x80606955 + SIOCBRDGSIFFLGS = 0x8060693f + SIOCBRDGSIFPRIO = 0x80606954 + SIOCBRDGSIFPROT = 0x8060694a + SIOCBRDGSMA = 0x80186953 + SIOCBRDGSPRI = 0x80186950 + SIOCBRDGSPROTO = 0x8018695a + SIOCBRDGSTO = 0x80186945 + SIOCBRDGSTXHC = 0x80186959 SIOCDELMULTI = 0x80206932 SIOCDIFADDR = 0x80206919 SIOCDIFGROUP = 0x80286989 + SIOCDIFPARENT = 0x802069b4 SIOCDIFPHYADDR = 0x80206949 - SIOCDLIFADDR = 0x8218691e + SIOCDVNETID = 0x802069af SIOCGETKALIVE = 0xc01869a4 SIOCGETLABEL = 0x8020699a + SIOCGETMPWCFG = 0xc02069ae SIOCGETPFLOW = 0xc02069fe SIOCGETPFSYNC = 0xc02069f8 SIOCGETSGCNT = 0xc0207534 SIOCGETVIFCNT = 0xc0287533 SIOCGETVLAN = 0xc0206990 - SIOCGHIWAT = 0x40047301 SIOCGIFADDR = 0xc0206921 - SIOCGIFASYNCMAP = 0xc020697c SIOCGIFBRDADDR = 0xc0206923 SIOCGIFCONF = 0xc0106924 SIOCGIFDATA = 0xc020691b @@ -1130,37 +1193,41 @@ const ( SIOCGIFGMEMB = 0xc028698a SIOCGIFGROUP = 0xc0286988 SIOCGIFHARDMTU = 0xc02069a5 - SIOCGIFMEDIA = 0xc0306936 + SIOCGIFLLPRIO = 0xc02069b6 + SIOCGIFMEDIA = 0xc0406938 SIOCGIFMETRIC = 0xc0206917 SIOCGIFMTU = 0xc020697e SIOCGIFNETMASK = 0xc0206925 - SIOCGIFPDSTADDR = 0xc0206948 + SIOCGIFPAIR = 0xc02069b1 + SIOCGIFPARENT = 0xc02069b3 SIOCGIFPRIORITY = 0xc020699c - SIOCGIFPSRCADDR = 0xc0206947 SIOCGIFRDOMAIN = 0xc02069a0 SIOCGIFRTLABEL = 0xc0206983 - SIOCGIFTIMESLOT = 0xc0206986 + SIOCGIFRXR = 0x802069aa SIOCGIFXFLAGS = 0xc020699e - SIOCGLIFADDR = 0xc218691d SIOCGLIFPHYADDR = 0xc218694b + SIOCGLIFPHYDF = 0xc02069c2 SIOCGLIFPHYRTABLE = 0xc02069a2 SIOCGLIFPHYTTL = 0xc02069a9 - SIOCGLOWAT = 0x40047303 SIOCGPGRP = 0x40047309 SIOCGSPPPPARAMS = 0xc0206994 + SIOCGUMBINFO = 0xc02069be + SIOCGUMBPARAM = 0xc02069c0 SIOCGVH = 0xc02069f6 + SIOCGVNETFLOWID = 0xc02069c4 SIOCGVNETID = 0xc02069a7 + SIOCIFAFATTACH = 0x801169ab + SIOCIFAFDETACH = 0x801169ac SIOCIFCREATE = 0x8020697a SIOCIFDESTROY = 0x80206979 SIOCIFGCLONERS = 0xc0106978 SIOCSETKALIVE = 0x801869a3 SIOCSETLABEL = 0x80206999 + SIOCSETMPWCFG = 0x802069ad SIOCSETPFLOW = 0x802069fd SIOCSETPFSYNC = 0x802069f7 SIOCSETVLAN = 0x8020698f - SIOCSHIWAT = 0x80047300 SIOCSIFADDR = 0x8020690c - SIOCSIFASYNCMAP = 0x8020697d SIOCSIFBRDADDR = 0x80206913 SIOCSIFDESCR = 0x80206980 SIOCSIFDSTADDR = 0x8020690e @@ -1168,25 +1235,36 @@ const ( SIOCSIFGATTR = 0x8028698c SIOCSIFGENERIC = 0x80206939 SIOCSIFLLADDR = 0x8020691f - SIOCSIFMEDIA = 0xc0206935 + SIOCSIFLLPRIO = 0x802069b5 + SIOCSIFMEDIA = 0xc0206937 SIOCSIFMETRIC = 0x80206918 SIOCSIFMTU = 0x8020697f SIOCSIFNETMASK = 0x80206916 - SIOCSIFPHYADDR = 0x80406946 + SIOCSIFPAIR = 0x802069b0 + SIOCSIFPARENT = 0x802069b2 SIOCSIFPRIORITY = 0x8020699b SIOCSIFRDOMAIN = 0x8020699f SIOCSIFRTLABEL = 0x80206982 - SIOCSIFTIMESLOT = 0x80206985 SIOCSIFXFLAGS = 0x8020699d SIOCSLIFPHYADDR = 0x8218694a + SIOCSLIFPHYDF = 0x802069c1 SIOCSLIFPHYRTABLE = 0x802069a1 SIOCSLIFPHYTTL = 0x802069a8 - SIOCSLOWAT = 0x80047302 SIOCSPGRP = 0x80047308 SIOCSSPPPPARAMS = 0x80206993 + SIOCSUMBPARAM = 0x802069bf SIOCSVH = 0xc02069f5 + SIOCSVNETFLOWID = 0x802069c3 SIOCSVNETID = 0x802069a6 + SIOCSWGDPID = 0xc018695b + SIOCSWGMAXFLOW = 0xc0186960 + SIOCSWGMAXGROUP = 0xc018695d + SIOCSWSDPID = 0x8018695c + SIOCSWSPORTNO = 0xc060695f + SOCK_CLOEXEC = 0x8000 SOCK_DGRAM = 0x2 + SOCK_DNS = 0x1000 + SOCK_NONBLOCK = 0x4000 SOCK_RAW = 0x3 SOCK_RDM = 0x4 SOCK_SEQPACKET = 0x5 @@ -1217,9 +1295,14 @@ const ( SO_TIMESTAMP = 0x800 SO_TYPE = 0x1008 SO_USELOOPBACK = 0x40 + SO_ZEROIZE = 0x2000 TCIFLUSH = 0x1 + TCIOFF = 0x3 TCIOFLUSH = 0x3 + TCION = 0x4 TCOFLUSH = 0x2 + TCOOFF = 0x1 + TCOON = 0x2 TCP_MAXBURST = 0x4 TCP_MAXSEG = 0x2 TCP_MAXWIN = 0xffff @@ -1229,11 +1312,12 @@ const ( TCP_MSS = 0x200 TCP_NODELAY = 0x1 TCP_NOPUSH = 0x10 - TCP_NSTATES = 0xb TCP_SACK_ENABLE = 0x8 TCSAFLUSH = 0x2 TIOCCBRK = 0x2000747a TIOCCDTR = 0x20007478 + TIOCCHKVERAUTH = 0x2000741e + TIOCCLRVERAUTH = 0x2000741d TIOCCONS = 0x80047462 TIOCDRAIN = 0x2000745e TIOCEXCL = 0x2000740d @@ -1288,16 +1372,19 @@ const ( TIOCSETAF = 0x802c7416 TIOCSETAW = 0x802c7415 TIOCSETD = 0x8004741b + TIOCSETVERAUTH = 0x8004741c TIOCSFLAGS = 0x8004745c TIOCSIG = 0x8004745f TIOCSPGRP = 0x80047476 TIOCSTART = 0x2000746e - TIOCSTAT = 0x80047465 + TIOCSTAT = 0x20007465 TIOCSTI = 0x80017472 TIOCSTOP = 0x2000746f TIOCSTSTAMP = 0x8008745a TIOCSWINSZ = 0x80087467 TIOCUCNTL = 0x80047466 + TIOCUCNTL_CBRK = 0x7a + TIOCUCNTL_SBRK = 0x7b TOSTOP = 0x400000 VDISCARD = 0xf VDSUSP = 0xb @@ -1309,6 +1396,18 @@ const ( VKILL = 0x5 VLNEXT = 0xe VMIN = 0x10 + VM_ANONMIN = 0x7 + VM_LOADAVG = 0x2 + VM_MAXID = 0xc + VM_MAXSLP = 0xa + VM_METER = 0x1 + VM_NKMEMPAGES = 0x6 + VM_PSSTRINGS = 0x3 + VM_SWAPENCRYPT = 0x5 + VM_USPACE = 0xb + VM_UVMEXP = 0x4 + VM_VNODEMIN = 0x9 + VM_VTEXTMIN = 0x8 VQUIT = 0x9 VREPRINT = 0x6 VSTART = 0xc @@ -1321,8 +1420,8 @@ const ( WCONTINUED = 0x8 WCOREFLAG = 0x80 WNOHANG = 0x1 - WSTOPPED = 0x7f WUNTRACED = 0x2 + XCASE = 0x1000000 ) // Errors @@ -1336,6 +1435,7 @@ const ( EALREADY = syscall.Errno(0x25) EAUTH = syscall.Errno(0x50) EBADF = syscall.Errno(0x9) + EBADMSG = syscall.Errno(0x5c) EBADRPC = syscall.Errno(0x48) EBUSY = syscall.Errno(0x10) ECANCELED = syscall.Errno(0x58) @@ -1362,7 +1462,7 @@ const ( EIPSEC = syscall.Errno(0x52) EISCONN = syscall.Errno(0x38) EISDIR = syscall.Errno(0x15) - ELAST = syscall.Errno(0x5b) + ELAST = syscall.Errno(0x5f) ELOOP = syscall.Errno(0x3e) EMEDIUMTYPE = syscall.Errno(0x56) EMFILE = syscall.Errno(0x18) @@ -1390,12 +1490,14 @@ const ( ENOTCONN = syscall.Errno(0x39) ENOTDIR = syscall.Errno(0x14) ENOTEMPTY = syscall.Errno(0x42) + ENOTRECOVERABLE = syscall.Errno(0x5d) ENOTSOCK = syscall.Errno(0x26) ENOTSUP = syscall.Errno(0x5b) ENOTTY = syscall.Errno(0x19) ENXIO = syscall.Errno(0x6) EOPNOTSUPP = syscall.Errno(0x2d) EOVERFLOW = syscall.Errno(0x57) + EOWNERDEAD = syscall.Errno(0x5e) EPERM = syscall.Errno(0x1) EPFNOSUPPORT = syscall.Errno(0x2e) EPIPE = syscall.Errno(0x20) @@ -1403,6 +1505,7 @@ const ( EPROCUNAVAIL = syscall.Errno(0x4c) EPROGMISMATCH = syscall.Errno(0x4b) EPROGUNAVAIL = syscall.Errno(0x4a) + EPROTO = syscall.Errno(0x5f) EPROTONOSUPPORT = syscall.Errno(0x2b) EPROTOTYPE = syscall.Errno(0x29) ERANGE = syscall.Errno(0x22) @@ -1499,7 +1602,7 @@ var errorList = [...]struct { {32, "EPIPE", "broken pipe"}, {33, "EDOM", "numerical argument out of domain"}, {34, "ERANGE", "result too large"}, - {35, "EWOULDBLOCK", "resource temporarily unavailable"}, + {35, "EAGAIN", "resource temporarily unavailable"}, {36, "EINPROGRESS", "operation now in progress"}, {37, "EALREADY", "operation already in progress"}, {38, "ENOTSOCK", "socket operation on non-socket"}, @@ -1555,7 +1658,11 @@ var errorList = [...]struct { {88, "ECANCELED", "operation canceled"}, {89, "EIDRM", "identifier removed"}, {90, "ENOMSG", "no message of desired type"}, - {91, "ELAST", "not supported"}, + {91, "ENOTSUP", "not supported"}, + {92, "EBADMSG", "bad message"}, + {93, "ENOTRECOVERABLE", "state not recoverable"}, + {94, "EOWNERDEAD", "previous owner died"}, + {95, "ELAST", "protocol error"}, } // Signal table diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go index 4c9f7275..ac02d4d8 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go @@ -399,6 +399,83 @@ func pipe() (r int, w int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attr) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) + sz = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attr) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func removexattr(path string, attr string, options int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attr) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) + sz = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func kill(pid int, signum int, posix int) (err error) { _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go index 25623777..1dd3cfa0 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go @@ -399,6 +399,83 @@ func pipe() (r int, w int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attr) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) + sz = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attr) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func removexattr(path string, attr string, options int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attr) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) + sz = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func kill(pid int, signum int, posix int) (err error) { _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go index 4ae787e4..cab46e74 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go @@ -1,4 +1,4 @@ -// mksyscall.pl -tags darwin,arm syscall_bsd.go syscall_darwin.go syscall_darwin_arm.go +// mksyscall.pl -l32 -tags darwin,arm syscall_bsd.go syscall_darwin.go syscall_darwin_arm.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build darwin,arm @@ -399,6 +399,83 @@ func pipe() (r int, w int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attr) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) + sz = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attr) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func removexattr(path string, attr string, options int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attr) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) + sz = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func kill(pid int, signum int, posix int) (err error) { _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go index 14ed6886..13478dd0 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go @@ -399,6 +399,83 @@ func pipe() (r int, w int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attr) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) + sz = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attr) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func removexattr(path string, attr string, options int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attr) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) + sz = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func kill(pid int, signum int, posix int) (err error) { _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go index 83bb935b..207b2793 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go @@ -1,6 +1,8 @@ // mksysctl_openbsd.pl // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT +// +build amd64,openbsd + package unix type mibentry struct { @@ -14,6 +16,7 @@ var sysctlMib = []mibentry{ {"ddb.max_line", []_C_int{9, 3}}, {"ddb.max_width", []_C_int{9, 2}}, {"ddb.panic", []_C_int{9, 5}}, + {"ddb.profile", []_C_int{9, 9}}, {"ddb.radix", []_C_int{9, 1}}, {"ddb.tab_stop_width", []_C_int{9, 4}}, {"ddb.trigger", []_C_int{9, 8}}, @@ -29,6 +32,7 @@ var sysctlMib = []mibentry{ {"hw.ncpu", []_C_int{6, 3}}, {"hw.ncpufound", []_C_int{6, 21}}, {"hw.pagesize", []_C_int{6, 7}}, + {"hw.perfpolicy", []_C_int{6, 23}}, {"hw.physmem", []_C_int{6, 19}}, {"hw.product", []_C_int{6, 15}}, {"hw.serialno", []_C_int{6, 17}}, @@ -37,7 +41,7 @@ var sysctlMib = []mibentry{ {"hw.uuid", []_C_int{6, 18}}, {"hw.vendor", []_C_int{6, 14}}, {"hw.version", []_C_int{6, 16}}, - {"kern.arandom", []_C_int{1, 37}}, + {"kern.allowkmem", []_C_int{1, 52}}, {"kern.argmax", []_C_int{1, 8}}, {"kern.boottime", []_C_int{1, 21}}, {"kern.bufcachepercent", []_C_int{1, 72}}, @@ -46,12 +50,13 @@ var sysctlMib = []mibentry{ {"kern.consdev", []_C_int{1, 75}}, {"kern.cp_time", []_C_int{1, 40}}, {"kern.cp_time2", []_C_int{1, 71}}, - {"kern.cryptodevallowsoft", []_C_int{1, 53}}, + {"kern.dnsjackport", []_C_int{1, 13}}, {"kern.domainname", []_C_int{1, 22}}, {"kern.file", []_C_int{1, 73}}, {"kern.forkstat", []_C_int{1, 42}}, {"kern.fscale", []_C_int{1, 46}}, {"kern.fsync", []_C_int{1, 33}}, + {"kern.global_ptrace", []_C_int{1, 81}}, {"kern.hostid", []_C_int{1, 11}}, {"kern.hostname", []_C_int{1, 10}}, {"kern.intrcnt.nintrcnt", []_C_int{1, 63, 1}}, @@ -84,7 +89,6 @@ var sysctlMib = []mibentry{ {"kern.pool_debug", []_C_int{1, 77}}, {"kern.posix1version", []_C_int{1, 17}}, {"kern.proc", []_C_int{1, 66}}, - {"kern.random", []_C_int{1, 31}}, {"kern.rawpartition", []_C_int{1, 24}}, {"kern.saved_ids", []_C_int{1, 20}}, {"kern.securelevel", []_C_int{1, 9}}, @@ -102,21 +106,16 @@ var sysctlMib = []mibentry{ {"kern.timecounter.hardware", []_C_int{1, 69, 3}}, {"kern.timecounter.tick", []_C_int{1, 69, 1}}, {"kern.timecounter.timestepwarnings", []_C_int{1, 69, 2}}, - {"kern.tty.maxptys", []_C_int{1, 44, 6}}, - {"kern.tty.nptys", []_C_int{1, 44, 7}}, {"kern.tty.tk_cancc", []_C_int{1, 44, 4}}, {"kern.tty.tk_nin", []_C_int{1, 44, 1}}, {"kern.tty.tk_nout", []_C_int{1, 44, 2}}, {"kern.tty.tk_rawcc", []_C_int{1, 44, 3}}, {"kern.tty.ttyinfo", []_C_int{1, 44, 5}}, {"kern.ttycount", []_C_int{1, 57}}, - {"kern.userasymcrypto", []_C_int{1, 60}}, - {"kern.usercrypto", []_C_int{1, 52}}, - {"kern.usermount", []_C_int{1, 30}}, {"kern.version", []_C_int{1, 4}}, - {"kern.vnode", []_C_int{1, 13}}, {"kern.watchdog.auto", []_C_int{1, 64, 2}}, {"kern.watchdog.period", []_C_int{1, 64, 1}}, + {"kern.wxabort", []_C_int{1, 74}}, {"net.bpf.bufsize", []_C_int{4, 31, 1}}, {"net.bpf.maxbufsize", []_C_int{4, 31, 2}}, {"net.inet.ah.enable", []_C_int{4, 2, 51, 1}}, @@ -144,7 +143,9 @@ var sysctlMib = []mibentry{ {"net.inet.icmp.stats", []_C_int{4, 2, 1, 7}}, {"net.inet.icmp.tstamprepl", []_C_int{4, 2, 1, 6}}, {"net.inet.igmp.stats", []_C_int{4, 2, 2, 1}}, + {"net.inet.ip.arpdown", []_C_int{4, 2, 0, 40}}, {"net.inet.ip.arpqueued", []_C_int{4, 2, 0, 36}}, + {"net.inet.ip.arptimeout", []_C_int{4, 2, 0, 39}}, {"net.inet.ip.encdebug", []_C_int{4, 2, 0, 12}}, {"net.inet.ip.forwarding", []_C_int{4, 2, 0, 1}}, {"net.inet.ip.ifq.congestion", []_C_int{4, 2, 0, 30, 4}}, @@ -153,8 +154,10 @@ var sysctlMib = []mibentry{ {"net.inet.ip.ifq.maxlen", []_C_int{4, 2, 0, 30, 2}}, {"net.inet.ip.maxqueue", []_C_int{4, 2, 0, 11}}, {"net.inet.ip.mforwarding", []_C_int{4, 2, 0, 31}}, + {"net.inet.ip.mrtmfc", []_C_int{4, 2, 0, 37}}, {"net.inet.ip.mrtproto", []_C_int{4, 2, 0, 34}}, {"net.inet.ip.mrtstats", []_C_int{4, 2, 0, 35}}, + {"net.inet.ip.mrtvif", []_C_int{4, 2, 0, 38}}, {"net.inet.ip.mtu", []_C_int{4, 2, 0, 4}}, {"net.inet.ip.mtudisc", []_C_int{4, 2, 0, 27}}, {"net.inet.ip.mtudisctimeout", []_C_int{4, 2, 0, 28}}, @@ -173,7 +176,6 @@ var sysctlMib = []mibentry{ {"net.inet.ipip.stats", []_C_int{4, 2, 4, 2}}, {"net.inet.mobileip.allow", []_C_int{4, 2, 55, 1}}, {"net.inet.pfsync.stats", []_C_int{4, 2, 240, 1}}, - {"net.inet.pim.stats", []_C_int{4, 2, 103, 1}}, {"net.inet.tcp.ackonpush", []_C_int{4, 2, 6, 13}}, {"net.inet.tcp.always_keepalive", []_C_int{4, 2, 6, 22}}, {"net.inet.tcp.baddynamic", []_C_int{4, 2, 6, 6}}, @@ -187,6 +189,7 @@ var sysctlMib = []mibentry{ {"net.inet.tcp.reasslimit", []_C_int{4, 2, 6, 18}}, {"net.inet.tcp.rfc1323", []_C_int{4, 2, 6, 1}}, {"net.inet.tcp.rfc3390", []_C_int{4, 2, 6, 17}}, + {"net.inet.tcp.rootonly", []_C_int{4, 2, 6, 24}}, {"net.inet.tcp.rstppslimit", []_C_int{4, 2, 6, 12}}, {"net.inet.tcp.sack", []_C_int{4, 2, 6, 10}}, {"net.inet.tcp.sackholelimit", []_C_int{4, 2, 6, 20}}, @@ -194,9 +197,12 @@ var sysctlMib = []mibentry{ {"net.inet.tcp.stats", []_C_int{4, 2, 6, 21}}, {"net.inet.tcp.synbucketlimit", []_C_int{4, 2, 6, 16}}, {"net.inet.tcp.syncachelimit", []_C_int{4, 2, 6, 15}}, + {"net.inet.tcp.synhashsize", []_C_int{4, 2, 6, 25}}, + {"net.inet.tcp.synuselimit", []_C_int{4, 2, 6, 23}}, {"net.inet.udp.baddynamic", []_C_int{4, 2, 17, 2}}, {"net.inet.udp.checksum", []_C_int{4, 2, 17, 1}}, {"net.inet.udp.recvspace", []_C_int{4, 2, 17, 3}}, + {"net.inet.udp.rootonly", []_C_int{4, 2, 17, 6}}, {"net.inet.udp.sendspace", []_C_int{4, 2, 17, 4}}, {"net.inet.udp.stats", []_C_int{4, 2, 17, 5}}, {"net.inet6.divert.recvspace", []_C_int{4, 24, 86, 1}}, @@ -209,13 +215,8 @@ var sysctlMib = []mibentry{ {"net.inet6.icmp6.nd6_delay", []_C_int{4, 24, 30, 8}}, {"net.inet6.icmp6.nd6_maxnudhint", []_C_int{4, 24, 30, 15}}, {"net.inet6.icmp6.nd6_mmaxtries", []_C_int{4, 24, 30, 10}}, - {"net.inet6.icmp6.nd6_prune", []_C_int{4, 24, 30, 6}}, {"net.inet6.icmp6.nd6_umaxtries", []_C_int{4, 24, 30, 9}}, - {"net.inet6.icmp6.nd6_useloopback", []_C_int{4, 24, 30, 11}}, - {"net.inet6.icmp6.nodeinfo", []_C_int{4, 24, 30, 13}}, - {"net.inet6.icmp6.rediraccept", []_C_int{4, 24, 30, 2}}, {"net.inet6.icmp6.redirtimeout", []_C_int{4, 24, 30, 3}}, - {"net.inet6.ip6.accept_rtadv", []_C_int{4, 24, 17, 12}}, {"net.inet6.ip6.auto_flowlabel", []_C_int{4, 24, 17, 17}}, {"net.inet6.ip6.dad_count", []_C_int{4, 24, 17, 16}}, {"net.inet6.ip6.dad_pending", []_C_int{4, 24, 17, 49}}, @@ -228,20 +229,19 @@ var sysctlMib = []mibentry{ {"net.inet6.ip6.maxdynroutes", []_C_int{4, 24, 17, 48}}, {"net.inet6.ip6.maxfragpackets", []_C_int{4, 24, 17, 9}}, {"net.inet6.ip6.maxfrags", []_C_int{4, 24, 17, 41}}, - {"net.inet6.ip6.maxifdefrouters", []_C_int{4, 24, 17, 47}}, - {"net.inet6.ip6.maxifprefixes", []_C_int{4, 24, 17, 46}}, {"net.inet6.ip6.mforwarding", []_C_int{4, 24, 17, 42}}, + {"net.inet6.ip6.mrtmfc", []_C_int{4, 24, 17, 53}}, + {"net.inet6.ip6.mrtmif", []_C_int{4, 24, 17, 52}}, {"net.inet6.ip6.mrtproto", []_C_int{4, 24, 17, 8}}, {"net.inet6.ip6.mtudisctimeout", []_C_int{4, 24, 17, 50}}, {"net.inet6.ip6.multicast_mtudisc", []_C_int{4, 24, 17, 44}}, {"net.inet6.ip6.multipath", []_C_int{4, 24, 17, 43}}, {"net.inet6.ip6.neighborgcthresh", []_C_int{4, 24, 17, 45}}, {"net.inet6.ip6.redirect", []_C_int{4, 24, 17, 2}}, - {"net.inet6.ip6.rr_prune", []_C_int{4, 24, 17, 22}}, + {"net.inet6.ip6.soiikey", []_C_int{4, 24, 17, 54}}, {"net.inet6.ip6.sourcecheck", []_C_int{4, 24, 17, 10}}, {"net.inet6.ip6.sourcecheck_logint", []_C_int{4, 24, 17, 11}}, {"net.inet6.ip6.use_deprecated", []_C_int{4, 24, 17, 21}}, - {"net.inet6.ip6.v6only", []_C_int{4, 24, 17, 24}}, {"net.key.sadb_dump", []_C_int{4, 30, 1}}, {"net.key.spd_dump", []_C_int{4, 30, 2}}, {"net.mpls.ifq.congestion", []_C_int{4, 33, 3, 4}}, @@ -254,17 +254,4 @@ var sysctlMib = []mibentry{ {"net.mpls.ttl", []_C_int{4, 33, 2}}, {"net.pflow.stats", []_C_int{4, 34, 1}}, {"net.pipex.enable", []_C_int{4, 35, 1}}, - {"vm.anonmin", []_C_int{2, 7}}, - {"vm.loadavg", []_C_int{2, 2}}, - {"vm.maxslp", []_C_int{2, 10}}, - {"vm.nkmempages", []_C_int{2, 6}}, - {"vm.psstrings", []_C_int{2, 3}}, - {"vm.swapencrypt.enable", []_C_int{2, 5, 0}}, - {"vm.swapencrypt.keyscreated", []_C_int{2, 5, 1}}, - {"vm.swapencrypt.keysdeleted", []_C_int{2, 5, 2}}, - {"vm.uspace", []_C_int{2, 11}}, - {"vm.uvmexp", []_C_int{2, 4}}, - {"vm.vmmeter", []_C_int{2, 1}}, - {"vm.vnodemin", []_C_int{2, 9}}, - {"vm.vtextmin", []_C_int{2, 8}}, } diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go index bd28146d..10edff07 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go @@ -1,5 +1,5 @@ // mksysnum_openbsd.pl -// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT +// Code generated by the command above; see README.md. DO NOT EDIT. // +build amd64,openbsd @@ -12,6 +12,7 @@ const ( SYS_WRITE = 4 // { ssize_t sys_write(int fd, const void *buf, \ SYS_OPEN = 5 // { int sys_open(const char *path, \ SYS_CLOSE = 6 // { int sys_close(int fd); } + SYS_GETENTROPY = 7 // { int sys_getentropy(void *buf, size_t nbyte); } SYS___TFORK = 8 // { int sys___tfork(const struct __tfork *param, \ SYS_LINK = 9 // { int sys_link(const char *path, const char *link); } SYS_UNLINK = 10 // { int sys_unlink(const char *path); } @@ -37,11 +38,10 @@ const ( SYS_ACCEPT = 30 // { int sys_accept(int s, struct sockaddr *name, \ SYS_GETPEERNAME = 31 // { int sys_getpeername(int fdes, struct sockaddr *asa, \ SYS_GETSOCKNAME = 32 // { int sys_getsockname(int fdes, struct sockaddr *asa, \ - SYS_ACCESS = 33 // { int sys_access(const char *path, int flags); } + SYS_ACCESS = 33 // { int sys_access(const char *path, int amode); } SYS_CHFLAGS = 34 // { int sys_chflags(const char *path, u_int flags); } SYS_FCHFLAGS = 35 // { int sys_fchflags(int fd, u_int flags); } SYS_SYNC = 36 // { void sys_sync(void); } - SYS_KILL = 37 // { int sys_kill(int pid, int signum); } SYS_STAT = 38 // { int sys_stat(const char *path, struct stat *ub); } SYS_GETPPID = 39 // { pid_t sys_getppid(void); } SYS_LSTAT = 40 // { int sys_lstat(const char *path, struct stat *ub); } @@ -53,7 +53,6 @@ const ( SYS_SIGACTION = 46 // { int sys_sigaction(int signum, \ SYS_GETGID = 47 // { gid_t sys_getgid(void); } SYS_SIGPROCMASK = 48 // { int sys_sigprocmask(int how, sigset_t mask); } - SYS_GETLOGIN = 49 // { int sys_getlogin(char *namebuf, u_int namelen); } SYS_SETLOGIN = 50 // { int sys_setlogin(const char *namebuf); } SYS_ACCT = 51 // { int sys_acct(const char *path); } SYS_SIGPENDING = 52 // { int sys_sigpending(void); } @@ -62,7 +61,7 @@ const ( SYS_REBOOT = 55 // { int sys_reboot(int opt); } SYS_REVOKE = 56 // { int sys_revoke(const char *path); } SYS_SYMLINK = 57 // { int sys_symlink(const char *path, \ - SYS_READLINK = 58 // { int sys_readlink(const char *path, char *buf, \ + SYS_READLINK = 58 // { ssize_t sys_readlink(const char *path, \ SYS_EXECVE = 59 // { int sys_execve(const char *path, \ SYS_UMASK = 60 // { mode_t sys_umask(mode_t newmask); } SYS_CHROOT = 61 // { int sys_chroot(const char *path); } @@ -86,15 +85,18 @@ const ( SYS_GETGROUPS = 79 // { int sys_getgroups(int gidsetsize, \ SYS_SETGROUPS = 80 // { int sys_setgroups(int gidsetsize, \ SYS_GETPGRP = 81 // { int sys_getpgrp(void); } - SYS_SETPGID = 82 // { int sys_setpgid(pid_t pid, int pgid); } + SYS_SETPGID = 82 // { int sys_setpgid(pid_t pid, pid_t pgid); } + SYS_FUTEX = 83 // { int sys_futex(uint32_t *f, int op, int val, \ SYS_UTIMENSAT = 84 // { int sys_utimensat(int fd, const char *path, \ SYS_FUTIMENS = 85 // { int sys_futimens(int fd, \ + SYS_KBIND = 86 // { int sys_kbind(const struct __kbind *param, \ SYS_CLOCK_GETTIME = 87 // { int sys_clock_gettime(clockid_t clock_id, \ SYS_CLOCK_SETTIME = 88 // { int sys_clock_settime(clockid_t clock_id, \ SYS_CLOCK_GETRES = 89 // { int sys_clock_getres(clockid_t clock_id, \ SYS_DUP2 = 90 // { int sys_dup2(int from, int to); } SYS_NANOSLEEP = 91 // { int sys_nanosleep(const struct timespec *rqtp, \ SYS_FCNTL = 92 // { int sys_fcntl(int fd, int cmd, ... void *arg); } + SYS_ACCEPT4 = 93 // { int sys_accept4(int s, struct sockaddr *name, \ SYS___THRSLEEP = 94 // { int sys___thrsleep(const volatile void *ident, \ SYS_FSYNC = 95 // { int sys_fsync(int fd); } SYS_SETPRIORITY = 96 // { int sys_setpriority(int which, id_t who, int prio); } @@ -102,16 +104,23 @@ const ( SYS_CONNECT = 98 // { int sys_connect(int s, const struct sockaddr *name, \ SYS_GETDENTS = 99 // { int sys_getdents(int fd, void *buf, size_t buflen); } SYS_GETPRIORITY = 100 // { int sys_getpriority(int which, id_t who); } + SYS_PIPE2 = 101 // { int sys_pipe2(int *fdp, int flags); } + SYS_DUP3 = 102 // { int sys_dup3(int from, int to, int flags); } SYS_SIGRETURN = 103 // { int sys_sigreturn(struct sigcontext *sigcntxp); } SYS_BIND = 104 // { int sys_bind(int s, const struct sockaddr *name, \ SYS_SETSOCKOPT = 105 // { int sys_setsockopt(int s, int level, int name, \ SYS_LISTEN = 106 // { int sys_listen(int s, int backlog); } + SYS_CHFLAGSAT = 107 // { int sys_chflagsat(int fd, const char *path, \ + SYS_PLEDGE = 108 // { int sys_pledge(const char *promises, \ SYS_PPOLL = 109 // { int sys_ppoll(struct pollfd *fds, \ SYS_PSELECT = 110 // { int sys_pselect(int nd, fd_set *in, fd_set *ou, \ SYS_SIGSUSPEND = 111 // { int sys_sigsuspend(int mask); } + SYS_SENDSYSLOG = 112 // { int sys_sendsyslog(const char *buf, size_t nbyte, \ SYS_GETSOCKOPT = 118 // { int sys_getsockopt(int s, int level, int name, \ + SYS_THRKILL = 119 // { int sys_thrkill(pid_t tid, int signum, void *tcb); } SYS_READV = 120 // { ssize_t sys_readv(int fd, \ SYS_WRITEV = 121 // { ssize_t sys_writev(int fd, \ + SYS_KILL = 122 // { int sys_kill(int pid, int signum); } SYS_FCHOWN = 123 // { int sys_fchown(int fd, uid_t uid, gid_t gid); } SYS_FCHMOD = 124 // { int sys_fchmod(int fd, mode_t mode); } SYS_SETREUID = 126 // { int sys_setreuid(uid_t ruid, uid_t euid); } @@ -125,6 +134,7 @@ const ( SYS_MKDIR = 136 // { int sys_mkdir(const char *path, mode_t mode); } SYS_RMDIR = 137 // { int sys_rmdir(const char *path); } SYS_ADJTIME = 140 // { int sys_adjtime(const struct timeval *delta, \ + SYS_GETLOGIN_R = 141 // { int sys_getlogin_r(char *namebuf, u_int namelen); } SYS_SETSID = 147 // { int sys_setsid(void); } SYS_QUOTACTL = 148 // { int sys_quotactl(const char *path, int cmd, \ SYS_NFSSVC = 155 // { int sys_nfssvc(int flag, void *argp); } @@ -144,7 +154,7 @@ const ( SYS_LSEEK = 199 // { off_t sys_lseek(int fd, int pad, off_t offset, \ SYS_TRUNCATE = 200 // { int sys_truncate(const char *path, int pad, \ SYS_FTRUNCATE = 201 // { int sys_ftruncate(int fd, int pad, off_t length); } - SYS___SYSCTL = 202 // { int sys___sysctl(const int *name, u_int namelen, \ + SYS_SYSCTL = 202 // { int sys_sysctl(const int *name, u_int namelen, \ SYS_MLOCK = 203 // { int sys_mlock(const void *addr, size_t len); } SYS_MUNLOCK = 204 // { int sys_munlock(const void *addr, size_t len); } SYS_GETPGID = 207 // { pid_t sys_getpgid(pid_t pid); } diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go index d5314108..5a9c8184 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go @@ -74,30 +74,30 @@ const ( ) type Stat_t struct { - Mode uint32 - Dev int32 - Ino uint64 - Nlink uint32 - Uid uint32 - Gid uint32 - Rdev int32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Size int64 - Blocks int64 - Blksize uint32 - Flags uint32 - Gen uint32 - Pad_cgo_0 [4]byte - X__st_birthtim Timespec + Mode uint32 + Dev int32 + Ino uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Rdev int32 + Atim Timespec + Mtim Timespec + Ctim Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + _ [4]byte + _ Timespec } type Statfs_t struct { F_flags uint32 F_bsize uint32 F_iosize uint32 - Pad_cgo_0 [4]byte + _ [4]byte F_blocks uint64 F_bfree uint64 F_bavail int64 @@ -116,7 +116,7 @@ type Statfs_t struct { F_mntonname [90]int8 F_mntfromname [90]int8 F_mntfromspec [90]int8 - Pad_cgo_1 [2]byte + _ [2]byte Mount_info [160]byte } @@ -129,13 +129,13 @@ type Flock_t struct { } type Dirent struct { - Fileno uint64 - Off int64 - Reclen uint16 - Type uint8 - Namlen uint8 - X__d_padding [4]uint8 - Name [256]int8 + Fileno uint64 + Off int64 + Reclen uint16 + Type uint8 + Namlen uint8 + _ [4]uint8 + Name [256]int8 } type Fsid struct { @@ -216,10 +216,10 @@ type IPv6Mreq struct { type Msghdr struct { Name *byte Namelen uint32 - Pad_cgo_0 [4]byte + _ [4]byte Iov *Iovec Iovlen uint32 - Pad_cgo_1 [4]byte + _ [4]byte Control *byte Controllen uint32 Flags int32 @@ -281,8 +281,8 @@ type FdSet struct { } const ( - SizeofIfMsghdr = 0xf8 - SizeofIfData = 0xe0 + SizeofIfMsghdr = 0xa8 + SizeofIfData = 0x90 SizeofIfaMsghdr = 0x18 SizeofIfAnnounceMsghdr = 0x1a SizeofRtMsghdr = 0x60 @@ -311,7 +311,7 @@ type IfData struct { Link_state uint8 Mtu uint32 Metric uint32 - Pad uint32 + Rdomain uint32 Baudrate uint64 Ipackets uint64 Ierrors uint64 @@ -323,12 +323,11 @@ type IfData struct { Imcasts uint64 Omcasts uint64 Iqdrops uint64 + Oqdrops uint64 Noproto uint64 Capabilities uint32 - Pad_cgo_0 [4]byte + _ [4]byte Lastchange Timeval - Mclpool [7]Mclpool - Pad_cgo_1 [4]byte } type IfaMsghdr struct { @@ -389,13 +388,7 @@ type RtMetrics struct { Pad uint32 } -type Mclpool struct { - Grown int32 - Alive uint16 - Hwm uint16 - Cwm uint16 - Lwm uint16 -} +type Mclpool struct{} const ( SizeofBpfVersion = 0x4 @@ -416,9 +409,9 @@ type BpfStat struct { } type BpfProgram struct { - Len uint32 - Pad_cgo_0 [4]byte - Insns *BpfInsn + Len uint32 + _ [4]byte + Insns *BpfInsn } type BpfInsn struct { @@ -429,11 +422,11 @@ type BpfInsn struct { } type BpfHdr struct { - Tstamp BpfTimeval - Caplen uint32 - Datalen uint32 - Hdrlen uint16 - Pad_cgo_0 [2]byte + Tstamp BpfTimeval + Caplen uint32 + Datalen uint32 + Hdrlen uint16 + _ [2]byte } type BpfTimeval struct { diff --git a/vendor/golang.org/x/sys/windows/asm_windows_amd64.s b/vendor/golang.org/x/sys/windows/asm_windows_amd64.s index 4d025ab5..5bfdf797 100644 --- a/vendor/golang.org/x/sys/windows/asm_windows_amd64.s +++ b/vendor/golang.org/x/sys/windows/asm_windows_amd64.s @@ -9,5 +9,5 @@ TEXT ·getprocaddress(SB), 7, $0-32 JMP syscall·getprocaddress(SB) -TEXT ·loadlibrary(SB), 7, $0-8 +TEXT ·loadlibrary(SB), 7, $0-24 JMP syscall·loadlibrary(SB) diff --git a/vendor/gopkg.in/olivere/elastic.v6/README.md b/vendor/gopkg.in/olivere/elastic.v6/README.md index 6e840385..f9bfae25 100644 --- a/vendor/gopkg.in/olivere/elastic.v6/README.md +++ b/vendor/gopkg.in/olivere/elastic.v6/README.md @@ -363,6 +363,10 @@ The cat APIs are not implemented as of now. We think they are better suited for - [ ] Snapshot status - [ ] Monitoring snapshot/restore status - [ ] Stopping currently running snapshot and restore +- Scripting + - [x] GetScript + - [x] PutScript + - [x] DeleteScript ### Sorting diff --git a/vendor/gopkg.in/olivere/elastic.v6/client.go b/vendor/gopkg.in/olivere/elastic.v6/client.go index 3b0a79a4..deea09db 100644 --- a/vendor/gopkg.in/olivere/elastic.v6/client.go +++ b/vendor/gopkg.in/olivere/elastic.v6/client.go @@ -26,7 +26,7 @@ import ( const ( // Version is the current version of Elastic. - Version = "6.1.21" + Version = "6.1.22" // DefaultURL is the default endpoint of Elasticsearch on the local machine. // It is used e.g. when initializing a new Client without a specific URL. @@ -1737,6 +1737,24 @@ func (c *Client) SnapshotVerifyRepository(repository string) *SnapshotVerifyRepo return NewSnapshotVerifyRepositoryService(c).Repository(repository) } +// -- Scripting APIs -- + +// GetScript reads a stored script in Elasticsearch. +// Use PutScript for storing a script. +func (c *Client) GetScript() *GetScriptService { + return NewGetScriptService(c) +} + +// PutScript allows saving a stored script in Elasticsearch. +func (c *Client) PutScript() *PutScriptService { + return NewPutScriptService(c) +} + +// DeleteScript allows removing a stored script from Elasticsearch. +func (c *Client) DeleteScript() *DeleteScriptService { + return NewDeleteScriptService(c) +} + // -- Helpers and shortcuts -- // ElasticsearchVersion returns the version number of Elasticsearch diff --git a/vendor/gopkg.in/olivere/elastic.v6/script.go b/vendor/gopkg.in/olivere/elastic.v6/script.go index 615c41df..192c3c3f 100644 --- a/vendor/gopkg.in/olivere/elastic.v6/script.go +++ b/vendor/gopkg.in/olivere/elastic.v6/script.go @@ -18,7 +18,8 @@ type Script struct { params map[string]interface{} } -// NewScript creates and initializes a new Script. +// NewScript creates and initializes a new Script. By default, it is of +// type "inline". Use NewScriptStored for a stored script (where type is "id"). func NewScript(script string) *Script { return &Script{ script: script, @@ -89,10 +90,7 @@ func (s *Script) Source() (interface{}, error) { } else { source["id"] = s.script } - if s.lang == "null" || s.lang == "nil" { - // HACK(oe) Hotfix for https://github.com/elastic/elasticsearch/issues/28002; remove when 6.3 and/or 7.x are out. - source["lang"] = nil - } else if s.lang != "" { + if s.lang != "" { source["lang"] = s.lang } if len(s.params) > 0 { diff --git a/vendor/gopkg.in/olivere/elastic.v6/script_delete.go b/vendor/gopkg.in/olivere/elastic.v6/script_delete.go new file mode 100644 index 00000000..f71b31d5 --- /dev/null +++ b/vendor/gopkg.in/olivere/elastic.v6/script_delete.go @@ -0,0 +1,134 @@ +// Copyright 2012-present Oliver Eilhard. All rights reserved. +// Use of this source code is governed by a MIT-license. +// See http://olivere.mit-license.org/license.txt for details. + +package elastic + +import ( + "context" + "fmt" + "net/url" + + "github.com/olivere/elastic/uritemplates" +) + +// DeleteScriptService removes a stored script in Elasticsearch. +// +// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/modules-scripting.html +// for details. +type DeleteScriptService struct { + client *Client + pretty bool + id string + timeout string + masterTimeout string +} + +// NewDeleteScriptService creates a new DeleteScriptService. +func NewDeleteScriptService(client *Client) *DeleteScriptService { + return &DeleteScriptService{ + client: client, + } +} + +// Id is the script ID. +func (s *DeleteScriptService) Id(id string) *DeleteScriptService { + s.id = id + return s +} + +// Timeout is an explicit operation timeout. +func (s *DeleteScriptService) Timeout(timeout string) *DeleteScriptService { + s.timeout = timeout + return s +} + +// MasterTimeout is the timeout for connecting to master. +func (s *DeleteScriptService) MasterTimeout(masterTimeout string) *DeleteScriptService { + s.masterTimeout = masterTimeout + return s +} + +// Pretty indicates that the JSON response be indented and human readable. +func (s *DeleteScriptService) Pretty(pretty bool) *DeleteScriptService { + s.pretty = pretty + return s +} + +// buildURL builds the URL for the operation. +func (s *DeleteScriptService) buildURL() (string, string, url.Values, error) { + var ( + err error + method = "DELETE" + path string + ) + + path, err = uritemplates.Expand("/_scripts/{id}", map[string]string{ + "id": s.id, + }) + if err != nil { + return "", "", url.Values{}, err + } + + // Add query string parameters + params := url.Values{} + if s.pretty { + params.Set("pretty", "true") + } + if s.timeout != "" { + params.Set("timeout", s.timeout) + } + if s.masterTimeout != "" { + params.Set("master_timestamp", s.masterTimeout) + } + return method, path, params, nil +} + +// Validate checks if the operation is valid. +func (s *DeleteScriptService) Validate() error { + var invalid []string + if s.id == "" { + invalid = append(invalid, "Id") + } + if len(invalid) > 0 { + return fmt.Errorf("missing required fields: %v", invalid) + } + return nil +} + +// Do executes the operation. +func (s *DeleteScriptService) Do(ctx context.Context) (*DeleteScriptResponse, error) { + // Check pre-conditions + if err := s.Validate(); err != nil { + return nil, err + } + + // Get URL for request + method, path, params, err := s.buildURL() + if err != nil { + return nil, err + } + + // Get HTTP response + res, err := s.client.PerformRequest(ctx, PerformRequestOptions{ + Method: method, + Path: path, + Params: params, + }) + if err != nil { + return nil, err + } + + // Return operation response + ret := new(DeleteScriptResponse) + if err := s.client.decoder.Decode(res.Body, ret); err != nil { + return nil, err + } + return ret, nil +} + +// DeleteScriptResponse is the result of deleting a stored script +// in Elasticsearch. +type DeleteScriptResponse struct { + AcknowledgedResponse +} diff --git a/vendor/gopkg.in/olivere/elastic.v6/script_delete_test.go b/vendor/gopkg.in/olivere/elastic.v6/script_delete_test.go new file mode 100644 index 00000000..88e12bb4 --- /dev/null +++ b/vendor/gopkg.in/olivere/elastic.v6/script_delete_test.go @@ -0,0 +1,84 @@ +// Copyright 2012-present Oliver Eilhard. All rights reserved. +// Use of this source code is governed by a MIT-license. +// See http://olivere.mit-license.org/license.txt for details. + +package elastic + +import ( + "context" + "testing" +) + +func TestDeleteScript(t *testing.T) { + client := setupTestClientAndCreateIndex(t) + + scriptID := "example-delete-script-id" + + // Ensure the script does not exist + _, err := client.PerformRequest( + context.Background(), + PerformRequestOptions{ + Method: "DELETE", + Path: "/_scripts/" + scriptID, + }) + if err != nil && !IsNotFound(err) { + t.Fatal(err) + } + + // PutScript API + script := `{ + "script": { + "lang": "painless", + "source": "ctx._source.message = params.new_message" + } + }` + putRes, err := client.PutScript(). + Id(scriptID). + BodyString(script). + Do(context.Background()) + if err != nil { + t.Fatal(err) + } + if putRes == nil { + t.Errorf("expected result to be != nil; got: %v", putRes) + } + if !putRes.Acknowledged { + t.Errorf("expected ack for PutScript op; got %v", putRes.Acknowledged) + } + + // Must exist now + _, err = client.PerformRequest( + context.Background(), + PerformRequestOptions{ + Method: "GET", + Path: "/_scripts/" + scriptID, + }) + if err != nil { + t.Fatal(err) + } + + // DeleteScript API + res, err := client.DeleteScript(). + Id(scriptID). + Do(context.Background()) + if err != nil { + t.Fatal(err) + } + if res == nil { + t.Errorf("expected result to be != nil; got: %v", res) + } + if !res.Acknowledged { + t.Errorf("expected ack for DeleteScript op; got %v", res.Acknowledged) + } + + // Must not exist now + _, err = client.PerformRequest( + context.Background(), + PerformRequestOptions{ + Method: "DELETE", + Path: "/_scripts/" + scriptID, + }) + if err != nil && !IsNotFound(err) { + t.Fatal(err) + } +} diff --git a/vendor/gopkg.in/olivere/elastic.v6/script_get.go b/vendor/gopkg.in/olivere/elastic.v6/script_get.go new file mode 100644 index 00000000..313d5398 --- /dev/null +++ b/vendor/gopkg.in/olivere/elastic.v6/script_get.go @@ -0,0 +1,117 @@ +// Copyright 2012-present Oliver Eilhard. All rights reserved. +// Use of this source code is governed by a MIT-license. +// See http://olivere.mit-license.org/license.txt for details. + +package elastic + +import ( + "context" + "encoding/json" + "fmt" + "net/url" + + "github.com/olivere/elastic/uritemplates" +) + +// GetScriptService reads a stored script in Elasticsearch. +// +// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/modules-scripting.html +// for details. +type GetScriptService struct { + client *Client + pretty bool + id string +} + +// NewGetScriptService creates a new GetScriptService. +func NewGetScriptService(client *Client) *GetScriptService { + return &GetScriptService{ + client: client, + } +} + +// Id is the script ID. +func (s *GetScriptService) Id(id string) *GetScriptService { + s.id = id + return s +} + +// Pretty indicates that the JSON response be indented and human readable. +func (s *GetScriptService) Pretty(pretty bool) *GetScriptService { + s.pretty = pretty + return s +} + +// buildURL builds the URL for the operation. +func (s *GetScriptService) buildURL() (string, string, url.Values, error) { + var ( + err error + method = "GET" + path string + ) + + path, err = uritemplates.Expand("/_scripts/{id}", map[string]string{ + "id": s.id, + }) + if err != nil { + return "", "", url.Values{}, err + } + + // Add query string parameters + params := url.Values{} + if s.pretty { + params.Set("pretty", "true") + } + return method, path, params, nil +} + +// Validate checks if the operation is valid. +func (s *GetScriptService) Validate() error { + var invalid []string + if s.id == "" { + invalid = append(invalid, "Id") + } + if len(invalid) > 0 { + return fmt.Errorf("missing required fields: %v", invalid) + } + return nil +} + +// Do executes the operation. +func (s *GetScriptService) Do(ctx context.Context) (*GetScriptResponse, error) { + // Check pre-conditions + if err := s.Validate(); err != nil { + return nil, err + } + + // Get URL for request + method, path, params, err := s.buildURL() + if err != nil { + return nil, err + } + + // Get HTTP response + res, err := s.client.PerformRequest(ctx, PerformRequestOptions{ + Method: method, + Path: path, + Params: params, + }) + if err != nil { + return nil, err + } + + // Return operation response + ret := new(GetScriptResponse) + if err := s.client.decoder.Decode(res.Body, ret); err != nil { + return nil, err + } + return ret, nil +} + +// GetScriptResponse is the result of deleting a stored script +// in Elasticsearch. +type GetScriptResponse struct { + Id string `json:"_id"` + Found bool `json:"found"` + Script json.RawMessage `json:"script"` +} diff --git a/vendor/gopkg.in/olivere/elastic.v6/script_get_test.go b/vendor/gopkg.in/olivere/elastic.v6/script_get_test.go new file mode 100644 index 00000000..478e816d --- /dev/null +++ b/vendor/gopkg.in/olivere/elastic.v6/script_get_test.go @@ -0,0 +1,91 @@ +// Copyright 2012-present Oliver Eilhard. All rights reserved. +// Use of this source code is governed by a MIT-license. +// See http://olivere.mit-license.org/license.txt for details. + +package elastic + +import ( + "context" + "testing" +) + +func TestGetScript(t *testing.T) { + client := setupTestClientAndCreateIndex(t) + + scriptID := "example-get-script-id" + + // Ensure the script does not exist + _, err := client.PerformRequest( + context.Background(), + PerformRequestOptions{ + Method: "DELETE", + Path: "/_scripts/" + scriptID, + }) + if err != nil && !IsNotFound(err) { + t.Fatal(err) + } + + // PutScript API + script := `{ + "script": { + "lang": "painless", + "source": "ctx._source.message = params.new_message" + } + }` + putRes, err := client.PutScript(). + Id(scriptID). + BodyString(script). + Do(context.Background()) + if err != nil { + t.Fatal(err) + } + if putRes == nil { + t.Errorf("expected result to be != nil; got: %v", putRes) + } + if !putRes.Acknowledged { + t.Errorf("expected ack for PutScript op; got %v", putRes.Acknowledged) + } + + // Must exist now + _, err = client.PerformRequest( + context.Background(), + PerformRequestOptions{ + Method: "GET", + Path: "/_scripts/" + scriptID, + }) + if err != nil { + t.Fatal(err) + } + + // GetScript API + res, err := client.GetScript(). + Id(scriptID). + Do(context.Background()) + if err != nil { + t.Fatal(err) + } + if res == nil { + t.Errorf("expected result to be != nil; got: %v", res) + } + if want, have := scriptID, res.Id; want != have { + t.Fatalf("expected _id = %q; got: %q", want, have) + } + if want, have := true, res.Found; want != have { + t.Fatalf("expected found = %v; got: %v", want, have) + } + if res.Script == nil { + t.Fatal("expected script; got: nil") + } + outScript := `{"lang":"painless","source":"ctx._source.message = params.new_message"}` + if want, have := outScript, string(res.Script); want != have { + t.Fatalf("expected script = %q; got: %q", want, have) + } + + // Cleanup + client.PerformRequest( + context.Background(), + PerformRequestOptions{ + Method: "DELETE", + Path: "/_scripts/" + scriptID, + }) +} diff --git a/vendor/gopkg.in/olivere/elastic.v6/script_put.go b/vendor/gopkg.in/olivere/elastic.v6/script_put.go new file mode 100644 index 00000000..c7310f5f --- /dev/null +++ b/vendor/gopkg.in/olivere/elastic.v6/script_put.go @@ -0,0 +1,174 @@ +// Copyright 2012-present Oliver Eilhard. All rights reserved. +// Use of this source code is governed by a MIT-license. +// See http://olivere.mit-license.org/license.txt for details. + +package elastic + +import ( + "context" + "fmt" + "net/url" + + "github.com/olivere/elastic/uritemplates" +) + +// PutScriptService adds or updates a stored script in Elasticsearch. +// +// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/modules-scripting.html +// for details. +type PutScriptService struct { + client *Client + pretty bool + id string + context string + timeout string + masterTimeout string + bodyJson interface{} + bodyString string +} + +// NewPutScriptService creates a new PutScriptService. +func NewPutScriptService(client *Client) *PutScriptService { + return &PutScriptService{ + client: client, + } +} + +// Id is the script ID. +func (s *PutScriptService) Id(id string) *PutScriptService { + s.id = id + return s +} + +// Context specifies the script context (optional). +func (s *PutScriptService) Context(context string) *PutScriptService { + s.context = context + return s +} + +// Timeout is an explicit operation timeout. +func (s *PutScriptService) Timeout(timeout string) *PutScriptService { + s.timeout = timeout + return s +} + +// MasterTimeout is the timeout for connecting to master. +func (s *PutScriptService) MasterTimeout(masterTimeout string) *PutScriptService { + s.masterTimeout = masterTimeout + return s +} + +// Pretty indicates that the JSON response be indented and human readable. +func (s *PutScriptService) Pretty(pretty bool) *PutScriptService { + s.pretty = pretty + return s +} + +// BodyJson is the document as a serializable JSON interface. +func (s *PutScriptService) BodyJson(body interface{}) *PutScriptService { + s.bodyJson = body + return s +} + +// BodyString is the document encoded as a string. +func (s *PutScriptService) BodyString(body string) *PutScriptService { + s.bodyString = body + return s +} + +// buildURL builds the URL for the operation. +func (s *PutScriptService) buildURL() (string, string, url.Values, error) { + var ( + err error + method = "PUT" + path string + ) + + if s.context != "" { + path, err = uritemplates.Expand("/_scripts/{id}/{context}", map[string]string{ + "id": s.id, + "context": s.context, + }) + } else { + path, err = uritemplates.Expand("/_scripts/{id}", map[string]string{ + "id": s.id, + }) + } + if err != nil { + return "", "", url.Values{}, err + } + + // Add query string parameters + params := url.Values{} + if s.pretty { + params.Set("pretty", "true") + } + if s.timeout != "" { + params.Set("timeout", s.timeout) + } + if s.masterTimeout != "" { + params.Set("master_timestamp", s.masterTimeout) + } + return method, path, params, nil +} + +// Validate checks if the operation is valid. +func (s *PutScriptService) Validate() error { + var invalid []string + if s.id == "" { + invalid = append(invalid, "Id") + } + if s.bodyString == "" && s.bodyJson == nil { + invalid = append(invalid, "BodyJson") + } + if len(invalid) > 0 { + return fmt.Errorf("missing required fields: %v", invalid) + } + return nil +} + +// Do executes the operation. +func (s *PutScriptService) Do(ctx context.Context) (*PutScriptResponse, error) { + // Check pre-conditions + if err := s.Validate(); err != nil { + return nil, err + } + + // Get URL for request + method, path, params, err := s.buildURL() + if err != nil { + return nil, err + } + + // Setup HTTP request body + var body interface{} + if s.bodyJson != nil { + body = s.bodyJson + } else { + body = s.bodyString + } + + // Get HTTP response + res, err := s.client.PerformRequest(ctx, PerformRequestOptions{ + Method: method, + Path: path, + Params: params, + Body: body, + }) + if err != nil { + return nil, err + } + + // Return operation response + ret := new(PutScriptResponse) + if err := s.client.decoder.Decode(res.Body, ret); err != nil { + return nil, err + } + return ret, nil +} + +// PutScriptResponse is the result of saving a stored script +// in Elasticsearch. +type PutScriptResponse struct { + AcknowledgedResponse +} diff --git a/vendor/gopkg.in/olivere/elastic.v6/script_put_test.go b/vendor/gopkg.in/olivere/elastic.v6/script_put_test.go new file mode 100644 index 00000000..051046e3 --- /dev/null +++ b/vendor/gopkg.in/olivere/elastic.v6/script_put_test.go @@ -0,0 +1,66 @@ +// Copyright 2012-present Oliver Eilhard. All rights reserved. +// Use of this source code is governed by a MIT-license. +// See http://olivere.mit-license.org/license.txt for details. + +package elastic + +import ( + "context" + "testing" +) + +func TestPutScript(t *testing.T) { + client := setupTestClientAndCreateIndex(t) + + scriptID := "example-put-script-id" + + // Ensure the script does not exist + _, err := client.PerformRequest( + context.Background(), + PerformRequestOptions{ + Method: "DELETE", + Path: "/_scripts/" + scriptID, + }) + if err != nil && !IsNotFound(err) { + t.Fatal(err) + } + + // PutScript API + script := `{ + "script": { + "lang": "painless", + "source": "ctx._source.message = params.new_message" + } + }` + res, err := client.PutScript(). + Id(scriptID). + BodyString(script). + Do(context.Background()) + if err != nil { + t.Fatal(err) + } + if res == nil { + t.Errorf("expected result to be != nil; got: %v", res) + } + if !res.Acknowledged { + t.Errorf("expected ack for PutScript op; got %v", res.Acknowledged) + } + + // Must exist now + _, err = client.PerformRequest( + context.Background(), + PerformRequestOptions{ + Method: "GET", + Path: "/_scripts/" + scriptID, + }) + if err != nil { + t.Fatal(err) + } + // Cleanup + client.PerformRequest( + context.Background(), + PerformRequestOptions{ + Method: "DELETE", + Path: "/_scripts/" + scriptID, + }) +} diff --git a/vendor/gopkg.in/olivere/elastic.v6/script_test.go b/vendor/gopkg.in/olivere/elastic.v6/script_test.go index 2126d27e..aa475d7e 100644 --- a/vendor/gopkg.in/olivere/elastic.v6/script_test.go +++ b/vendor/gopkg.in/olivere/elastic.v6/script_test.go @@ -59,23 +59,3 @@ func TestScriptingStored(t *testing.T) { t.Errorf("expected\n%s\n,got:\n%s", expected, got) } } - -// TestScriptingBug28002 is a workaround for -// https://github.com/elastic/elasticsearch/issues/28002 -// in that it allows to use a Script with ID but a language of "null". -func TestScriptingBug28002(t *testing.T) { - builder := NewScriptStored("script-with-id").Lang("null").Param("factor", 2.0) - src, err := builder.Source() - if err != nil { - t.Fatal(err) - } - data, err := json.Marshal(src) - if err != nil { - t.Fatalf("marshaling to JSON failed: %v", err) - } - got := string(data) - expected := `{"id":"script-with-id","lang":null,"params":{"factor":2}}` - if got != expected { - t.Errorf("expected\n%s\n,got:\n%s", expected, got) - } -} diff --git a/vendor/gopkg.in/olivere/elastic.v6/update_integration_test.go b/vendor/gopkg.in/olivere/elastic.v6/update_integration_test.go index f3692529..22b9d09e 100644 --- a/vendor/gopkg.in/olivere/elastic.v6/update_integration_test.go +++ b/vendor/gopkg.in/olivere/elastic.v6/update_integration_test.go @@ -56,3 +56,69 @@ func TestUpdateWithScript(t *testing.T) { t.Fatalf("want Message = %q, have %v", want, have) } } + +func TestUpdateWithScriptID(t *testing.T) { + client := setupTestClientAndCreateIndexAndAddDocs(t) //, SetTraceLog(log.New(os.Stdout, "", 0))) + + // Get original + getRes, err := client.Get().Index(testIndexName).Type("doc").Id("1").Do(context.TODO()) + if err != nil { + t.Fatal(err) + } + var original tweet + if err := json.Unmarshal(*getRes.Source, &original); err != nil { + t.Fatal(err) + } + + // Set script with ID + scriptID := "example-script-id" + _, err = client.DeleteScript().Id(scriptID).Do(context.Background()) + if err != nil && !IsNotFound(err) { + t.Fatal(err) + } + _, err = client.PutScript(). + Id(scriptID). + BodyString(`{ + "script": { + "lang": "painless", + "source": "ctx._source.message = params.new_message" + } + }`). + Do(context.Background()) + if err != nil { + t.Fatal(err) + } + + // Update with script + updRes, err := client.Update().Index(testIndexName).Type("doc").Id("1"). + Script( + NewScriptStored(scriptID).Param("new_message", "Updated message text."), + ). + Do(context.TODO()) + if err != nil { + t.Fatal(err) + } + if updRes == nil { + t.Fatal("response is nil") + } + if want, have := "updated", updRes.Result; want != have { + t.Fatalf("want Result = %q, have %v", want, have) + } + + // Get new version + getRes, err = client.Get().Index(testIndexName).Type("doc").Id("1").Do(context.TODO()) + if err != nil { + t.Fatal(err) + } + var updated tweet + if err := json.Unmarshal(*getRes.Source, &updated); err != nil { + t.Fatal(err) + } + + if want, have := original.User, updated.User; want != have { + t.Fatalf("want User = %q, have %v", want, have) + } + if want, have := "Updated message text.", updated.Message; want != have { + t.Fatalf("want Message = %q, have %v", want, have) + } +}