From b1882543dc3873d5bcf15ce37a2ac1345bb79ce5 Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Wed, 23 Jan 2019 14:30:02 -0500 Subject: [PATCH] Update to latest etcd and use the new repository packages This will be necessary for go mod work Additionally, the srv api has changed. This adapts to it. --- physical/etcd/etcd.go | 5 +- physical/etcd/etcd2.go | 2 +- physical/etcd/etcd_test.go | 2 +- vendor/github.com/coreos/etcd/LICENSE | 202 -------- vendor/github.com/coreos/etcd/NOTICE | 5 - .../coreos/etcd/pkg/transport/doc.go | 17 - .../etcd/pkg/transport/keepalive_listener.go | 94 ---- .../coreos/etcd/pkg/transport/limit_listen.go | 80 --- .../coreos/etcd/pkg/transport/listener.go | 391 --------------- .../coreos/etcd/pkg/transport/listener_tls.go | 272 ----------- .../coreos/etcd/pkg/transport/timeout_conn.go | 44 -- .../etcd/pkg/transport/timeout_listener.go | 57 --- .../etcd/pkg/transport/timeout_transport.go | 51 -- .../coreos/etcd/pkg/transport/tls.go | 49 -- .../coreos/etcd/pkg/transport/transport.go | 71 --- .../etcd/pkg/transport/unix_listener.go | 40 -- .../etcd/client/README.md | 0 .../etcd/client/auth_role.go | 0 .../etcd/client/auth_user.go | 0 .../etcd/client/cancelreq.go | 0 .../etcd/client/client.go | 0 .../etcd/client/cluster_error.go | 0 .../coreos => go.etcd.io}/etcd/client/curl.go | 0 .../etcd/client/discover.go | 6 +- .../coreos => go.etcd.io}/etcd/client/doc.go | 0 .../etcd/client/keys.generated.go | 460 +++++++++--------- .../coreos => go.etcd.io}/etcd/client/keys.go | 0 .../etcd/client/members.go | 0 .../coreos => go.etcd.io}/etcd/client/util.go | 0 vendor/go.etcd.io/etcd/clientv3/client.go | 9 +- .../etcd/clientv3/concurrency/election.go | 1 + vendor/go.etcd.io/etcd/clientv3/doc.go | 2 +- vendor/go.etcd.io/etcd/clientv3/lease.go | 2 +- .../etcd/clientv3/retry_interceptor.go | 3 +- .../etcd/clientv3/utils.go} | 29 +- vendor/go.etcd.io/etcd/clientv3/watch.go | 2 +- vendor/go.etcd.io/etcd/pkg/srv/srv.go | 18 +- vendor/go.etcd.io/etcd/raft/OWNERS | 19 + vendor/go.etcd.io/etcd/raft/log.go | 14 +- vendor/go.etcd.io/etcd/raft/node.go | 14 +- vendor/go.etcd.io/etcd/raft/raft.go | 59 ++- vendor/go.etcd.io/etcd/raft/rawnode.go | 33 ++ vendor/go.etcd.io/etcd/raft/status.go | 32 +- vendor/go.etcd.io/etcd/raft/util.go | 11 +- vendor/vendor.json | 102 ++-- .../docs/configuration/storage/etcd.html.md | 4 + 46 files changed, 473 insertions(+), 1729 deletions(-) delete mode 100644 vendor/github.com/coreos/etcd/LICENSE delete mode 100644 vendor/github.com/coreos/etcd/NOTICE delete mode 100644 vendor/github.com/coreos/etcd/pkg/transport/doc.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/transport/keepalive_listener.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/transport/limit_listen.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/transport/listener.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/transport/listener_tls.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/transport/timeout_conn.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/transport/timeout_listener.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/transport/timeout_transport.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/transport/tls.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/transport/transport.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/transport/unix_listener.go rename vendor/{github.com/coreos => go.etcd.io}/etcd/client/README.md (100%) rename vendor/{github.com/coreos => go.etcd.io}/etcd/client/auth_role.go (100%) rename vendor/{github.com/coreos => go.etcd.io}/etcd/client/auth_user.go (100%) rename vendor/{github.com/coreos => go.etcd.io}/etcd/client/cancelreq.go (100%) rename vendor/{github.com/coreos => go.etcd.io}/etcd/client/client.go (100%) rename vendor/{github.com/coreos => go.etcd.io}/etcd/client/cluster_error.go (100%) rename vendor/{github.com/coreos => go.etcd.io}/etcd/client/curl.go (100%) rename vendor/{github.com/coreos => go.etcd.io}/etcd/client/discover.go (83%) rename vendor/{github.com/coreos => go.etcd.io}/etcd/client/doc.go (100%) rename vendor/{github.com/coreos => go.etcd.io}/etcd/client/keys.generated.go (87%) rename vendor/{github.com/coreos => go.etcd.io}/etcd/client/keys.go (100%) rename vendor/{github.com/coreos => go.etcd.io}/etcd/client/members.go (100%) rename vendor/{github.com/coreos => go.etcd.io}/etcd/client/util.go (100%) rename vendor/{github.com/coreos/etcd/pkg/transport/timeout_dialer.go => go.etcd.io/etcd/clientv3/utils.go} (51%) create mode 100644 vendor/go.etcd.io/etcd/raft/OWNERS diff --git a/physical/etcd/etcd.go b/physical/etcd/etcd.go index 985d8def713e..f0f42f0238ab 100644 --- a/physical/etcd/etcd.go +++ b/physical/etcd/etcd.go @@ -7,11 +7,11 @@ import ( "os" "strings" - "github.com/coreos/etcd/client" "github.com/coreos/go-semver/semver" "github.com/hashicorp/errwrap" log "github.com/hashicorp/go-hclog" "github.com/hashicorp/vault/physical" + "go.etcd.io/etcd/client" ) var ( @@ -133,8 +133,9 @@ func getEtcdEndpoints(conf map[string]string) ([]string, error) { } if useSrv { + srvName, _ := getEtcdOption(conf, "discovery_srv_name", "ETCD_DISCOVERY_SRV_NAME") discoverer := client.NewSRVDiscover() - endpoints, err := discoverer.Discover(domain) + endpoints, err := discoverer.Discover(domain, srvName) if err != nil { return nil, errwrap.Wrapf("failed to discover etcd endpoints through SRV discovery: {{err}}", err) } diff --git a/physical/etcd/etcd2.go b/physical/etcd/etcd2.go index b8e84a417944..083d24f07665 100644 --- a/physical/etcd/etcd2.go +++ b/physical/etcd/etcd2.go @@ -12,11 +12,11 @@ import ( "time" metrics "github.com/armon/go-metrics" - "github.com/coreos/etcd/client" "github.com/coreos/etcd/pkg/transport" log "github.com/hashicorp/go-hclog" multierror "github.com/hashicorp/go-multierror" "github.com/hashicorp/vault/physical" + "go.etcd.io/etcd/client" ) const ( diff --git a/physical/etcd/etcd_test.go b/physical/etcd/etcd_test.go index 2d470c47ecc7..77a79ea0c37b 100644 --- a/physical/etcd/etcd_test.go +++ b/physical/etcd/etcd_test.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/vault/helper/logging" "github.com/hashicorp/vault/physical" - "github.com/coreos/etcd/client" + "go.etcd.io/etcd/client" ) func TestEtcdBackend(t *testing.T) { diff --git a/vendor/github.com/coreos/etcd/LICENSE b/vendor/github.com/coreos/etcd/LICENSE deleted file mode 100644 index d64569567334..000000000000 --- a/vendor/github.com/coreos/etcd/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/coreos/etcd/NOTICE b/vendor/github.com/coreos/etcd/NOTICE deleted file mode 100644 index b39ddfa5cbde..000000000000 --- a/vendor/github.com/coreos/etcd/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -CoreOS Project -Copyright 2014 CoreOS, Inc - -This product includes software developed at CoreOS, Inc. -(http://www.coreos.com/). diff --git a/vendor/github.com/coreos/etcd/pkg/transport/doc.go b/vendor/github.com/coreos/etcd/pkg/transport/doc.go deleted file mode 100644 index 37658ce591a4..000000000000 --- a/vendor/github.com/coreos/etcd/pkg/transport/doc.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package transport implements various HTTP transport utilities based on Go -// net package. -package transport diff --git a/vendor/github.com/coreos/etcd/pkg/transport/keepalive_listener.go b/vendor/github.com/coreos/etcd/pkg/transport/keepalive_listener.go deleted file mode 100644 index 4ff8e7f0010c..000000000000 --- a/vendor/github.com/coreos/etcd/pkg/transport/keepalive_listener.go +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transport - -import ( - "crypto/tls" - "fmt" - "net" - "time" -) - -type keepAliveConn interface { - SetKeepAlive(bool) error - SetKeepAlivePeriod(d time.Duration) error -} - -// NewKeepAliveListener returns a listener that listens on the given address. -// Be careful when wrap around KeepAliveListener with another Listener if TLSInfo is not nil. -// Some pkgs (like go/http) might expect Listener to return TLSConn type to start TLS handshake. -// http://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html -func NewKeepAliveListener(l net.Listener, scheme string, tlscfg *tls.Config) (net.Listener, error) { - if scheme == "https" { - if tlscfg == nil { - return nil, fmt.Errorf("cannot listen on TLS for given listener: KeyFile and CertFile are not presented") - } - return newTLSKeepaliveListener(l, tlscfg), nil - } - - return &keepaliveListener{ - Listener: l, - }, nil -} - -type keepaliveListener struct{ net.Listener } - -func (kln *keepaliveListener) Accept() (net.Conn, error) { - c, err := kln.Listener.Accept() - if err != nil { - return nil, err - } - kac := c.(keepAliveConn) - // detection time: tcp_keepalive_time + tcp_keepalive_probes + tcp_keepalive_intvl - // default on linux: 30 + 8 * 30 - // default on osx: 30 + 8 * 75 - kac.SetKeepAlive(true) - kac.SetKeepAlivePeriod(30 * time.Second) - return c, nil -} - -// A tlsKeepaliveListener implements a network listener (net.Listener) for TLS connections. -type tlsKeepaliveListener struct { - net.Listener - config *tls.Config -} - -// Accept waits for and returns the next incoming TLS connection. -// The returned connection c is a *tls.Conn. -func (l *tlsKeepaliveListener) Accept() (c net.Conn, err error) { - c, err = l.Listener.Accept() - if err != nil { - return - } - kac := c.(keepAliveConn) - // detection time: tcp_keepalive_time + tcp_keepalive_probes + tcp_keepalive_intvl - // default on linux: 30 + 8 * 30 - // default on osx: 30 + 8 * 75 - kac.SetKeepAlive(true) - kac.SetKeepAlivePeriod(30 * time.Second) - c = tls.Server(c, l.config) - return c, nil -} - -// NewListener creates a Listener which accepts connections from an inner -// Listener and wraps each connection with Server. -// The configuration config must be non-nil and must have -// at least one certificate. -func newTLSKeepaliveListener(inner net.Listener, config *tls.Config) net.Listener { - l := &tlsKeepaliveListener{} - l.Listener = inner - l.config = config - return l -} diff --git a/vendor/github.com/coreos/etcd/pkg/transport/limit_listen.go b/vendor/github.com/coreos/etcd/pkg/transport/limit_listen.go deleted file mode 100644 index 930c542066f8..000000000000 --- a/vendor/github.com/coreos/etcd/pkg/transport/limit_listen.go +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2013 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package transport provides network utility functions, complementing the more -// common ones in the net package. -package transport - -import ( - "errors" - "net" - "sync" - "time" -) - -var ( - ErrNotTCP = errors.New("only tcp connections have keepalive") -) - -// LimitListener returns a Listener that accepts at most n simultaneous -// connections from the provided Listener. -func LimitListener(l net.Listener, n int) net.Listener { - return &limitListener{l, make(chan struct{}, n)} -} - -type limitListener struct { - net.Listener - sem chan struct{} -} - -func (l *limitListener) acquire() { l.sem <- struct{}{} } -func (l *limitListener) release() { <-l.sem } - -func (l *limitListener) Accept() (net.Conn, error) { - l.acquire() - c, err := l.Listener.Accept() - if err != nil { - l.release() - return nil, err - } - return &limitListenerConn{Conn: c, release: l.release}, nil -} - -type limitListenerConn struct { - net.Conn - releaseOnce sync.Once - release func() -} - -func (l *limitListenerConn) Close() error { - err := l.Conn.Close() - l.releaseOnce.Do(l.release) - return err -} - -func (l *limitListenerConn) SetKeepAlive(doKeepAlive bool) error { - tcpc, ok := l.Conn.(*net.TCPConn) - if !ok { - return ErrNotTCP - } - return tcpc.SetKeepAlive(doKeepAlive) -} - -func (l *limitListenerConn) SetKeepAlivePeriod(d time.Duration) error { - tcpc, ok := l.Conn.(*net.TCPConn) - if !ok { - return ErrNotTCP - } - return tcpc.SetKeepAlivePeriod(d) -} diff --git a/vendor/github.com/coreos/etcd/pkg/transport/listener.go b/vendor/github.com/coreos/etcd/pkg/transport/listener.go deleted file mode 100644 index 620b9e790506..000000000000 --- a/vendor/github.com/coreos/etcd/pkg/transport/listener.go +++ /dev/null @@ -1,391 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transport - -import ( - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rand" - "crypto/tls" - "crypto/x509" - "crypto/x509/pkix" - "encoding/pem" - "errors" - "fmt" - "math/big" - "net" - "os" - "path/filepath" - "strings" - "time" - - "go.etcd.io/etcd/pkg/tlsutil" - - "go.uber.org/zap" -) - -// NewListener creates a new listner. -func NewListener(addr, scheme string, tlsinfo *TLSInfo) (l net.Listener, err error) { - if l, err = newListener(addr, scheme); err != nil { - return nil, err - } - return wrapTLS(scheme, tlsinfo, l) -} - -func newListener(addr string, scheme string) (net.Listener, error) { - if scheme == "unix" || scheme == "unixs" { - // unix sockets via unix://laddr - return NewUnixListener(addr) - } - return net.Listen("tcp", addr) -} - -func wrapTLS(scheme string, tlsinfo *TLSInfo, l net.Listener) (net.Listener, error) { - if scheme != "https" && scheme != "unixs" { - return l, nil - } - return newTLSListener(l, tlsinfo, checkSAN) -} - -type TLSInfo struct { - CertFile string - KeyFile string - TrustedCAFile string - ClientCertAuth bool - CRLFile string - InsecureSkipVerify bool - - // ServerName ensures the cert matches the given host in case of discovery / virtual hosting - ServerName string - - // HandshakeFailure is optionally called when a connection fails to handshake. The - // connection will be closed immediately afterwards. - HandshakeFailure func(*tls.Conn, error) - - // CipherSuites is a list of supported cipher suites. - // If empty, Go auto-populates it by default. - // Note that cipher suites are prioritized in the given order. - CipherSuites []uint16 - - selfCert bool - - // parseFunc exists to simplify testing. Typically, parseFunc - // should be left nil. In that case, tls.X509KeyPair will be used. - parseFunc func([]byte, []byte) (tls.Certificate, error) - - // AllowedCN is a CN which must be provided by a client. - AllowedCN string - - // Logger logs TLS errors. - // If nil, all logs are discarded. - Logger *zap.Logger -} - -func (info TLSInfo) String() string { - return fmt.Sprintf("cert = %s, key = %s, trusted-ca = %s, client-cert-auth = %v, crl-file = %s", info.CertFile, info.KeyFile, info.TrustedCAFile, info.ClientCertAuth, info.CRLFile) -} - -func (info TLSInfo) Empty() bool { - return info.CertFile == "" && info.KeyFile == "" -} - -func SelfCert(lg *zap.Logger, dirpath string, hosts []string) (info TLSInfo, err error) { - if err = os.MkdirAll(dirpath, 0700); err != nil { - return - } - info.Logger = lg - - certPath := filepath.Join(dirpath, "cert.pem") - keyPath := filepath.Join(dirpath, "key.pem") - _, errcert := os.Stat(certPath) - _, errkey := os.Stat(keyPath) - if errcert == nil && errkey == nil { - info.CertFile = certPath - info.KeyFile = keyPath - info.selfCert = true - return - } - - serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) - serialNumber, err := rand.Int(rand.Reader, serialNumberLimit) - if err != nil { - if info.Logger != nil { - info.Logger.Warn( - "cannot generate random number", - zap.Error(err), - ) - } - return - } - - tmpl := x509.Certificate{ - SerialNumber: serialNumber, - Subject: pkix.Name{Organization: []string{"etcd"}}, - NotBefore: time.Now(), - NotAfter: time.Now().Add(365 * (24 * time.Hour)), - - KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, - BasicConstraintsValid: true, - } - - for _, host := range hosts { - h, _, _ := net.SplitHostPort(host) - if ip := net.ParseIP(h); ip != nil { - tmpl.IPAddresses = append(tmpl.IPAddresses, ip) - } else { - tmpl.DNSNames = append(tmpl.DNSNames, h) - } - } - - priv, err := ecdsa.GenerateKey(elliptic.P521(), rand.Reader) - if err != nil { - if info.Logger != nil { - info.Logger.Warn( - "cannot generate ECDSA key", - zap.Error(err), - ) - } - return - } - - derBytes, err := x509.CreateCertificate(rand.Reader, &tmpl, &tmpl, &priv.PublicKey, priv) - if err != nil { - if info.Logger != nil { - info.Logger.Warn( - "cannot generate x509 certificate", - zap.Error(err), - ) - } - return - } - - certOut, err := os.Create(certPath) - if err != nil { - info.Logger.Warn( - "cannot cert file", - zap.String("path", certPath), - zap.Error(err), - ) - return - } - pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}) - certOut.Close() - if info.Logger != nil { - info.Logger.Info("created cert file", zap.String("path", certPath)) - } - - b, err := x509.MarshalECPrivateKey(priv) - if err != nil { - return - } - keyOut, err := os.OpenFile(keyPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) - if err != nil { - if info.Logger != nil { - info.Logger.Warn( - "cannot key file", - zap.String("path", keyPath), - zap.Error(err), - ) - } - return - } - pem.Encode(keyOut, &pem.Block{Type: "EC PRIVATE KEY", Bytes: b}) - keyOut.Close() - if info.Logger != nil { - info.Logger.Info("created key file", zap.String("path", keyPath)) - } - return SelfCert(lg, dirpath, hosts) -} - -// baseConfig is called on initial TLS handshake start. -// -// Previously, -// 1. Server has non-empty (*tls.Config).Certificates on client hello -// 2. Server calls (*tls.Config).GetCertificate iff: -// - Server's (*tls.Config).Certificates is not empty, or -// - Client supplies SNI; non-empty (*tls.ClientHelloInfo).ServerName -// -// When (*tls.Config).Certificates is always populated on initial handshake, -// client is expected to provide a valid matching SNI to pass the TLS -// verification, thus trigger server (*tls.Config).GetCertificate to reload -// TLS assets. However, a cert whose SAN field does not include domain names -// but only IP addresses, has empty (*tls.ClientHelloInfo).ServerName, thus -// it was never able to trigger TLS reload on initial handshake; first -// ceritifcate object was being used, never being updated. -// -// Now, (*tls.Config).Certificates is created empty on initial TLS client -// handshake, in order to trigger (*tls.Config).GetCertificate and populate -// rest of the certificates on every new TLS connection, even when client -// SNI is empty (e.g. cert only includes IPs). -func (info TLSInfo) baseConfig() (*tls.Config, error) { - if info.KeyFile == "" || info.CertFile == "" { - return nil, fmt.Errorf("KeyFile and CertFile must both be present[key: %v, cert: %v]", info.KeyFile, info.CertFile) - } - if info.Logger == nil { - info.Logger = zap.NewNop() - } - - _, err := tlsutil.NewCert(info.CertFile, info.KeyFile, info.parseFunc) - if err != nil { - return nil, err - } - - cfg := &tls.Config{ - MinVersion: tls.VersionTLS12, - ServerName: info.ServerName, - } - - if len(info.CipherSuites) > 0 { - cfg.CipherSuites = info.CipherSuites - } - - if info.AllowedCN != "" { - cfg.VerifyPeerCertificate = func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error { - for _, chains := range verifiedChains { - if len(chains) != 0 { - if info.AllowedCN == chains[0].Subject.CommonName { - return nil - } - } - } - return errors.New("CommonName authentication failed") - } - } - - // this only reloads certs when there's a client request - // TODO: support server-side refresh (e.g. inotify, SIGHUP), caching - cfg.GetCertificate = func(clientHello *tls.ClientHelloInfo) (cert *tls.Certificate, err error) { - cert, err = tlsutil.NewCert(info.CertFile, info.KeyFile, info.parseFunc) - if os.IsNotExist(err) { - if info.Logger != nil { - info.Logger.Warn( - "failed to find peer cert files", - zap.String("cert-file", info.CertFile), - zap.String("key-file", info.KeyFile), - zap.Error(err), - ) - } - } else if err != nil { - if info.Logger != nil { - info.Logger.Warn( - "failed to create peer certificate", - zap.String("cert-file", info.CertFile), - zap.String("key-file", info.KeyFile), - zap.Error(err), - ) - } - } - return cert, err - } - cfg.GetClientCertificate = func(unused *tls.CertificateRequestInfo) (cert *tls.Certificate, err error) { - cert, err = tlsutil.NewCert(info.CertFile, info.KeyFile, info.parseFunc) - if os.IsNotExist(err) { - if info.Logger != nil { - info.Logger.Warn( - "failed to find client cert files", - zap.String("cert-file", info.CertFile), - zap.String("key-file", info.KeyFile), - zap.Error(err), - ) - } - } else if err != nil { - if info.Logger != nil { - info.Logger.Warn( - "failed to create client certificate", - zap.String("cert-file", info.CertFile), - zap.String("key-file", info.KeyFile), - zap.Error(err), - ) - } - } - return cert, err - } - return cfg, nil -} - -// cafiles returns a list of CA file paths. -func (info TLSInfo) cafiles() []string { - cs := make([]string, 0) - if info.TrustedCAFile != "" { - cs = append(cs, info.TrustedCAFile) - } - return cs -} - -// ServerConfig generates a tls.Config object for use by an HTTP server. -func (info TLSInfo) ServerConfig() (*tls.Config, error) { - cfg, err := info.baseConfig() - if err != nil { - return nil, err - } - - cfg.ClientAuth = tls.NoClientCert - if info.TrustedCAFile != "" || info.ClientCertAuth { - cfg.ClientAuth = tls.RequireAndVerifyClientCert - } - - cs := info.cafiles() - if len(cs) > 0 { - cp, err := tlsutil.NewCertPool(cs) - if err != nil { - return nil, err - } - cfg.ClientCAs = cp - } - - // "h2" NextProtos is necessary for enabling HTTP2 for go's HTTP server - cfg.NextProtos = []string{"h2"} - - return cfg, nil -} - -// ClientConfig generates a tls.Config object for use by an HTTP client. -func (info TLSInfo) ClientConfig() (*tls.Config, error) { - var cfg *tls.Config - var err error - - if !info.Empty() { - cfg, err = info.baseConfig() - if err != nil { - return nil, err - } - } else { - cfg = &tls.Config{ServerName: info.ServerName} - } - cfg.InsecureSkipVerify = info.InsecureSkipVerify - - cs := info.cafiles() - if len(cs) > 0 { - cfg.RootCAs, err = tlsutil.NewCertPool(cs) - if err != nil { - return nil, err - } - } - - if info.selfCert { - cfg.InsecureSkipVerify = true - } - return cfg, nil -} - -// IsClosedConnError returns true if the error is from closing listener, cmux. -// copied from golang.org/x/net/http2/http2.go -func IsClosedConnError(err error) bool { - // 'use of closed network connection' (Go <=1.8) - // 'use of closed file or network connection' (Go >1.8, internal/poll.ErrClosing) - // 'mux: listener closed' (cmux.ErrListenerClosed) - return err != nil && strings.Contains(err.Error(), "closed") -} diff --git a/vendor/github.com/coreos/etcd/pkg/transport/listener_tls.go b/vendor/github.com/coreos/etcd/pkg/transport/listener_tls.go deleted file mode 100644 index 6f1600945cc6..000000000000 --- a/vendor/github.com/coreos/etcd/pkg/transport/listener_tls.go +++ /dev/null @@ -1,272 +0,0 @@ -// Copyright 2017 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transport - -import ( - "context" - "crypto/tls" - "crypto/x509" - "fmt" - "io/ioutil" - "net" - "strings" - "sync" -) - -// tlsListener overrides a TLS listener so it will reject client -// certificates with insufficient SAN credentials or CRL revoked -// certificates. -type tlsListener struct { - net.Listener - connc chan net.Conn - donec chan struct{} - err error - handshakeFailure func(*tls.Conn, error) - check tlsCheckFunc -} - -type tlsCheckFunc func(context.Context, *tls.Conn) error - -// NewTLSListener handshakes TLS connections and performs optional CRL checking. -func NewTLSListener(l net.Listener, tlsinfo *TLSInfo) (net.Listener, error) { - check := func(context.Context, *tls.Conn) error { return nil } - return newTLSListener(l, tlsinfo, check) -} - -func newTLSListener(l net.Listener, tlsinfo *TLSInfo, check tlsCheckFunc) (net.Listener, error) { - if tlsinfo == nil || tlsinfo.Empty() { - l.Close() - return nil, fmt.Errorf("cannot listen on TLS for %s: KeyFile and CertFile are not presented", l.Addr().String()) - } - tlscfg, err := tlsinfo.ServerConfig() - if err != nil { - return nil, err - } - - hf := tlsinfo.HandshakeFailure - if hf == nil { - hf = func(*tls.Conn, error) {} - } - - if len(tlsinfo.CRLFile) > 0 { - prevCheck := check - check = func(ctx context.Context, tlsConn *tls.Conn) error { - if err := prevCheck(ctx, tlsConn); err != nil { - return err - } - st := tlsConn.ConnectionState() - if certs := st.PeerCertificates; len(certs) > 0 { - return checkCRL(tlsinfo.CRLFile, certs) - } - return nil - } - } - - tlsl := &tlsListener{ - Listener: tls.NewListener(l, tlscfg), - connc: make(chan net.Conn), - donec: make(chan struct{}), - handshakeFailure: hf, - check: check, - } - go tlsl.acceptLoop() - return tlsl, nil -} - -func (l *tlsListener) Accept() (net.Conn, error) { - select { - case conn := <-l.connc: - return conn, nil - case <-l.donec: - return nil, l.err - } -} - -func checkSAN(ctx context.Context, tlsConn *tls.Conn) error { - st := tlsConn.ConnectionState() - if certs := st.PeerCertificates; len(certs) > 0 { - addr := tlsConn.RemoteAddr().String() - return checkCertSAN(ctx, certs[0], addr) - } - return nil -} - -// acceptLoop launches each TLS handshake in a separate goroutine -// to prevent a hanging TLS connection from blocking other connections. -func (l *tlsListener) acceptLoop() { - var wg sync.WaitGroup - var pendingMu sync.Mutex - - pending := make(map[net.Conn]struct{}) - ctx, cancel := context.WithCancel(context.Background()) - defer func() { - cancel() - pendingMu.Lock() - for c := range pending { - c.Close() - } - pendingMu.Unlock() - wg.Wait() - close(l.donec) - }() - - for { - conn, err := l.Listener.Accept() - if err != nil { - l.err = err - return - } - - pendingMu.Lock() - pending[conn] = struct{}{} - pendingMu.Unlock() - - wg.Add(1) - go func() { - defer func() { - if conn != nil { - conn.Close() - } - wg.Done() - }() - - tlsConn := conn.(*tls.Conn) - herr := tlsConn.Handshake() - pendingMu.Lock() - delete(pending, conn) - pendingMu.Unlock() - - if herr != nil { - l.handshakeFailure(tlsConn, herr) - return - } - if err := l.check(ctx, tlsConn); err != nil { - l.handshakeFailure(tlsConn, err) - return - } - - select { - case l.connc <- tlsConn: - conn = nil - case <-ctx.Done(): - } - }() - } -} - -func checkCRL(crlPath string, cert []*x509.Certificate) error { - // TODO: cache - crlBytes, err := ioutil.ReadFile(crlPath) - if err != nil { - return err - } - certList, err := x509.ParseCRL(crlBytes) - if err != nil { - return err - } - revokedSerials := make(map[string]struct{}) - for _, rc := range certList.TBSCertList.RevokedCertificates { - revokedSerials[string(rc.SerialNumber.Bytes())] = struct{}{} - } - for _, c := range cert { - serial := string(c.SerialNumber.Bytes()) - if _, ok := revokedSerials[serial]; ok { - return fmt.Errorf("transport: certificate serial %x revoked", serial) - } - } - return nil -} - -func checkCertSAN(ctx context.Context, cert *x509.Certificate, remoteAddr string) error { - if len(cert.IPAddresses) == 0 && len(cert.DNSNames) == 0 { - return nil - } - h, _, herr := net.SplitHostPort(remoteAddr) - if herr != nil { - return herr - } - if len(cert.IPAddresses) > 0 { - cerr := cert.VerifyHostname(h) - if cerr == nil { - return nil - } - if len(cert.DNSNames) == 0 { - return cerr - } - } - if len(cert.DNSNames) > 0 { - ok, err := isHostInDNS(ctx, h, cert.DNSNames) - if ok { - return nil - } - errStr := "" - if err != nil { - errStr = " (" + err.Error() + ")" - } - return fmt.Errorf("tls: %q does not match any of DNSNames %q"+errStr, h, cert.DNSNames) - } - return nil -} - -func isHostInDNS(ctx context.Context, host string, dnsNames []string) (ok bool, err error) { - // reverse lookup - wildcards, names := []string{}, []string{} - for _, dns := range dnsNames { - if strings.HasPrefix(dns, "*.") { - wildcards = append(wildcards, dns[1:]) - } else { - names = append(names, dns) - } - } - lnames, lerr := net.DefaultResolver.LookupAddr(ctx, host) - for _, name := range lnames { - // strip trailing '.' from PTR record - if name[len(name)-1] == '.' { - name = name[:len(name)-1] - } - for _, wc := range wildcards { - if strings.HasSuffix(name, wc) { - return true, nil - } - } - for _, n := range names { - if n == name { - return true, nil - } - } - } - err = lerr - - // forward lookup - for _, dns := range names { - addrs, lerr := net.DefaultResolver.LookupHost(ctx, dns) - if lerr != nil { - err = lerr - continue - } - for _, addr := range addrs { - if addr == host { - return true, nil - } - } - } - return false, err -} - -func (l *tlsListener) Close() error { - err := l.Listener.Close() - <-l.donec - return err -} diff --git a/vendor/github.com/coreos/etcd/pkg/transport/timeout_conn.go b/vendor/github.com/coreos/etcd/pkg/transport/timeout_conn.go deleted file mode 100644 index 7e8c02030fed..000000000000 --- a/vendor/github.com/coreos/etcd/pkg/transport/timeout_conn.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transport - -import ( - "net" - "time" -) - -type timeoutConn struct { - net.Conn - wtimeoutd time.Duration - rdtimeoutd time.Duration -} - -func (c timeoutConn) Write(b []byte) (n int, err error) { - if c.wtimeoutd > 0 { - if err := c.SetWriteDeadline(time.Now().Add(c.wtimeoutd)); err != nil { - return 0, err - } - } - return c.Conn.Write(b) -} - -func (c timeoutConn) Read(b []byte) (n int, err error) { - if c.rdtimeoutd > 0 { - if err := c.SetReadDeadline(time.Now().Add(c.rdtimeoutd)); err != nil { - return 0, err - } - } - return c.Conn.Read(b) -} diff --git a/vendor/github.com/coreos/etcd/pkg/transport/timeout_listener.go b/vendor/github.com/coreos/etcd/pkg/transport/timeout_listener.go deleted file mode 100644 index 273e99fe038d..000000000000 --- a/vendor/github.com/coreos/etcd/pkg/transport/timeout_listener.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transport - -import ( - "net" - "time" -) - -// NewTimeoutListener returns a listener that listens on the given address. -// If read/write on the accepted connection blocks longer than its time limit, -// it will return timeout error. -func NewTimeoutListener(addr string, scheme string, tlsinfo *TLSInfo, rdtimeoutd, wtimeoutd time.Duration) (net.Listener, error) { - ln, err := newListener(addr, scheme) - if err != nil { - return nil, err - } - ln = &rwTimeoutListener{ - Listener: ln, - rdtimeoutd: rdtimeoutd, - wtimeoutd: wtimeoutd, - } - if ln, err = wrapTLS(scheme, tlsinfo, ln); err != nil { - return nil, err - } - return ln, nil -} - -type rwTimeoutListener struct { - net.Listener - wtimeoutd time.Duration - rdtimeoutd time.Duration -} - -func (rwln *rwTimeoutListener) Accept() (net.Conn, error) { - c, err := rwln.Listener.Accept() - if err != nil { - return nil, err - } - return timeoutConn{ - Conn: c, - wtimeoutd: rwln.wtimeoutd, - rdtimeoutd: rwln.rdtimeoutd, - }, nil -} diff --git a/vendor/github.com/coreos/etcd/pkg/transport/timeout_transport.go b/vendor/github.com/coreos/etcd/pkg/transport/timeout_transport.go deleted file mode 100644 index ea16b4c0f869..000000000000 --- a/vendor/github.com/coreos/etcd/pkg/transport/timeout_transport.go +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transport - -import ( - "net" - "net/http" - "time" -) - -// NewTimeoutTransport returns a transport created using the given TLS info. -// If read/write on the created connection blocks longer than its time limit, -// it will return timeout error. -// If read/write timeout is set, transport will not be able to reuse connection. -func NewTimeoutTransport(info TLSInfo, dialtimeoutd, rdtimeoutd, wtimeoutd time.Duration) (*http.Transport, error) { - tr, err := NewTransport(info, dialtimeoutd) - if err != nil { - return nil, err - } - - if rdtimeoutd != 0 || wtimeoutd != 0 { - // the timed out connection will timeout soon after it is idle. - // it should not be put back to http transport as an idle connection for future usage. - tr.MaxIdleConnsPerHost = -1 - } else { - // allow more idle connections between peers to avoid unnecessary port allocation. - tr.MaxIdleConnsPerHost = 1024 - } - - tr.Dial = (&rwTimeoutDialer{ - Dialer: net.Dialer{ - Timeout: dialtimeoutd, - KeepAlive: 30 * time.Second, - }, - rdtimeoutd: rdtimeoutd, - wtimeoutd: wtimeoutd, - }).Dial - return tr, nil -} diff --git a/vendor/github.com/coreos/etcd/pkg/transport/tls.go b/vendor/github.com/coreos/etcd/pkg/transport/tls.go deleted file mode 100644 index 62fe0d385195..000000000000 --- a/vendor/github.com/coreos/etcd/pkg/transport/tls.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transport - -import ( - "fmt" - "strings" - "time" -) - -// ValidateSecureEndpoints scans the given endpoints against tls info, returning only those -// endpoints that could be validated as secure. -func ValidateSecureEndpoints(tlsInfo TLSInfo, eps []string) ([]string, error) { - t, err := NewTransport(tlsInfo, 5*time.Second) - if err != nil { - return nil, err - } - var errs []string - var endpoints []string - for _, ep := range eps { - if !strings.HasPrefix(ep, "https://") { - errs = append(errs, fmt.Sprintf("%q is insecure", ep)) - continue - } - conn, cerr := t.Dial("tcp", ep[len("https://"):]) - if cerr != nil { - errs = append(errs, fmt.Sprintf("%q failed to dial (%v)", ep, cerr)) - continue - } - conn.Close() - endpoints = append(endpoints, ep) - } - if len(errs) != 0 { - err = fmt.Errorf("%s", strings.Join(errs, ",")) - } - return endpoints, err -} diff --git a/vendor/github.com/coreos/etcd/pkg/transport/transport.go b/vendor/github.com/coreos/etcd/pkg/transport/transport.go deleted file mode 100644 index 4a7fe69d2e19..000000000000 --- a/vendor/github.com/coreos/etcd/pkg/transport/transport.go +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transport - -import ( - "net" - "net/http" - "strings" - "time" -) - -type unixTransport struct{ *http.Transport } - -func NewTransport(info TLSInfo, dialtimeoutd time.Duration) (*http.Transport, error) { - cfg, err := info.ClientConfig() - if err != nil { - return nil, err - } - - t := &http.Transport{ - Proxy: http.ProxyFromEnvironment, - Dial: (&net.Dialer{ - Timeout: dialtimeoutd, - // value taken from http.DefaultTransport - KeepAlive: 30 * time.Second, - }).Dial, - // value taken from http.DefaultTransport - TLSHandshakeTimeout: 10 * time.Second, - TLSClientConfig: cfg, - } - - dialer := (&net.Dialer{ - Timeout: dialtimeoutd, - KeepAlive: 30 * time.Second, - }) - dial := func(net, addr string) (net.Conn, error) { - return dialer.Dial("unix", addr) - } - - tu := &http.Transport{ - Proxy: http.ProxyFromEnvironment, - Dial: dial, - TLSHandshakeTimeout: 10 * time.Second, - TLSClientConfig: cfg, - } - ut := &unixTransport{tu} - - t.RegisterProtocol("unix", ut) - t.RegisterProtocol("unixs", ut) - - return t, nil -} - -func (urt *unixTransport) RoundTrip(req *http.Request) (*http.Response, error) { - url := *req.URL - req.URL = &url - req.URL.Scheme = strings.Replace(req.URL.Scheme, "unix", "http", 1) - return urt.Transport.RoundTrip(req) -} diff --git a/vendor/github.com/coreos/etcd/pkg/transport/unix_listener.go b/vendor/github.com/coreos/etcd/pkg/transport/unix_listener.go deleted file mode 100644 index 123e2036f0f0..000000000000 --- a/vendor/github.com/coreos/etcd/pkg/transport/unix_listener.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transport - -import ( - "net" - "os" -) - -type unixListener struct{ net.Listener } - -func NewUnixListener(addr string) (net.Listener, error) { - if err := os.Remove(addr); err != nil && !os.IsNotExist(err) { - return nil, err - } - l, err := net.Listen("unix", addr) - if err != nil { - return nil, err - } - return &unixListener{l}, nil -} - -func (ul *unixListener) Close() error { - if err := os.Remove(ul.Addr().String()); err != nil && !os.IsNotExist(err) { - return err - } - return ul.Listener.Close() -} diff --git a/vendor/github.com/coreos/etcd/client/README.md b/vendor/go.etcd.io/etcd/client/README.md similarity index 100% rename from vendor/github.com/coreos/etcd/client/README.md rename to vendor/go.etcd.io/etcd/client/README.md diff --git a/vendor/github.com/coreos/etcd/client/auth_role.go b/vendor/go.etcd.io/etcd/client/auth_role.go similarity index 100% rename from vendor/github.com/coreos/etcd/client/auth_role.go rename to vendor/go.etcd.io/etcd/client/auth_role.go diff --git a/vendor/github.com/coreos/etcd/client/auth_user.go b/vendor/go.etcd.io/etcd/client/auth_user.go similarity index 100% rename from vendor/github.com/coreos/etcd/client/auth_user.go rename to vendor/go.etcd.io/etcd/client/auth_user.go diff --git a/vendor/github.com/coreos/etcd/client/cancelreq.go b/vendor/go.etcd.io/etcd/client/cancelreq.go similarity index 100% rename from vendor/github.com/coreos/etcd/client/cancelreq.go rename to vendor/go.etcd.io/etcd/client/cancelreq.go diff --git a/vendor/github.com/coreos/etcd/client/client.go b/vendor/go.etcd.io/etcd/client/client.go similarity index 100% rename from vendor/github.com/coreos/etcd/client/client.go rename to vendor/go.etcd.io/etcd/client/client.go diff --git a/vendor/github.com/coreos/etcd/client/cluster_error.go b/vendor/go.etcd.io/etcd/client/cluster_error.go similarity index 100% rename from vendor/github.com/coreos/etcd/client/cluster_error.go rename to vendor/go.etcd.io/etcd/client/cluster_error.go diff --git a/vendor/github.com/coreos/etcd/client/curl.go b/vendor/go.etcd.io/etcd/client/curl.go similarity index 100% rename from vendor/github.com/coreos/etcd/client/curl.go rename to vendor/go.etcd.io/etcd/client/curl.go diff --git a/vendor/github.com/coreos/etcd/client/discover.go b/vendor/go.etcd.io/etcd/client/discover.go similarity index 83% rename from vendor/github.com/coreos/etcd/client/discover.go rename to vendor/go.etcd.io/etcd/client/discover.go index 30473148b0a6..580c25626c98 100644 --- a/vendor/github.com/coreos/etcd/client/discover.go +++ b/vendor/go.etcd.io/etcd/client/discover.go @@ -21,7 +21,7 @@ import ( // Discoverer is an interface that wraps the Discover method. type Discoverer interface { // Discover looks up the etcd servers for the domain. - Discover(domain string) ([]string, error) + Discover(domain string, serviceName string) ([]string, error) } type srvDiscover struct{} @@ -31,8 +31,8 @@ func NewSRVDiscover() Discoverer { return &srvDiscover{} } -func (d *srvDiscover) Discover(domain string) ([]string, error) { - srvs, err := srv.GetClient("etcd-client", domain) +func (d *srvDiscover) Discover(domain string, serviceName string) ([]string, error) { + srvs, err := srv.GetClient("etcd-client", domain, serviceName) if err != nil { return nil, err } diff --git a/vendor/github.com/coreos/etcd/client/doc.go b/vendor/go.etcd.io/etcd/client/doc.go similarity index 100% rename from vendor/github.com/coreos/etcd/client/doc.go rename to vendor/go.etcd.io/etcd/client/doc.go diff --git a/vendor/github.com/coreos/etcd/client/keys.generated.go b/vendor/go.etcd.io/etcd/client/keys.generated.go similarity index 87% rename from vendor/github.com/coreos/etcd/client/keys.generated.go rename to vendor/go.etcd.io/etcd/client/keys.generated.go index 1c65c1b087d9..58420c640b31 100644 --- a/vendor/github.com/coreos/etcd/client/keys.generated.go +++ b/vendor/go.etcd.io/etcd/client/keys.generated.go @@ -13,23 +13,23 @@ import ( const ( // ----- content types ---- - codecSelferCcUTF86628 = 1 - codecSelferCcRAW6628 = 0 + codecSelferCcUTF88411 = 1 + codecSelferCcRAW8411 = 0 // ----- value types used ---- - codecSelferValueTypeArray6628 = 10 - codecSelferValueTypeMap6628 = 9 - codecSelferValueTypeString6628 = 6 - codecSelferValueTypeInt6628 = 2 - codecSelferValueTypeUint6628 = 3 - codecSelferValueTypeFloat6628 = 4 - codecSelferBitsize6628 = uint8(32 << (^uint(0) >> 63)) + codecSelferValueTypeArray8411 = 10 + codecSelferValueTypeMap8411 = 9 + codecSelferValueTypeString8411 = 6 + codecSelferValueTypeInt8411 = 2 + codecSelferValueTypeUint8411 = 3 + codecSelferValueTypeFloat8411 = 4 + codecSelferBitsize8411 = uint8(32 << (^uint(0) >> 63)) ) var ( - errCodecSelferOnlyMapOrArrayEncodeToStruct6628 = errors.New(`only encoded map or array can be decoded into a struct`) + errCodecSelferOnlyMapOrArrayEncodeToStruct8411 = errors.New(`only encoded map or array can be decoded into a struct`) ) -type codecSelfer6628 struct{} +type codecSelfer8411 struct{} func init() { if codec1978.GenVersion != 8 { @@ -43,7 +43,7 @@ func init() { } func (x *Error) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { @@ -70,7 +70,7 @@ func (x *Error) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `errorCode`) + r.EncodeString(codecSelferCcUTF88411, `errorCode`) r.WriteMapElemValue() if false { } else { @@ -81,30 +81,30 @@ func (x *Error) CodecEncodeSelf(e *codec1978.Encoder) { r.WriteArrayElem() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Message)) + r.EncodeString(codecSelferCcUTF88411, string(x.Message)) } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `message`) + r.EncodeString(codecSelferCcUTF88411, `message`) r.WriteMapElemValue() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Message)) + r.EncodeString(codecSelferCcUTF88411, string(x.Message)) } } if yyr2 || yy2arr2 { r.WriteArrayElem() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Cause)) + r.EncodeString(codecSelferCcUTF88411, string(x.Cause)) } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `cause`) + r.EncodeString(codecSelferCcUTF88411, `cause`) r.WriteMapElemValue() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Cause)) + r.EncodeString(codecSelferCcUTF88411, string(x.Cause)) } } if yyr2 || yy2arr2 { @@ -115,7 +115,7 @@ func (x *Error) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `index`) + r.EncodeString(codecSelferCcUTF88411, `index`) r.WriteMapElemValue() if false { } else { @@ -132,7 +132,7 @@ func (x *Error) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *Error) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r if false { @@ -140,14 +140,14 @@ func (x *Error) CodecDecodeSelf(d *codec1978.Decoder) { z.DecExtension(x, yyxt1) } else { yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap6628 { + if yyct2 == codecSelferValueTypeMap8411 { yyl2 := r.ReadMapStart() if yyl2 == 0 { r.ReadMapEnd() } else { x.codecDecodeSelfFromMap(yyl2, d) } - } else if yyct2 == codecSelferValueTypeArray6628 { + } else if yyct2 == codecSelferValueTypeArray8411 { yyl2 := r.ReadArrayStart() if yyl2 == 0 { r.ReadArrayEnd() @@ -155,13 +155,13 @@ func (x *Error) CodecDecodeSelf(d *codec1978.Decoder) { x.codecDecodeSelfFromArray(yyl2, d) } } else { - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6628) + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct8411) } } } func (x *Error) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyhl3 bool = l >= 0 @@ -183,7 +183,7 @@ func (x *Error) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Code = 0 } else { - x.Code = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize6628)) + x.Code = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize8411)) } case "message": if r.TryDecodeAsNil() { @@ -211,7 +211,7 @@ func (x *Error) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } func (x *Error) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyj8 int @@ -231,7 +231,7 @@ func (x *Error) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Code = 0 } else { - x.Code = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize6628)) + x.Code = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize8411)) } yyj8++ if yyhl8 { @@ -298,19 +298,19 @@ func (x *Error) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } func (x PrevExistType) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if false { } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { z.EncExtension(x, yyxt1) } else { - r.EncodeString(codecSelferCcUTF86628, string(x)) + r.EncodeString(codecSelferCcUTF88411, string(x)) } } func (x *PrevExistType) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r if false { @@ -322,7 +322,7 @@ func (x *PrevExistType) CodecDecodeSelf(d *codec1978.Decoder) { } func (x *WatcherOptions) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { @@ -349,7 +349,7 @@ func (x *WatcherOptions) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `AfterIndex`) + r.EncodeString(codecSelferCcUTF88411, `AfterIndex`) r.WriteMapElemValue() if false { } else { @@ -364,7 +364,7 @@ func (x *WatcherOptions) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Recursive`) + r.EncodeString(codecSelferCcUTF88411, `Recursive`) r.WriteMapElemValue() if false { } else { @@ -381,7 +381,7 @@ func (x *WatcherOptions) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *WatcherOptions) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r if false { @@ -389,14 +389,14 @@ func (x *WatcherOptions) CodecDecodeSelf(d *codec1978.Decoder) { z.DecExtension(x, yyxt1) } else { yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap6628 { + if yyct2 == codecSelferValueTypeMap8411 { yyl2 := r.ReadMapStart() if yyl2 == 0 { r.ReadMapEnd() } else { x.codecDecodeSelfFromMap(yyl2, d) } - } else if yyct2 == codecSelferValueTypeArray6628 { + } else if yyct2 == codecSelferValueTypeArray8411 { yyl2 := r.ReadArrayStart() if yyl2 == 0 { r.ReadArrayEnd() @@ -404,13 +404,13 @@ func (x *WatcherOptions) CodecDecodeSelf(d *codec1978.Decoder) { x.codecDecodeSelfFromArray(yyl2, d) } } else { - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6628) + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct8411) } } } func (x *WatcherOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyhl3 bool = l >= 0 @@ -448,7 +448,7 @@ func (x *WatcherOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } func (x *WatcherOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyj6 int @@ -503,7 +503,7 @@ func (x *WatcherOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } func (x *CreateInOrderOptions) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { @@ -532,7 +532,7 @@ func (x *CreateInOrderOptions) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `TTL`) + r.EncodeString(codecSelferCcUTF88411, `TTL`) r.WriteMapElemValue() if false { } else if yyxt5 := z.Extension(z.I2Rtid(x.TTL)); yyxt5 != nil { @@ -551,7 +551,7 @@ func (x *CreateInOrderOptions) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *CreateInOrderOptions) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r if false { @@ -559,14 +559,14 @@ func (x *CreateInOrderOptions) CodecDecodeSelf(d *codec1978.Decoder) { z.DecExtension(x, yyxt1) } else { yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap6628 { + if yyct2 == codecSelferValueTypeMap8411 { yyl2 := r.ReadMapStart() if yyl2 == 0 { r.ReadMapEnd() } else { x.codecDecodeSelfFromMap(yyl2, d) } - } else if yyct2 == codecSelferValueTypeArray6628 { + } else if yyct2 == codecSelferValueTypeArray8411 { yyl2 := r.ReadArrayStart() if yyl2 == 0 { r.ReadArrayEnd() @@ -574,13 +574,13 @@ func (x *CreateInOrderOptions) CodecDecodeSelf(d *codec1978.Decoder) { x.codecDecodeSelfFromArray(yyl2, d) } } else { - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6628) + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct8411) } } } func (x *CreateInOrderOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyhl3 bool = l >= 0 @@ -617,7 +617,7 @@ func (x *CreateInOrderOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decode } func (x *CreateInOrderOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyj6 int @@ -661,7 +661,7 @@ func (x *CreateInOrderOptions) codecDecodeSelfFromArray(l int, d *codec1978.Deco } func (x *SetOptions) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { @@ -684,15 +684,15 @@ func (x *SetOptions) CodecEncodeSelf(e *codec1978.Encoder) { r.WriteArrayElem() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.PrevValue)) + r.EncodeString(codecSelferCcUTF88411, string(x.PrevValue)) } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `PrevValue`) + r.EncodeString(codecSelferCcUTF88411, `PrevValue`) r.WriteMapElemValue() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.PrevValue)) + r.EncodeString(codecSelferCcUTF88411, string(x.PrevValue)) } } if yyr2 || yy2arr2 { @@ -703,7 +703,7 @@ func (x *SetOptions) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `PrevIndex`) + r.EncodeString(codecSelferCcUTF88411, `PrevIndex`) r.WriteMapElemValue() if false { } else { @@ -715,7 +715,7 @@ func (x *SetOptions) CodecEncodeSelf(e *codec1978.Encoder) { x.PrevExist.CodecEncodeSelf(e) } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `PrevExist`) + r.EncodeString(codecSelferCcUTF88411, `PrevExist`) r.WriteMapElemValue() x.PrevExist.CodecEncodeSelf(e) } @@ -729,7 +729,7 @@ func (x *SetOptions) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `TTL`) + r.EncodeString(codecSelferCcUTF88411, `TTL`) r.WriteMapElemValue() if false { } else if yyxt14 := z.Extension(z.I2Rtid(x.TTL)); yyxt14 != nil { @@ -746,7 +746,7 @@ func (x *SetOptions) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Refresh`) + r.EncodeString(codecSelferCcUTF88411, `Refresh`) r.WriteMapElemValue() if false { } else { @@ -761,7 +761,7 @@ func (x *SetOptions) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Dir`) + r.EncodeString(codecSelferCcUTF88411, `Dir`) r.WriteMapElemValue() if false { } else { @@ -776,7 +776,7 @@ func (x *SetOptions) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `NoValueOnSuccess`) + r.EncodeString(codecSelferCcUTF88411, `NoValueOnSuccess`) r.WriteMapElemValue() if false { } else { @@ -793,7 +793,7 @@ func (x *SetOptions) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *SetOptions) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r if false { @@ -801,14 +801,14 @@ func (x *SetOptions) CodecDecodeSelf(d *codec1978.Decoder) { z.DecExtension(x, yyxt1) } else { yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap6628 { + if yyct2 == codecSelferValueTypeMap8411 { yyl2 := r.ReadMapStart() if yyl2 == 0 { r.ReadMapEnd() } else { x.codecDecodeSelfFromMap(yyl2, d) } - } else if yyct2 == codecSelferValueTypeArray6628 { + } else if yyct2 == codecSelferValueTypeArray8411 { yyl2 := r.ReadArrayStart() if yyl2 == 0 { r.ReadArrayEnd() @@ -816,13 +816,13 @@ func (x *SetOptions) CodecDecodeSelf(d *codec1978.Decoder) { x.codecDecodeSelfFromArray(yyl2, d) } } else { - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6628) + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct8411) } } } func (x *SetOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyhl3 bool = l >= 0 @@ -895,7 +895,7 @@ func (x *SetOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } func (x *SetOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyj12 int @@ -1035,7 +1035,7 @@ func (x *SetOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } func (x *GetOptions) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { @@ -1062,7 +1062,7 @@ func (x *GetOptions) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Recursive`) + r.EncodeString(codecSelferCcUTF88411, `Recursive`) r.WriteMapElemValue() if false { } else { @@ -1077,7 +1077,7 @@ func (x *GetOptions) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Sort`) + r.EncodeString(codecSelferCcUTF88411, `Sort`) r.WriteMapElemValue() if false { } else { @@ -1092,7 +1092,7 @@ func (x *GetOptions) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Quorum`) + r.EncodeString(codecSelferCcUTF88411, `Quorum`) r.WriteMapElemValue() if false { } else { @@ -1109,7 +1109,7 @@ func (x *GetOptions) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *GetOptions) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r if false { @@ -1117,14 +1117,14 @@ func (x *GetOptions) CodecDecodeSelf(d *codec1978.Decoder) { z.DecExtension(x, yyxt1) } else { yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap6628 { + if yyct2 == codecSelferValueTypeMap8411 { yyl2 := r.ReadMapStart() if yyl2 == 0 { r.ReadMapEnd() } else { x.codecDecodeSelfFromMap(yyl2, d) } - } else if yyct2 == codecSelferValueTypeArray6628 { + } else if yyct2 == codecSelferValueTypeArray8411 { yyl2 := r.ReadArrayStart() if yyl2 == 0 { r.ReadArrayEnd() @@ -1132,13 +1132,13 @@ func (x *GetOptions) CodecDecodeSelf(d *codec1978.Decoder) { x.codecDecodeSelfFromArray(yyl2, d) } } else { - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6628) + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct8411) } } } func (x *GetOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyhl3 bool = l >= 0 @@ -1182,7 +1182,7 @@ func (x *GetOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } func (x *GetOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyj7 int @@ -1253,7 +1253,7 @@ func (x *GetOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } func (x *DeleteOptions) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { @@ -1276,15 +1276,15 @@ func (x *DeleteOptions) CodecEncodeSelf(e *codec1978.Encoder) { r.WriteArrayElem() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.PrevValue)) + r.EncodeString(codecSelferCcUTF88411, string(x.PrevValue)) } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `PrevValue`) + r.EncodeString(codecSelferCcUTF88411, `PrevValue`) r.WriteMapElemValue() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.PrevValue)) + r.EncodeString(codecSelferCcUTF88411, string(x.PrevValue)) } } if yyr2 || yy2arr2 { @@ -1295,7 +1295,7 @@ func (x *DeleteOptions) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `PrevIndex`) + r.EncodeString(codecSelferCcUTF88411, `PrevIndex`) r.WriteMapElemValue() if false { } else { @@ -1310,7 +1310,7 @@ func (x *DeleteOptions) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Recursive`) + r.EncodeString(codecSelferCcUTF88411, `Recursive`) r.WriteMapElemValue() if false { } else { @@ -1325,7 +1325,7 @@ func (x *DeleteOptions) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Dir`) + r.EncodeString(codecSelferCcUTF88411, `Dir`) r.WriteMapElemValue() if false { } else { @@ -1342,7 +1342,7 @@ func (x *DeleteOptions) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *DeleteOptions) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r if false { @@ -1350,14 +1350,14 @@ func (x *DeleteOptions) CodecDecodeSelf(d *codec1978.Decoder) { z.DecExtension(x, yyxt1) } else { yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap6628 { + if yyct2 == codecSelferValueTypeMap8411 { yyl2 := r.ReadMapStart() if yyl2 == 0 { r.ReadMapEnd() } else { x.codecDecodeSelfFromMap(yyl2, d) } - } else if yyct2 == codecSelferValueTypeArray6628 { + } else if yyct2 == codecSelferValueTypeArray8411 { yyl2 := r.ReadArrayStart() if yyl2 == 0 { r.ReadArrayEnd() @@ -1365,13 +1365,13 @@ func (x *DeleteOptions) CodecDecodeSelf(d *codec1978.Decoder) { x.codecDecodeSelfFromArray(yyl2, d) } } else { - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6628) + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct8411) } } } func (x *DeleteOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyhl3 bool = l >= 0 @@ -1421,7 +1421,7 @@ func (x *DeleteOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } func (x *DeleteOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyj8 int @@ -1508,7 +1508,7 @@ func (x *DeleteOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } func (x *Response) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { @@ -1531,15 +1531,15 @@ func (x *Response) CodecEncodeSelf(e *codec1978.Encoder) { r.WriteArrayElem() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Action)) + r.EncodeString(codecSelferCcUTF88411, string(x.Action)) } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `action`) + r.EncodeString(codecSelferCcUTF88411, `action`) r.WriteMapElemValue() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Action)) + r.EncodeString(codecSelferCcUTF88411, string(x.Action)) } } var yyn6 bool @@ -1562,7 +1562,7 @@ func (x *Response) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `node`) + r.EncodeString(codecSelferCcUTF88411, `node`) r.WriteMapElemValue() if yyn6 { r.EncodeNil() @@ -1594,7 +1594,7 @@ func (x *Response) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `prevNode`) + r.EncodeString(codecSelferCcUTF88411, `prevNode`) r.WriteMapElemValue() if yyn9 { r.EncodeNil() @@ -1616,7 +1616,7 @@ func (x *Response) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *Response) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r if false { @@ -1624,14 +1624,14 @@ func (x *Response) CodecDecodeSelf(d *codec1978.Decoder) { z.DecExtension(x, yyxt1) } else { yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap6628 { + if yyct2 == codecSelferValueTypeMap8411 { yyl2 := r.ReadMapStart() if yyl2 == 0 { r.ReadMapEnd() } else { x.codecDecodeSelfFromMap(yyl2, d) } - } else if yyct2 == codecSelferValueTypeArray6628 { + } else if yyct2 == codecSelferValueTypeArray8411 { yyl2 := r.ReadArrayStart() if yyl2 == 0 { r.ReadArrayEnd() @@ -1639,13 +1639,13 @@ func (x *Response) CodecDecodeSelf(d *codec1978.Decoder) { x.codecDecodeSelfFromArray(yyl2, d) } } else { - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6628) + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct8411) } } } func (x *Response) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyhl3 bool = l >= 0 @@ -1701,7 +1701,7 @@ func (x *Response) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } func (x *Response) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyj7 int @@ -1784,7 +1784,7 @@ func (x *Response) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { @@ -1824,15 +1824,15 @@ func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { r.WriteArrayElem() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Key)) + r.EncodeString(codecSelferCcUTF88411, string(x.Key)) } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `key`) + r.EncodeString(codecSelferCcUTF88411, `key`) r.WriteMapElemValue() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Key)) + r.EncodeString(codecSelferCcUTF88411, string(x.Key)) } } if yyr2 || yy2arr2 { @@ -1848,7 +1848,7 @@ func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { } else { if yyq2[1] { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `dir`) + r.EncodeString(codecSelferCcUTF88411, `dir`) r.WriteMapElemValue() if false { } else { @@ -1860,15 +1860,15 @@ func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { r.WriteArrayElem() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Value)) + r.EncodeString(codecSelferCcUTF88411, string(x.Value)) } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `value`) + r.EncodeString(codecSelferCcUTF88411, `value`) r.WriteMapElemValue() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Value)) + r.EncodeString(codecSelferCcUTF88411, string(x.Value)) } } if yyr2 || yy2arr2 { @@ -1880,7 +1880,7 @@ func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `nodes`) + r.EncodeString(codecSelferCcUTF88411, `nodes`) r.WriteMapElemValue() if x.Nodes == nil { r.EncodeNil() @@ -1896,7 +1896,7 @@ func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `createdIndex`) + r.EncodeString(codecSelferCcUTF88411, `createdIndex`) r.WriteMapElemValue() if false { } else { @@ -1911,7 +1911,7 @@ func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `modifiedIndex`) + r.EncodeString(codecSelferCcUTF88411, `modifiedIndex`) r.WriteMapElemValue() if false { } else { @@ -1947,7 +1947,7 @@ func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { } else { if yyq2[6] { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `expiration`) + r.EncodeString(codecSelferCcUTF88411, `expiration`) r.WriteMapElemValue() if yyn21 { r.EncodeNil() @@ -1977,7 +1977,7 @@ func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { } else { if yyq2[7] { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `ttl`) + r.EncodeString(codecSelferCcUTF88411, `ttl`) r.WriteMapElemValue() if false { } else { @@ -1995,7 +1995,7 @@ func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *Node) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r if false { @@ -2003,14 +2003,14 @@ func (x *Node) CodecDecodeSelf(d *codec1978.Decoder) { z.DecExtension(x, yyxt1) } else { yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap6628 { + if yyct2 == codecSelferValueTypeMap8411 { yyl2 := r.ReadMapStart() if yyl2 == 0 { r.ReadMapEnd() } else { x.codecDecodeSelfFromMap(yyl2, d) } - } else if yyct2 == codecSelferValueTypeArray6628 { + } else if yyct2 == codecSelferValueTypeArray8411 { yyl2 := r.ReadArrayStart() if yyl2 == 0 { r.ReadArrayEnd() @@ -2018,13 +2018,13 @@ func (x *Node) CodecDecodeSelf(d *codec1978.Decoder) { x.codecDecodeSelfFromArray(yyl2, d) } } else { - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6628) + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct8411) } } } func (x *Node) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyhl3 bool = l >= 0 @@ -2107,7 +2107,7 @@ func (x *Node) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } func (x *Node) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyj13 int @@ -2267,7 +2267,7 @@ func (x *Node) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } func (x Nodes) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { @@ -2283,7 +2283,7 @@ func (x Nodes) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *Nodes) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r if false { @@ -2295,7 +2295,7 @@ func (x *Nodes) CodecDecodeSelf(d *codec1978.Decoder) { } func (x *httpKeysAPI) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { @@ -2324,7 +2324,7 @@ func (x *httpKeysAPI) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *httpKeysAPI) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r if false { @@ -2332,14 +2332,14 @@ func (x *httpKeysAPI) CodecDecodeSelf(d *codec1978.Decoder) { z.DecExtension(x, yyxt1) } else { yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap6628 { + if yyct2 == codecSelferValueTypeMap8411 { yyl2 := r.ReadMapStart() if yyl2 == 0 { r.ReadMapEnd() } else { x.codecDecodeSelfFromMap(yyl2, d) } - } else if yyct2 == codecSelferValueTypeArray6628 { + } else if yyct2 == codecSelferValueTypeArray8411 { yyl2 := r.ReadArrayStart() if yyl2 == 0 { r.ReadArrayEnd() @@ -2347,13 +2347,13 @@ func (x *httpKeysAPI) CodecDecodeSelf(d *codec1978.Decoder) { x.codecDecodeSelfFromArray(yyl2, d) } } else { - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6628) + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct8411) } } } func (x *httpKeysAPI) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyhl3 bool = l >= 0 @@ -2379,7 +2379,7 @@ func (x *httpKeysAPI) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } func (x *httpKeysAPI) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyj4 int @@ -2402,7 +2402,7 @@ func (x *httpKeysAPI) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } func (x *httpWatcher) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { @@ -2431,7 +2431,7 @@ func (x *httpWatcher) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *httpWatcher) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r if false { @@ -2439,14 +2439,14 @@ func (x *httpWatcher) CodecDecodeSelf(d *codec1978.Decoder) { z.DecExtension(x, yyxt1) } else { yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap6628 { + if yyct2 == codecSelferValueTypeMap8411 { yyl2 := r.ReadMapStart() if yyl2 == 0 { r.ReadMapEnd() } else { x.codecDecodeSelfFromMap(yyl2, d) } - } else if yyct2 == codecSelferValueTypeArray6628 { + } else if yyct2 == codecSelferValueTypeArray8411 { yyl2 := r.ReadArrayStart() if yyl2 == 0 { r.ReadArrayEnd() @@ -2454,13 +2454,13 @@ func (x *httpWatcher) CodecDecodeSelf(d *codec1978.Decoder) { x.codecDecodeSelfFromArray(yyl2, d) } } else { - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6628) + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct8411) } } } func (x *httpWatcher) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyhl3 bool = l >= 0 @@ -2486,7 +2486,7 @@ func (x *httpWatcher) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } func (x *httpWatcher) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyj4 int @@ -2509,7 +2509,7 @@ func (x *httpWatcher) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } func (x *getAction) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { @@ -2532,30 +2532,30 @@ func (x *getAction) CodecEncodeSelf(e *codec1978.Encoder) { r.WriteArrayElem() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Prefix)) + r.EncodeString(codecSelferCcUTF88411, string(x.Prefix)) } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Prefix`) + r.EncodeString(codecSelferCcUTF88411, `Prefix`) r.WriteMapElemValue() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Prefix)) + r.EncodeString(codecSelferCcUTF88411, string(x.Prefix)) } } if yyr2 || yy2arr2 { r.WriteArrayElem() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Key)) + r.EncodeString(codecSelferCcUTF88411, string(x.Key)) } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Key`) + r.EncodeString(codecSelferCcUTF88411, `Key`) r.WriteMapElemValue() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Key)) + r.EncodeString(codecSelferCcUTF88411, string(x.Key)) } } if yyr2 || yy2arr2 { @@ -2566,7 +2566,7 @@ func (x *getAction) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Recursive`) + r.EncodeString(codecSelferCcUTF88411, `Recursive`) r.WriteMapElemValue() if false { } else { @@ -2581,7 +2581,7 @@ func (x *getAction) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Sorted`) + r.EncodeString(codecSelferCcUTF88411, `Sorted`) r.WriteMapElemValue() if false { } else { @@ -2596,7 +2596,7 @@ func (x *getAction) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Quorum`) + r.EncodeString(codecSelferCcUTF88411, `Quorum`) r.WriteMapElemValue() if false { } else { @@ -2613,7 +2613,7 @@ func (x *getAction) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *getAction) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r if false { @@ -2621,14 +2621,14 @@ func (x *getAction) CodecDecodeSelf(d *codec1978.Decoder) { z.DecExtension(x, yyxt1) } else { yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap6628 { + if yyct2 == codecSelferValueTypeMap8411 { yyl2 := r.ReadMapStart() if yyl2 == 0 { r.ReadMapEnd() } else { x.codecDecodeSelfFromMap(yyl2, d) } - } else if yyct2 == codecSelferValueTypeArray6628 { + } else if yyct2 == codecSelferValueTypeArray8411 { yyl2 := r.ReadArrayStart() if yyl2 == 0 { r.ReadArrayEnd() @@ -2636,13 +2636,13 @@ func (x *getAction) CodecDecodeSelf(d *codec1978.Decoder) { x.codecDecodeSelfFromArray(yyl2, d) } } else { - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6628) + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct8411) } } } func (x *getAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyhl3 bool = l >= 0 @@ -2698,7 +2698,7 @@ func (x *getAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } func (x *getAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyj9 int @@ -2801,7 +2801,7 @@ func (x *getAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } func (x *waitAction) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { @@ -2824,30 +2824,30 @@ func (x *waitAction) CodecEncodeSelf(e *codec1978.Encoder) { r.WriteArrayElem() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Prefix)) + r.EncodeString(codecSelferCcUTF88411, string(x.Prefix)) } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Prefix`) + r.EncodeString(codecSelferCcUTF88411, `Prefix`) r.WriteMapElemValue() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Prefix)) + r.EncodeString(codecSelferCcUTF88411, string(x.Prefix)) } } if yyr2 || yy2arr2 { r.WriteArrayElem() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Key)) + r.EncodeString(codecSelferCcUTF88411, string(x.Key)) } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Key`) + r.EncodeString(codecSelferCcUTF88411, `Key`) r.WriteMapElemValue() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Key)) + r.EncodeString(codecSelferCcUTF88411, string(x.Key)) } } if yyr2 || yy2arr2 { @@ -2858,7 +2858,7 @@ func (x *waitAction) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `WaitIndex`) + r.EncodeString(codecSelferCcUTF88411, `WaitIndex`) r.WriteMapElemValue() if false { } else { @@ -2873,7 +2873,7 @@ func (x *waitAction) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Recursive`) + r.EncodeString(codecSelferCcUTF88411, `Recursive`) r.WriteMapElemValue() if false { } else { @@ -2890,7 +2890,7 @@ func (x *waitAction) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *waitAction) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r if false { @@ -2898,14 +2898,14 @@ func (x *waitAction) CodecDecodeSelf(d *codec1978.Decoder) { z.DecExtension(x, yyxt1) } else { yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap6628 { + if yyct2 == codecSelferValueTypeMap8411 { yyl2 := r.ReadMapStart() if yyl2 == 0 { r.ReadMapEnd() } else { x.codecDecodeSelfFromMap(yyl2, d) } - } else if yyct2 == codecSelferValueTypeArray6628 { + } else if yyct2 == codecSelferValueTypeArray8411 { yyl2 := r.ReadArrayStart() if yyl2 == 0 { r.ReadArrayEnd() @@ -2913,13 +2913,13 @@ func (x *waitAction) CodecDecodeSelf(d *codec1978.Decoder) { x.codecDecodeSelfFromArray(yyl2, d) } } else { - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6628) + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct8411) } } } func (x *waitAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyhl3 bool = l >= 0 @@ -2969,7 +2969,7 @@ func (x *waitAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } func (x *waitAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyj8 int @@ -3056,7 +3056,7 @@ func (x *waitAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } func (x *setAction) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { @@ -3079,60 +3079,60 @@ func (x *setAction) CodecEncodeSelf(e *codec1978.Encoder) { r.WriteArrayElem() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Prefix)) + r.EncodeString(codecSelferCcUTF88411, string(x.Prefix)) } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Prefix`) + r.EncodeString(codecSelferCcUTF88411, `Prefix`) r.WriteMapElemValue() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Prefix)) + r.EncodeString(codecSelferCcUTF88411, string(x.Prefix)) } } if yyr2 || yy2arr2 { r.WriteArrayElem() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Key)) + r.EncodeString(codecSelferCcUTF88411, string(x.Key)) } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Key`) + r.EncodeString(codecSelferCcUTF88411, `Key`) r.WriteMapElemValue() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Key)) + r.EncodeString(codecSelferCcUTF88411, string(x.Key)) } } if yyr2 || yy2arr2 { r.WriteArrayElem() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Value)) + r.EncodeString(codecSelferCcUTF88411, string(x.Value)) } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Value`) + r.EncodeString(codecSelferCcUTF88411, `Value`) r.WriteMapElemValue() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Value)) + r.EncodeString(codecSelferCcUTF88411, string(x.Value)) } } if yyr2 || yy2arr2 { r.WriteArrayElem() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.PrevValue)) + r.EncodeString(codecSelferCcUTF88411, string(x.PrevValue)) } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `PrevValue`) + r.EncodeString(codecSelferCcUTF88411, `PrevValue`) r.WriteMapElemValue() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.PrevValue)) + r.EncodeString(codecSelferCcUTF88411, string(x.PrevValue)) } } if yyr2 || yy2arr2 { @@ -3143,7 +3143,7 @@ func (x *setAction) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `PrevIndex`) + r.EncodeString(codecSelferCcUTF88411, `PrevIndex`) r.WriteMapElemValue() if false { } else { @@ -3155,7 +3155,7 @@ func (x *setAction) CodecEncodeSelf(e *codec1978.Encoder) { x.PrevExist.CodecEncodeSelf(e) } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `PrevExist`) + r.EncodeString(codecSelferCcUTF88411, `PrevExist`) r.WriteMapElemValue() x.PrevExist.CodecEncodeSelf(e) } @@ -3169,7 +3169,7 @@ func (x *setAction) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `TTL`) + r.EncodeString(codecSelferCcUTF88411, `TTL`) r.WriteMapElemValue() if false { } else if yyxt23 := z.Extension(z.I2Rtid(x.TTL)); yyxt23 != nil { @@ -3186,7 +3186,7 @@ func (x *setAction) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Refresh`) + r.EncodeString(codecSelferCcUTF88411, `Refresh`) r.WriteMapElemValue() if false { } else { @@ -3201,7 +3201,7 @@ func (x *setAction) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Dir`) + r.EncodeString(codecSelferCcUTF88411, `Dir`) r.WriteMapElemValue() if false { } else { @@ -3216,7 +3216,7 @@ func (x *setAction) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `NoValueOnSuccess`) + r.EncodeString(codecSelferCcUTF88411, `NoValueOnSuccess`) r.WriteMapElemValue() if false { } else { @@ -3233,7 +3233,7 @@ func (x *setAction) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *setAction) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r if false { @@ -3241,14 +3241,14 @@ func (x *setAction) CodecDecodeSelf(d *codec1978.Decoder) { z.DecExtension(x, yyxt1) } else { yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap6628 { + if yyct2 == codecSelferValueTypeMap8411 { yyl2 := r.ReadMapStart() if yyl2 == 0 { r.ReadMapEnd() } else { x.codecDecodeSelfFromMap(yyl2, d) } - } else if yyct2 == codecSelferValueTypeArray6628 { + } else if yyct2 == codecSelferValueTypeArray8411 { yyl2 := r.ReadArrayStart() if yyl2 == 0 { r.ReadArrayEnd() @@ -3256,13 +3256,13 @@ func (x *setAction) CodecDecodeSelf(d *codec1978.Decoder) { x.codecDecodeSelfFromArray(yyl2, d) } } else { - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6628) + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct8411) } } } func (x *setAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyhl3 bool = l >= 0 @@ -3353,7 +3353,7 @@ func (x *setAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } func (x *setAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyj15 int @@ -3541,7 +3541,7 @@ func (x *setAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } func (x *deleteAction) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { @@ -3564,45 +3564,45 @@ func (x *deleteAction) CodecEncodeSelf(e *codec1978.Encoder) { r.WriteArrayElem() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Prefix)) + r.EncodeString(codecSelferCcUTF88411, string(x.Prefix)) } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Prefix`) + r.EncodeString(codecSelferCcUTF88411, `Prefix`) r.WriteMapElemValue() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Prefix)) + r.EncodeString(codecSelferCcUTF88411, string(x.Prefix)) } } if yyr2 || yy2arr2 { r.WriteArrayElem() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Key)) + r.EncodeString(codecSelferCcUTF88411, string(x.Key)) } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Key`) + r.EncodeString(codecSelferCcUTF88411, `Key`) r.WriteMapElemValue() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Key)) + r.EncodeString(codecSelferCcUTF88411, string(x.Key)) } } if yyr2 || yy2arr2 { r.WriteArrayElem() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.PrevValue)) + r.EncodeString(codecSelferCcUTF88411, string(x.PrevValue)) } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `PrevValue`) + r.EncodeString(codecSelferCcUTF88411, `PrevValue`) r.WriteMapElemValue() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.PrevValue)) + r.EncodeString(codecSelferCcUTF88411, string(x.PrevValue)) } } if yyr2 || yy2arr2 { @@ -3613,7 +3613,7 @@ func (x *deleteAction) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `PrevIndex`) + r.EncodeString(codecSelferCcUTF88411, `PrevIndex`) r.WriteMapElemValue() if false { } else { @@ -3628,7 +3628,7 @@ func (x *deleteAction) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Dir`) + r.EncodeString(codecSelferCcUTF88411, `Dir`) r.WriteMapElemValue() if false { } else { @@ -3643,7 +3643,7 @@ func (x *deleteAction) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Recursive`) + r.EncodeString(codecSelferCcUTF88411, `Recursive`) r.WriteMapElemValue() if false { } else { @@ -3660,7 +3660,7 @@ func (x *deleteAction) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *deleteAction) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r if false { @@ -3668,14 +3668,14 @@ func (x *deleteAction) CodecDecodeSelf(d *codec1978.Decoder) { z.DecExtension(x, yyxt1) } else { yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap6628 { + if yyct2 == codecSelferValueTypeMap8411 { yyl2 := r.ReadMapStart() if yyl2 == 0 { r.ReadMapEnd() } else { x.codecDecodeSelfFromMap(yyl2, d) } - } else if yyct2 == codecSelferValueTypeArray6628 { + } else if yyct2 == codecSelferValueTypeArray8411 { yyl2 := r.ReadArrayStart() if yyl2 == 0 { r.ReadArrayEnd() @@ -3683,13 +3683,13 @@ func (x *deleteAction) CodecDecodeSelf(d *codec1978.Decoder) { x.codecDecodeSelfFromArray(yyl2, d) } } else { - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6628) + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct8411) } } } func (x *deleteAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyhl3 bool = l >= 0 @@ -3751,7 +3751,7 @@ func (x *deleteAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } func (x *deleteAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyj10 int @@ -3870,7 +3870,7 @@ func (x *deleteAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } func (x *createInOrderAction) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { @@ -3893,45 +3893,45 @@ func (x *createInOrderAction) CodecEncodeSelf(e *codec1978.Encoder) { r.WriteArrayElem() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Prefix)) + r.EncodeString(codecSelferCcUTF88411, string(x.Prefix)) } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Prefix`) + r.EncodeString(codecSelferCcUTF88411, `Prefix`) r.WriteMapElemValue() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Prefix)) + r.EncodeString(codecSelferCcUTF88411, string(x.Prefix)) } } if yyr2 || yy2arr2 { r.WriteArrayElem() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Dir)) + r.EncodeString(codecSelferCcUTF88411, string(x.Dir)) } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Dir`) + r.EncodeString(codecSelferCcUTF88411, `Dir`) r.WriteMapElemValue() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Dir)) + r.EncodeString(codecSelferCcUTF88411, string(x.Dir)) } } if yyr2 || yy2arr2 { r.WriteArrayElem() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Value)) + r.EncodeString(codecSelferCcUTF88411, string(x.Value)) } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `Value`) + r.EncodeString(codecSelferCcUTF88411, `Value`) r.WriteMapElemValue() if false { } else { - r.EncodeString(codecSelferCcUTF86628, string(x.Value)) + r.EncodeString(codecSelferCcUTF88411, string(x.Value)) } } if yyr2 || yy2arr2 { @@ -3944,7 +3944,7 @@ func (x *createInOrderAction) CodecEncodeSelf(e *codec1978.Encoder) { } } else { r.WriteMapElemKey() - r.EncodeString(codecSelferCcUTF86628, `TTL`) + r.EncodeString(codecSelferCcUTF88411, `TTL`) r.WriteMapElemValue() if false { } else if yyxt14 := z.Extension(z.I2Rtid(x.TTL)); yyxt14 != nil { @@ -3963,7 +3963,7 @@ func (x *createInOrderAction) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *createInOrderAction) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r if false { @@ -3971,14 +3971,14 @@ func (x *createInOrderAction) CodecDecodeSelf(d *codec1978.Decoder) { z.DecExtension(x, yyxt1) } else { yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap6628 { + if yyct2 == codecSelferValueTypeMap8411 { yyl2 := r.ReadMapStart() if yyl2 == 0 { r.ReadMapEnd() } else { x.codecDecodeSelfFromMap(yyl2, d) } - } else if yyct2 == codecSelferValueTypeArray6628 { + } else if yyct2 == codecSelferValueTypeArray8411 { yyl2 := r.ReadArrayStart() if yyl2 == 0 { r.ReadArrayEnd() @@ -3986,13 +3986,13 @@ func (x *createInOrderAction) CodecDecodeSelf(d *codec1978.Decoder) { x.codecDecodeSelfFromArray(yyl2, d) } } else { - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6628) + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct8411) } } } func (x *createInOrderAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyhl3 bool = l >= 0 @@ -4047,7 +4047,7 @@ func (x *createInOrderAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder } func (x *createInOrderAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer6628 + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyj9 int @@ -4138,8 +4138,8 @@ func (x *createInOrderAction) codecDecodeSelfFromArray(l int, d *codec1978.Decod r.ReadArrayEnd() } -func (x codecSelfer6628) encNodes(v Nodes, e *codec1978.Encoder) { - var h codecSelfer6628 +func (x codecSelfer8411) encNodes(v Nodes, e *codec1978.Encoder) { + var h codecSelfer8411 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r r.WriteArrayStart(len(v)) @@ -4154,8 +4154,8 @@ func (x codecSelfer6628) encNodes(v Nodes, e *codec1978.Encoder) { r.WriteArrayEnd() } -func (x codecSelfer6628) decNodes(v *Nodes, d *codec1978.Decoder) { - var h codecSelfer6628 +func (x codecSelfer8411) decNodes(v *Nodes, d *codec1978.Decoder) { + var h codecSelfer8411 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r diff --git a/vendor/github.com/coreos/etcd/client/keys.go b/vendor/go.etcd.io/etcd/client/keys.go similarity index 100% rename from vendor/github.com/coreos/etcd/client/keys.go rename to vendor/go.etcd.io/etcd/client/keys.go diff --git a/vendor/github.com/coreos/etcd/client/members.go b/vendor/go.etcd.io/etcd/client/members.go similarity index 100% rename from vendor/github.com/coreos/etcd/client/members.go rename to vendor/go.etcd.io/etcd/client/members.go diff --git a/vendor/github.com/coreos/etcd/client/util.go b/vendor/go.etcd.io/etcd/client/util.go similarity index 100% rename from vendor/github.com/coreos/etcd/client/util.go rename to vendor/go.etcd.io/etcd/client/util.go diff --git a/vendor/go.etcd.io/etcd/clientv3/client.go b/vendor/go.etcd.io/etcd/clientv3/client.go index 0a578307b450..3cc770e08a6f 100644 --- a/vendor/go.etcd.io/etcd/clientv3/client.go +++ b/vendor/go.etcd.io/etcd/clientv3/client.go @@ -27,13 +27,12 @@ import ( "sync" "time" - "github.com/grpc-ecosystem/go-grpc-middleware/util/backoffutils" + "github.com/google/uuid" "go.etcd.io/etcd/clientv3/balancer" "go.etcd.io/etcd/clientv3/balancer/picker" "go.etcd.io/etcd/clientv3/balancer/resolver/endpoint" "go.etcd.io/etcd/etcdserver/api/v3rpc/rpctypes" "go.uber.org/zap" - "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" @@ -477,7 +476,7 @@ func newClient(cfg *Config) (*Client, error) { // Prepare a 'endpoint:///' resolver for the client and create a endpoint target to pass // to dial so the client knows to use this resolver. - client.resolverGroup, err = endpoint.NewResolverGroup(fmt.Sprintf("client-%s", strconv.FormatInt(time.Now().UnixNano(), 36))) + client.resolverGroup, err = endpoint.NewResolverGroup(fmt.Sprintf("client-%s", uuid.New().String())) if err != nil { client.cancel() return nil, err @@ -489,7 +488,7 @@ func newClient(cfg *Config) (*Client, error) { } dialEndpoint := cfg.Endpoints[0] - // Use an provided endpoint target so that for https:// without any tls config given, then + // Use a provided endpoint target so that for https:// without any tls config given, then // grpc will assume the certificate server name is the endpoint host. conn, err := client.dialWithBalancer(dialEndpoint, grpc.WithBalancerName(roundRobinBalancerName)) if err != nil { @@ -528,7 +527,7 @@ func (c *Client) roundRobinQuorumBackoff(waitBetween time.Duration, jitterFracti quorum := (n/2 + 1) if attempt%quorum == 0 { c.lg.Info("backoff", zap.Uint("attempt", attempt), zap.Uint("quorum", quorum), zap.Duration("waitBetween", waitBetween), zap.Float64("jitterFraction", jitterFraction)) - return backoffutils.JitterUp(waitBetween, jitterFraction) + return jitterUp(waitBetween, jitterFraction) } c.lg.Info("backoff skipped", zap.Uint("attempt", attempt), zap.Uint("quorum", quorum)) return 0 diff --git a/vendor/go.etcd.io/etcd/clientv3/concurrency/election.go b/vendor/go.etcd.io/etcd/clientv3/concurrency/election.go index d44e426f4794..2521db6ac045 100644 --- a/vendor/go.etcd.io/etcd/clientv3/concurrency/election.go +++ b/vendor/go.etcd.io/etcd/clientv3/concurrency/election.go @@ -48,6 +48,7 @@ func NewElection(s *Session, pfx string) *Election { // ResumeElection initializes an election with a known leader. func ResumeElection(s *Session, pfx string, leaderKey string, leaderRev int64) *Election { return &Election{ + keyPrefix: pfx, session: s, leaderKey: leaderKey, leaderRev: leaderRev, diff --git a/vendor/go.etcd.io/etcd/clientv3/doc.go b/vendor/go.etcd.io/etcd/clientv3/doc.go index 649471774d27..01a3f5961a7e 100644 --- a/vendor/go.etcd.io/etcd/clientv3/doc.go +++ b/vendor/go.etcd.io/etcd/clientv3/doc.go @@ -61,7 +61,7 @@ // // 1. context error: canceled or deadline exceeded. // 2. gRPC status error: e.g. when clock drifts in server-side before client's context deadline exceeded. -// 3. gRPC error: see https://go.etcd.io/etcd/blob/master/etcdserver/api/v3rpc/rpctypes/error.go +// 3. gRPC error: see https://github.com/etcd-io/etcd/blob/master/etcdserver/api/v3rpc/rpctypes/error.go // // Here is the example code to handle client errors: // diff --git a/vendor/go.etcd.io/etcd/clientv3/lease.go b/vendor/go.etcd.io/etcd/clientv3/lease.go index 380de02a882a..c2796fc969af 100644 --- a/vendor/go.etcd.io/etcd/clientv3/lease.go +++ b/vendor/go.etcd.io/etcd/clientv3/lease.go @@ -132,7 +132,7 @@ type Lease interface { // given context "ctx" is canceled or timed out. // // TODO(v4.0): post errors to last keep alive message before closing - // (see https://go.etcd.io/etcd/pull/7866) + // (see https://github.com/etcd-io/etcd/pull/7866) KeepAlive(ctx context.Context, id LeaseID) (<-chan *LeaseKeepAliveResponse, error) // KeepAliveOnce renews the lease once. The response corresponds to the diff --git a/vendor/go.etcd.io/etcd/clientv3/retry_interceptor.go b/vendor/go.etcd.io/etcd/clientv3/retry_interceptor.go index f8ebe44e4ac9..088d86ae7d74 100644 --- a/vendor/go.etcd.io/etcd/clientv3/retry_interceptor.go +++ b/vendor/go.etcd.io/etcd/clientv3/retry_interceptor.go @@ -23,7 +23,6 @@ import ( "sync" "time" - "github.com/grpc-ecosystem/go-grpc-middleware/util/backoffutils" "go.etcd.io/etcd/etcdserver/api/v3rpc/rpctypes" "go.uber.org/zap" "google.golang.org/grpc" @@ -377,6 +376,6 @@ func filterCallOptions(callOptions []grpc.CallOption) (grpcOptions []grpc.CallOp // For example waitBetween=1s and jitter=0.10 can generate waits between 900ms and 1100ms. func backoffLinearWithJitter(waitBetween time.Duration, jitterFraction float64) backoffFunc { return func(attempt uint) time.Duration { - return backoffutils.JitterUp(waitBetween, jitterFraction) + return jitterUp(waitBetween, jitterFraction) } } diff --git a/vendor/github.com/coreos/etcd/pkg/transport/timeout_dialer.go b/vendor/go.etcd.io/etcd/clientv3/utils.go similarity index 51% rename from vendor/github.com/coreos/etcd/pkg/transport/timeout_dialer.go rename to vendor/go.etcd.io/etcd/clientv3/utils.go index 6ae39ecfc9b3..850275877d32 100644 --- a/vendor/github.com/coreos/etcd/pkg/transport/timeout_dialer.go +++ b/vendor/go.etcd.io/etcd/clientv3/utils.go @@ -1,4 +1,4 @@ -// Copyright 2015 The etcd Authors +// Copyright 2018 The etcd Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,25 +12,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -package transport +package clientv3 import ( - "net" + "math/rand" "time" ) -type rwTimeoutDialer struct { - wtimeoutd time.Duration - rdtimeoutd time.Duration - net.Dialer -} - -func (d *rwTimeoutDialer) Dial(network, address string) (net.Conn, error) { - conn, err := d.Dialer.Dial(network, address) - tconn := &timeoutConn{ - rdtimeoutd: d.rdtimeoutd, - wtimeoutd: d.wtimeoutd, - Conn: conn, - } - return tconn, err +// jitterUp adds random jitter to the duration. +// +// This adds or subtracts time from the duration within a given jitter fraction. +// For example for 10s and jitter 0.1, it will return a time within [9s, 11s]) +// +// Reference: https://godoc.org/github.com/grpc-ecosystem/go-grpc-middleware/util/backoffutils +func jitterUp(duration time.Duration, jitter float64) time.Duration { + multiplier := jitter * (rand.Float64()*2 - 1) + return time.Duration(float64(duration) * (1 + multiplier)) } diff --git a/vendor/go.etcd.io/etcd/clientv3/watch.go b/vendor/go.etcd.io/etcd/clientv3/watch.go index 9c677ac7ba1d..8ec58bb14695 100644 --- a/vendor/go.etcd.io/etcd/clientv3/watch.go +++ b/vendor/go.etcd.io/etcd/clientv3/watch.go @@ -68,7 +68,7 @@ type Watcher interface { // TODO: explicitly set context error in the last "WatchResponse" message and close channel? // Currently, client contexts are overwritten with "valCtx" that never closes. // TODO(v3.4): configure watch retry policy, limit maximum retry number - // (see https://go.etcd.io/etcd/issues/8980) + // (see https://github.com/etcd-io/etcd/issues/8980) Watch(ctx context.Context, key string, opts ...OpOption) WatchChan // RequestProgress requests a progress notify response be sent in all watch channels. diff --git a/vendor/go.etcd.io/etcd/pkg/srv/srv.go b/vendor/go.etcd.io/etcd/pkg/srv/srv.go index 9914104a7e61..c3560026d481 100644 --- a/vendor/go.etcd.io/etcd/pkg/srv/srv.go +++ b/vendor/go.etcd.io/etcd/pkg/srv/srv.go @@ -96,7 +96,7 @@ type SRVClients struct { } // GetClient looks up the client endpoints for a service and domain. -func GetClient(service, domain string) (*SRVClients, error) { +func GetClient(service, domain string, serviceName string) (*SRVClients, error) { var urls []*url.URL var srvs []*net.SRV @@ -115,8 +115,8 @@ func GetClient(service, domain string) (*SRVClients, error) { return nil } - errHTTPS := updateURLs(service+"-ssl", "https") - errHTTP := updateURLs(service, "http") + errHTTPS := updateURLs(GetSRVService(service, serviceName, "https"), "https") + errHTTP := updateURLs(GetSRVService(service, serviceName, "http"), "http") if errHTTPS != nil && errHTTP != nil { return nil, fmt.Errorf("dns lookup errors: %s and %s", errHTTPS, errHTTP) @@ -128,3 +128,15 @@ func GetClient(service, domain string) (*SRVClients, error) { } return &SRVClients{Endpoints: endpoints, SRVs: srvs}, nil } + +// GetSRVService generates a SRV service including an optional suffix. +func GetSRVService(service, serviceName string, scheme string) (SRVService string) { + if scheme == "https" { + service = fmt.Sprintf("%s-ssl", service) + } + + if serviceName != "" { + return fmt.Sprintf("%s-%s", service, serviceName) + } + return service +} diff --git a/vendor/go.etcd.io/etcd/raft/OWNERS b/vendor/go.etcd.io/etcd/raft/OWNERS new file mode 100644 index 000000000000..ab781066e237 --- /dev/null +++ b/vendor/go.etcd.io/etcd/raft/OWNERS @@ -0,0 +1,19 @@ +approvers: +- heyitsanthony +- philips +- fanminshi +- gyuho +- mitake +- jpbetz +- xiang90 +- bdarnell +reviewers: +- heyitsanthony +- philips +- fanminshi +- gyuho +- mitake +- jpbetz +- xiang90 +- bdarnell +- tschottdorf diff --git a/vendor/go.etcd.io/etcd/raft/log.go b/vendor/go.etcd.io/etcd/raft/log.go index 50f28f87b354..03f83e61c428 100644 --- a/vendor/go.etcd.io/etcd/raft/log.go +++ b/vendor/go.etcd.io/etcd/raft/log.go @@ -39,7 +39,9 @@ type raftLog struct { logger Logger - maxMsgSize uint64 + // maxNextEntsSize is the maximum number aggregate byte size of the messages + // returned from calls to nextEnts. + maxNextEntsSize uint64 } // newLog returns log using the given storage and default options. It @@ -51,14 +53,14 @@ func newLog(storage Storage, logger Logger) *raftLog { // newLogWithSize returns a log using the given storage and max // message size. -func newLogWithSize(storage Storage, logger Logger, maxMsgSize uint64) *raftLog { +func newLogWithSize(storage Storage, logger Logger, maxNextEntsSize uint64) *raftLog { if storage == nil { log.Panic("storage must not be nil") } log := &raftLog{ - storage: storage, - logger: logger, - maxMsgSize: maxMsgSize, + storage: storage, + logger: logger, + maxNextEntsSize: maxNextEntsSize, } firstIndex, err := storage.FirstIndex() if err != nil { @@ -149,7 +151,7 @@ func (l *raftLog) unstableEntries() []pb.Entry { func (l *raftLog) nextEnts() (ents []pb.Entry) { off := max(l.applied+1, l.firstIndex()) if l.committed+1 > off { - ents, err := l.slice(off, l.committed+1, l.maxMsgSize) + ents, err := l.slice(off, l.committed+1, l.maxNextEntsSize) if err != nil { l.logger.Panicf("unexpected error when getting unapplied entries (%v)", err) } diff --git a/vendor/go.etcd.io/etcd/raft/node.go b/vendor/go.etcd.io/etcd/raft/node.go index f67628fd361d..749db98758bb 100644 --- a/vendor/go.etcd.io/etcd/raft/node.go +++ b/vendor/go.etcd.io/etcd/raft/node.go @@ -129,7 +129,8 @@ type Node interface { Tick() // Campaign causes the Node to transition to candidate state and start campaigning to become leader. Campaign(ctx context.Context) error - // Propose proposes that data be appended to the log. + // Propose proposes that data be appended to the log. Note that proposals can be lost without + // notice, therefore it is user's job to ensure proposal retries. Propose(ctx context.Context, data []byte) error // ProposeConfChange proposes config change. // At most one ConfChange can be in the process of going through consensus. @@ -174,7 +175,16 @@ type Node interface { Status() Status // ReportUnreachable reports the given node is not reachable for the last send. ReportUnreachable(id uint64) - // ReportSnapshot reports the status of the sent snapshot. + // ReportSnapshot reports the status of the sent snapshot. The id is the raft ID of the follower + // who is meant to receive the snapshot, and the status is SnapshotFinish or SnapshotFailure. + // Calling ReportSnapshot with SnapshotFinish is a no-op. But, any failure in applying a + // snapshot (for e.g., while streaming it from leader to follower), should be reported to the + // leader with SnapshotFailure. When leader sends a snapshot to a follower, it pauses any raft + // log probes until the follower can apply the snapshot and advance its state. If the follower + // can't do that, for e.g., due to a crash, it could end up in a limbo, never getting any + // updates from the leader. Therefore, it is crucial that the application ensures that any + // failure in snapshot sending is caught and reported back to the leader; so it can resume raft + // log probing in the follower. ReportSnapshot(id uint64, status SnapshotStatus) // Stop performs any necessary termination of the Node. Stop() diff --git a/vendor/go.etcd.io/etcd/raft/raft.go b/vendor/go.etcd.io/etcd/raft/raft.go index bf0a8983c462..e1e6a16d4a09 100644 --- a/vendor/go.etcd.io/etcd/raft/raft.go +++ b/vendor/go.etcd.io/etcd/raft/raft.go @@ -154,6 +154,9 @@ type Config struct { // throughput during normal replication. Note: math.MaxUint64 for unlimited, // 0 for at most one entry per message. MaxSizePerMsg uint64 + // MaxCommittedSizePerReady limits the size of the committed entries which + // can be applied. + MaxCommittedSizePerReady uint64 // MaxUncommittedEntriesSize limits the aggregate byte size of the // uncommitted entries that may be appended to a leader's log. Once this // limit is exceeded, proposals will begin to return ErrProposalDropped @@ -224,6 +227,12 @@ func (c *Config) validate() error { c.MaxUncommittedEntriesSize = noLimit } + // default MaxCommittedSizePerReady to MaxSizePerMsg because they were + // previously the same parameter. + if c.MaxCommittedSizePerReady == 0 { + c.MaxCommittedSizePerReady = c.MaxSizePerMsg + } + if c.MaxInflightMsgs <= 0 { return errors.New("max inflight messages must be greater than 0") } @@ -316,7 +325,7 @@ func newRaft(c *Config) *raft { if err := c.validate(); err != nil { panic(err.Error()) } - raftlog := newLogWithSize(c.Storage, c.Logger, c.MaxSizePerMsg) + raftlog := newLogWithSize(c.Storage, c.Logger, c.MaxCommittedSizePerReady) hs, cs, err := c.Storage.InitialState() if err != nil { panic(err) // TODO(bdarnell) @@ -635,17 +644,27 @@ func (r *raft) reset(term uint64) { r.readOnly = newReadOnly(r.readOnly.option) } -func (r *raft) appendEntry(es ...pb.Entry) { +func (r *raft) appendEntry(es ...pb.Entry) (accepted bool) { li := r.raftLog.lastIndex() for i := range es { es[i].Term = r.Term es[i].Index = li + 1 + uint64(i) } + // Track the size of this uncommitted proposal. + if !r.increaseUncommittedSize(es) { + r.logger.Debugf( + "%x appending new entries to log would exceed uncommitted entry size limit; dropping proposal", + r.id, + ) + // Drop the proposal. + return false + } // use latest "last" index after truncate/append li = r.raftLog.append(es...) r.getProgress(r.id).maybeUpdate(li) // Regardless of maybeCommit's return, our caller will call bcastAppend. r.maybeCommit() + return true } // tickElection is run by followers and candidates after r.electionTimeout. @@ -717,6 +736,7 @@ func (r *raft) becomePreCandidate() { r.step = stepCandidate r.votes = make(map[uint64]bool) r.tick = r.tickElection + r.lead = None r.state = StatePreCandidate r.logger.Infof("%x became pre-candidate at term %d", r.id, r.Term) } @@ -731,6 +751,11 @@ func (r *raft) becomeLeader() { r.tick = r.tickHeartbeat r.lead = r.id r.state = StateLeader + // Followers enter replicate mode when they've been successfully probed + // (perhaps after having received a snapshot as a result). The leader is + // trivially in this state. Note that r.reset() has initialized this + // progress with the last index already. + r.prs[r.id].becomeReplicate() // Conservatively set the pendingConfIndex to the last index in the // log. There may or may not be a pending config change, but it's @@ -739,7 +764,16 @@ func (r *raft) becomeLeader() { // could be expensive. r.pendingConfIndex = r.raftLog.lastIndex() - r.appendEntry(pb.Entry{Data: nil}) + emptyEnt := pb.Entry{Data: nil} + if !r.appendEntry(emptyEnt) { + // This won't happen because we just called reset() above. + r.logger.Panic("empty entry was dropped") + } + // As a special case, don't count the initial empty entry towards the + // uncommitted log quota. This is because we want to preserve the + // behavior of allowing one entry larger than quota if the current + // usage is zero. + r.reduceUncommittedSize([]pb.Entry{emptyEnt}) r.logger.Infof("%x became leader at term %d", r.id, r.Term) } @@ -970,10 +1004,6 @@ func stepLeader(r *raft, m pb.Message) error { r.logger.Debugf("%x [term %d] transfer leadership to %x is in progress; dropping proposal", r.id, r.Term, r.leadTransferee) return ErrProposalDropped } - if !r.increaseUncommittedSize(m.Entries) { - r.logger.Debugf("%x appending new entries to log would exceed uncommitted entry size limit; dropping proposal", r.id) - return ErrProposalDropped - } for i, e := range m.Entries { if e.Type == pb.EntryConfChange { @@ -986,7 +1016,10 @@ func stepLeader(r *raft, m pb.Message) error { } } } - r.appendEntry(m.Entries...) + + if !r.appendEntry(m.Entries...) { + return ErrProposalDropped + } r.bcastAppend() return nil case pb.MsgReadIndex: @@ -1046,7 +1079,13 @@ func stepLeader(r *raft, m pb.Message) error { pr.becomeReplicate() case pr.State == ProgressStateSnapshot && pr.needSnapshotAbort(): r.logger.Debugf("%x snapshot aborted, resumed sending replication messages to %x [%s]", r.id, m.From, pr) + // Transition back to replicating state via probing state + // (which takes the snapshot into account). If we didn't + // move to replicating state, that would only happen with + // the next round of appends (but there may not be a next + // round for a while, exposing an inconsistent RaftStatus). pr.becomeProbe() + pr.becomeReplicate() case pr.State == ProgressStateReplicate: pr.ins.freeTo(m.Index) } @@ -1490,7 +1529,7 @@ func (r *raft) abortLeaderTransfer() { func (r *raft) increaseUncommittedSize(ents []pb.Entry) bool { var s uint64 for _, e := range ents { - s += uint64(e.Size()) + s += uint64(PayloadSize(e)) } if r.uncommittedSize > 0 && r.uncommittedSize+s > r.maxUncommittedSize { @@ -1513,7 +1552,7 @@ func (r *raft) reduceUncommittedSize(ents []pb.Entry) { var s uint64 for _, e := range ents { - s += uint64(e.Size()) + s += uint64(PayloadSize(e)) } if s > r.uncommittedSize { // uncommittedSize may underestimate the size of the uncommitted Raft diff --git a/vendor/go.etcd.io/etcd/raft/rawnode.go b/vendor/go.etcd.io/etcd/raft/rawnode.go index 4a4ec2e94635..d7a272d1435c 100644 --- a/vendor/go.etcd.io/etcd/raft/rawnode.go +++ b/vendor/go.etcd.io/etcd/raft/rawnode.go @@ -236,6 +236,39 @@ func (rn *RawNode) Status() *Status { return &status } +// StatusWithoutProgress returns a Status without populating the Progress field +// (and returns the Status as a value to avoid forcing it onto the heap). This +// is more performant if the Progress is not required. See WithProgress for an +// allocation-free way to introspect the Progress. +func (rn *RawNode) StatusWithoutProgress() Status { + return getStatusWithoutProgress(rn.raft) +} + +// ProgressType indicates the type of replica a Progress corresponds to. +type ProgressType byte + +const ( + // ProgressTypePeer accompanies a Progress for a regular peer replica. + ProgressTypePeer ProgressType = iota + // ProgressTypeLearner accompanies a Progress for a learner replica. + ProgressTypeLearner +) + +// WithProgress is a helper to introspect the Progress for this node and its +// peers. +func (rn *RawNode) WithProgress(visitor func(id uint64, typ ProgressType, pr Progress)) { + for id, pr := range rn.raft.prs { + pr := *pr + pr.ins = nil + visitor(id, ProgressTypePeer, pr) + } + for id, pr := range rn.raft.learnerPrs { + pr := *pr + pr.ins = nil + visitor(id, ProgressTypeLearner, pr) + } +} + // ReportUnreachable reports the given node is not reachable for the last send. func (rn *RawNode) ReportUnreachable(id uint64) { _ = rn.raft.Step(pb.Message{Type: pb.MsgUnreachable, From: id}) diff --git a/vendor/go.etcd.io/etcd/raft/status.go b/vendor/go.etcd.io/etcd/raft/status.go index 6d4aa7ba5f5e..9feca7c03b8f 100644 --- a/vendor/go.etcd.io/etcd/raft/status.go +++ b/vendor/go.etcd.io/etcd/raft/status.go @@ -32,29 +32,35 @@ type Status struct { LeadTransferee uint64 } -// getStatus gets a copy of the current raft status. -func getStatus(r *raft) Status { +func getProgressCopy(r *raft) map[uint64]Progress { + prs := make(map[uint64]Progress) + for id, p := range r.prs { + prs[id] = *p + } + + for id, p := range r.learnerPrs { + prs[id] = *p + } + return prs +} + +func getStatusWithoutProgress(r *raft) Status { s := Status{ ID: r.id, LeadTransferee: r.leadTransferee, } - s.HardState = r.hardState() s.SoftState = *r.softState() - s.Applied = r.raftLog.applied + return s +} +// getStatus gets a copy of the current raft status. +func getStatus(r *raft) Status { + s := getStatusWithoutProgress(r) if s.RaftState == StateLeader { - s.Progress = make(map[uint64]Progress) - for id, p := range r.prs { - s.Progress[id] = *p - } - - for id, p := range r.learnerPrs { - s.Progress[id] = *p - } + s.Progress = getProgressCopy(r) } - return s } diff --git a/vendor/go.etcd.io/etcd/raft/util.go b/vendor/go.etcd.io/etcd/raft/util.go index 1a7a1e9ac3a2..c145d26dd7f4 100644 --- a/vendor/go.etcd.io/etcd/raft/util.go +++ b/vendor/go.etcd.io/etcd/raft/util.go @@ -77,10 +77,7 @@ func DescribeMessage(m pb.Message, f EntryFormatter) string { var buf bytes.Buffer fmt.Fprintf(&buf, "%x->%x %v Term:%d Log:%d/%d", m.From, m.To, m.Type, m.Term, m.LogTerm, m.Index) if m.Reject { - fmt.Fprintf(&buf, " Rejected") - if m.RejectHint != 0 { - fmt.Fprintf(&buf, "(Hint:%d)", m.RejectHint) - } + fmt.Fprintf(&buf, " Rejected (Hint: %d)", m.RejectHint) } if m.Commit != 0 { fmt.Fprintf(&buf, " Commit:%d", m.Commit) @@ -101,6 +98,12 @@ func DescribeMessage(m pb.Message, f EntryFormatter) string { return buf.String() } +// PayloadSize is the size of the payload of this Entry. Notably, it does not +// depend on its Index or Term. +func PayloadSize(e pb.Entry) int { + return len(e.Data) +} + // DescribeEntry returns a concise human-readable description of an // Entry for debugging. func DescribeEntry(e pb.Entry, f EntryFormatter) string { diff --git a/vendor/vendor.json b/vendor/vendor.json index 9b6bf1ad46a0..6f411b684e87 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -804,18 +804,6 @@ "revision": "be9bd761db19d4fc551d40be908f02e00487511d", "revisionTime": "2018-10-03T07:59:58Z" }, - { - "checksumSHA1": "q1SfUjeNZ2lMjAlzyJPlNOl9OQ0=", - "path": "github.com/coreos/etcd/client", - "revision": "7a759c18d294698f537f8be91927354818a71e51", - "revisionTime": "2018-10-15T17:54:34Z" - }, - { - "checksumSHA1": "pop9HdnuvjAqCLhFZVmkrffixg4=", - "path": "github.com/coreos/etcd/pkg/transport", - "revision": "7a759c18d294698f537f8be91927354818a71e51", - "revisionTime": "2018-10-15T17:54:34Z" - }, { "checksumSHA1": "3fbao10aFaGLkTcNIYanekXqO+g=", "path": "github.com/coreos/go-oidc", @@ -2249,116 +2237,122 @@ { "checksumSHA1": "8nCoO1ACxWgrtwUl84Se7YIWVMA=", "path": "go.etcd.io/etcd/auth/authpb", - "revision": "7a759c18d294698f537f8be91927354818a71e51", - "revisionTime": "2018-10-15T17:54:34Z" + "revision": "de8e29e71ccfed8ecb2d3102f2ea78c627a528c0", + "revisionTime": "2019-01-22T19:19:15Z" + }, + { + "checksumSHA1": "LKYBHXfd+sg25r82HXXl424LH54=", + "path": "go.etcd.io/etcd/client", + "revision": "de8e29e71ccfed8ecb2d3102f2ea78c627a528c0", + "revisionTime": "2019-01-22T19:19:15Z" }, { - "checksumSHA1": "dOTPc9AnUrucXTh6dFhcj6Xyim8=", + "checksumSHA1": "fd884FzvbnjSR3hbvTaJp1cv0A8=", "path": "go.etcd.io/etcd/clientv3", - "revision": "7a759c18d294698f537f8be91927354818a71e51", - "revisionTime": "2018-10-15T17:54:34Z" + "revision": "de8e29e71ccfed8ecb2d3102f2ea78c627a528c0", + "revisionTime": "2019-01-22T19:19:15Z" }, { "checksumSHA1": "EXaUZbFolMaWfGUJUKXymQo63Fc=", "path": "go.etcd.io/etcd/clientv3/balancer", - "revision": "7a759c18d294698f537f8be91927354818a71e51", - "revisionTime": "2018-10-15T17:54:34Z" + "revision": "de8e29e71ccfed8ecb2d3102f2ea78c627a528c0", + "revisionTime": "2019-01-22T19:19:15Z" }, { "checksumSHA1": "g6eRx00F7Xl/0v8OCxgiC57ARs0=", "path": "go.etcd.io/etcd/clientv3/balancer/picker", - "revision": "7a759c18d294698f537f8be91927354818a71e51", - "revisionTime": "2018-10-15T17:54:34Z" + "revision": "de8e29e71ccfed8ecb2d3102f2ea78c627a528c0", + "revisionTime": "2019-01-22T19:19:15Z" }, { "checksumSHA1": "zsQzOE0KolNLwLKQfahcy3WZwjk=", "path": "go.etcd.io/etcd/clientv3/balancer/resolver/endpoint", - "revision": "7a759c18d294698f537f8be91927354818a71e51", - "revisionTime": "2018-10-15T17:54:34Z" + "revision": "de8e29e71ccfed8ecb2d3102f2ea78c627a528c0", + "revisionTime": "2019-01-22T19:19:15Z" }, { - "checksumSHA1": "NFsezSuEcheJXAlnehOL431Q8us=", + "checksumSHA1": "m4fwIeCfL2HdD7Oqmj9GXihz3m8=", "path": "go.etcd.io/etcd/clientv3/concurrency", - "revision": "7a759c18d294698f537f8be91927354818a71e51", - "revisionTime": "2018-10-15T17:54:34Z" + "revision": "de8e29e71ccfed8ecb2d3102f2ea78c627a528c0", + "revisionTime": "2019-01-22T19:19:15Z" }, { "checksumSHA1": "SDdAjoQeeV8tEDv05QZ7/Yv79CI=", "path": "go.etcd.io/etcd/etcdserver/api/v3rpc/rpctypes", - "revision": "7a759c18d294698f537f8be91927354818a71e51", - "revisionTime": "2018-10-15T17:54:34Z" + "revision": "de8e29e71ccfed8ecb2d3102f2ea78c627a528c0", + "revisionTime": "2019-01-22T19:19:15Z" }, { "checksumSHA1": "Jk0gGFdOHgsqxhoj9atENsLkwD0=", "path": "go.etcd.io/etcd/etcdserver/etcdserverpb", - "revision": "7a759c18d294698f537f8be91927354818a71e51", - "revisionTime": "2018-10-15T17:54:34Z" + "revision": "de8e29e71ccfed8ecb2d3102f2ea78c627a528c0", + "revisionTime": "2019-01-22T19:19:15Z" }, { "checksumSHA1": "C/ndQTz6TCtOsL29UYTxuax9/rw=", "path": "go.etcd.io/etcd/mvcc/mvccpb", - "revision": "7a759c18d294698f537f8be91927354818a71e51", - "revisionTime": "2018-10-15T17:54:34Z" + "revision": "de8e29e71ccfed8ecb2d3102f2ea78c627a528c0", + "revisionTime": "2019-01-22T19:19:15Z" }, { "checksumSHA1": "38iFzK4Eq3kQ3t2xlTRQvypOeRI=", "path": "go.etcd.io/etcd/pkg/logutil", - "revision": "7a759c18d294698f537f8be91927354818a71e51", - "revisionTime": "2018-10-15T17:54:34Z" + "revision": "de8e29e71ccfed8ecb2d3102f2ea78c627a528c0", + "revisionTime": "2019-01-22T19:19:15Z" }, { "checksumSHA1": "Q4ZZnZeTbMHrXKZxTd6EQjSf4uY=", "path": "go.etcd.io/etcd/pkg/pathutil", - "revision": "7a759c18d294698f537f8be91927354818a71e51", - "revisionTime": "2018-10-15T17:54:34Z" + "revision": "de8e29e71ccfed8ecb2d3102f2ea78c627a528c0", + "revisionTime": "2019-01-22T19:19:15Z" }, { - "checksumSHA1": "jF9R5QbAMut5PvZMIy9+zDPf6NU=", + "checksumSHA1": "f0XHkJGhyhBIlx+AuLyv2lc519w=", "path": "go.etcd.io/etcd/pkg/srv", - "revision": "7a759c18d294698f537f8be91927354818a71e51", - "revisionTime": "2018-10-15T17:54:34Z" + "revision": "de8e29e71ccfed8ecb2d3102f2ea78c627a528c0", + "revisionTime": "2019-01-22T19:19:15Z" }, { "checksumSHA1": "Xf7TwBAdBTSSeTlEzqFH1Deglbk=", "path": "go.etcd.io/etcd/pkg/systemd", - "revision": "7a759c18d294698f537f8be91927354818a71e51", - "revisionTime": "2018-10-15T17:54:34Z" + "revision": "de8e29e71ccfed8ecb2d3102f2ea78c627a528c0", + "revisionTime": "2019-01-22T19:19:15Z" }, { "checksumSHA1": "yl9eTlZ74Ixe7WxHQaO6rWJq+tU=", "path": "go.etcd.io/etcd/pkg/tlsutil", - "revision": "7a759c18d294698f537f8be91927354818a71e51", - "revisionTime": "2018-10-15T17:54:34Z" + "revision": "de8e29e71ccfed8ecb2d3102f2ea78c627a528c0", + "revisionTime": "2019-01-22T19:19:15Z" }, { "checksumSHA1": "YQD4i+Li76ogXqgKS62MJVf1agE=", "path": "go.etcd.io/etcd/pkg/transport", - "revision": "7a759c18d294698f537f8be91927354818a71e51", - "revisionTime": "2018-10-15T17:54:34Z" + "revision": "de8e29e71ccfed8ecb2d3102f2ea78c627a528c0", + "revisionTime": "2019-01-22T19:19:15Z" }, { "checksumSHA1": "VL9HsNKbbCb1Ntj9VcFCfiTmjmM=", "path": "go.etcd.io/etcd/pkg/types", - "revision": "7a759c18d294698f537f8be91927354818a71e51", - "revisionTime": "2018-10-15T17:54:34Z" + "revision": "de8e29e71ccfed8ecb2d3102f2ea78c627a528c0", + "revisionTime": "2019-01-22T19:19:15Z" }, { - "checksumSHA1": "b6/18Kp2W5oWnbgqIq6Ks3FKOBk=", + "checksumSHA1": "G5GOx28aUKrnslEBisXvZtlQdmE=", "path": "go.etcd.io/etcd/raft", - "revision": "7a759c18d294698f537f8be91927354818a71e51", - "revisionTime": "2018-10-15T17:54:34Z" + "revision": "de8e29e71ccfed8ecb2d3102f2ea78c627a528c0", + "revisionTime": "2019-01-22T19:19:15Z" }, { "checksumSHA1": "0ZI+YcuXXszApIhI+HcsmIcSVgg=", "path": "go.etcd.io/etcd/raft/raftpb", - "revision": "7a759c18d294698f537f8be91927354818a71e51", - "revisionTime": "2018-10-15T17:54:34Z" + "revision": "de8e29e71ccfed8ecb2d3102f2ea78c627a528c0", + "revisionTime": "2019-01-22T19:19:15Z" }, { "checksumSHA1": "Vyt9fFWEV2/sagq9KmkVbPn+LFM=", "path": "go.etcd.io/etcd/version", - "revision": "7a759c18d294698f537f8be91927354818a71e51", - "revisionTime": "2018-10-15T17:54:34Z" + "revision": "de8e29e71ccfed8ecb2d3102f2ea78c627a528c0", + "revisionTime": "2019-01-22T19:19:15Z" }, { "checksumSHA1": "FYNpZ/C+tTLe/JMqvIPybkoBh2Y=", diff --git a/website/source/docs/configuration/storage/etcd.html.md b/website/source/docs/configuration/storage/etcd.html.md index 8ad574d13da0..81100984fa4b 100644 --- a/website/source/docs/configuration/storage/etcd.html.md +++ b/website/source/docs/configuration/storage/etcd.html.md @@ -41,6 +41,10 @@ storage "etcd" { query for SRV records describing cluster endpoints. This can also be provided via the environment variable `ETCD_DISCOVERY_SRV`. +- `discovery_srv_name` `(string: "vault")` - Specifies the service name to use + when querying for SRV records describing cluster endpoints. This can also be + provided via the environment variable `ETCD_DISCOVERY_SRV_NAME`. + - `etcd_api` `(string: "")` – Specifies the version of the API to communicate with. By default, this is derived automatically. If the cluster version is 3.1+ and there has been no data written using the v2 API, the