config.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. "crypto/tls"
  17. "time"
  18. "google.golang.org/grpc"
  19. )
  20. type Config struct {
  21. // Endpoints is a list of URLs.
  22. Endpoints []string `json:"endpoints"`
  23. // AutoSyncInterval is the interval to update endpoints with its latest members.
  24. // 0 disables auto-sync. By default auto-sync is disabled.
  25. AutoSyncInterval time.Duration `json:"auto-sync-interval"`
  26. // DialTimeout is the timeout for failing to establish a connection.
  27. DialTimeout time.Duration `json:"dial-timeout"`
  28. // TLS holds the client secure credentials, if any.
  29. TLS *tls.Config
  30. // Username is a username for authentication.
  31. Username string `json:"username"`
  32. // Password is a password for authentication.
  33. Password string `json:"password"`
  34. // DialOptions is a list of dial options for the grpc client (e.g., for interceptors).
  35. DialOptions []grpc.DialOption
  36. }