service_v1.go 876 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package registry
  2. import "net/url"
  3. func (s *DefaultService) lookupV1Endpoints(hostname string) (endpoints []APIEndpoint, err error) {
  4. if hostname == DefaultNamespace || hostname == DefaultV2Registry.Host || hostname == IndexHostname {
  5. return []APIEndpoint{}, nil
  6. }
  7. tlsConfig, err := s.tlsConfig(hostname)
  8. if err != nil {
  9. return nil, err
  10. }
  11. endpoints = []APIEndpoint{
  12. {
  13. URL: &url.URL{
  14. Scheme: "https",
  15. Host: hostname,
  16. },
  17. Version: APIVersion1,
  18. TrimHostname: true,
  19. TLSConfig: tlsConfig,
  20. },
  21. }
  22. if tlsConfig.InsecureSkipVerify {
  23. endpoints = append(endpoints, APIEndpoint{ // or this
  24. URL: &url.URL{
  25. Scheme: "http",
  26. Host: hostname,
  27. },
  28. Version: APIVersion1,
  29. TrimHostname: true,
  30. // used to check if supposed to be secure via InsecureSkipVerify
  31. TLSConfig: tlsConfig,
  32. })
  33. }
  34. return endpoints, nil
  35. }