IsVirtualHostSupported - verifies if bucketName can be part of virtual host. Currently only Amazon S3 and Google Cloud Storage would support this.
(endpointURL url.URL, bucketName string)
| 69 | // virtual host. Currently only Amazon S3 and Google Cloud Storage |
| 70 | // would support this. |
| 71 | func IsVirtualHostSupported(endpointURL url.URL, bucketName string) bool { |
| 72 | if endpointURL == sentinelURL { |
| 73 | return false |
| 74 | } |
| 75 | // bucketName can be valid but '.' in the hostname will fail SSL |
| 76 | // certificate validation. So do not use host-style for such buckets. |
| 77 | if endpointURL.Scheme == "https" && strings.Contains(bucketName, ".") { |
| 78 | return false |
| 79 | } |
| 80 | // Return true for all other cases |
| 81 | return IsAmazonEndpoint(endpointURL) || IsGoogleEndpoint(endpointURL) || IsAliyunOSSEndpoint(endpointURL) |
| 82 | } |
| 83 | |
| 84 | // Refer for region styles - https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region |
| 85 |