MCPcopy
hub / github.com/minio/minio-go / IsVirtualHostSupported

Function IsVirtualHostSupported

pkg/s3utils/utils.go:71–82  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

69// virtual host. Currently only Amazon S3 and Google Cloud Storage
70// would support this.
71func 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

Callers 2

Calls 4

IsAmazonEndpointFunction · 0.85
IsGoogleEndpointFunction · 0.85
IsAliyunOSSEndpointFunction · 0.85
ContainsMethod · 0.45

Tested by 1