defs.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Package core contains core definitions for the transport package,
  2. // the most salient of which is likely the Identity type. This type is
  3. // used to build a Transport instance.
  4. //
  5. // The TLS configurations provided here are designed for three
  6. // scenarios: mutual authentication for a clients, mutual
  7. // authentication for servers, and a general-purpose server
  8. // configuration applicable where mutual authentication is not
  9. // appropriate.
  10. //
  11. package core
  12. import (
  13. "time"
  14. "github.com/cloudflare/cfssl/csr"
  15. )
  16. // A Root stores information about a trusted root.
  17. type Root struct {
  18. // Type should contain a string identifier for the type.
  19. Type string `json:"type"`
  20. // Metadata contains the information needed to load the
  21. // root(s).
  22. Metadata map[string]string `json:"metadata"`
  23. }
  24. // Identity is used to store information about a particular transport.
  25. type Identity struct {
  26. // Request contains metadata for constructing certificate requests.
  27. Request *csr.CertificateRequest `json:"request"`
  28. // Roots contains a list of sources for trusted roots.
  29. Roots []*Root `json:"roots"`
  30. // ClientRoots contains a list of sources for trusted client
  31. // certificates.
  32. ClientRoots []*Root `json:"client_roots"`
  33. // Profiles contains a dictionary of names to dictionaries;
  34. // this is intended to allow flexibility in supporting
  35. // multiple configurations.
  36. Profiles map[string]map[string]string `json:"profiles"`
  37. }
  38. // DefaultBefore is a sensible default; attempt to regenerate certificates the
  39. // day before they expire.
  40. var DefaultBefore = 24 * time.Hour
  41. // CipherSuites are the TLS cipher suites that should be used by CloudFlare programs.
  42. var CipherSuites = []uint16{
  43. // These are manually specified because the SHA384 suites are
  44. // not specified in Go 1.4; in Go 1.4, they won't actually
  45. // be sent.
  46. 0xc030, // TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
  47. 0xc02c, // TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
  48. 0xc02f, // TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
  49. 0xc02b, // TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
  50. }