config.go 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright 2016 The etcd Authors
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package clientv3
  15. import (
  16. "context"
  17. "crypto/tls"
  18. "time"
  19. "google.golang.org/grpc"
  20. )
  21. type Config struct {
  22. // Endpoints is a list of URLs.
  23. Endpoints []string `json:"endpoints"`
  24. // AutoSyncInterval is the interval to update endpoints with its latest members.
  25. // 0 disables auto-sync. By default auto-sync is disabled.
  26. AutoSyncInterval time.Duration `json:"auto-sync-interval"`
  27. // DialTimeout is the timeout for failing to establish a connection.
  28. DialTimeout time.Duration `json:"dial-timeout"`
  29. // DialKeepAliveTime is the time after which client pings the server to see if
  30. // transport is alive.
  31. DialKeepAliveTime time.Duration `json:"dial-keep-alive-time"`
  32. // DialKeepAliveTimeout is the time that the client waits for a response for the
  33. // keep-alive probe. If the response is not received in this time, the connection is closed.
  34. DialKeepAliveTimeout time.Duration `json:"dial-keep-alive-timeout"`
  35. // TLS holds the client secure credentials, if any.
  36. TLS *tls.Config
  37. // Username is a user name for authentication.
  38. Username string `json:"username"`
  39. // Password is a password for authentication.
  40. Password string `json:"password"`
  41. // RejectOldCluster when set will refuse to create a client against an outdated cluster.
  42. RejectOldCluster bool `json:"reject-old-cluster"`
  43. // DialOptions is a list of dial options for the grpc client (e.g., for interceptors).
  44. DialOptions []grpc.DialOption
  45. // Context is the default client context; it can be used to cancel grpc dial out and
  46. // other operations that do not have an explicit context.
  47. Context context.Context
  48. }