func bucketNameFromReqParams(params interface{}) (string, bool) {
	b, _ := awsutil.ValuesAtPath(params, "Bucket")
	if len(b) == 0 {
		return "", false
	}
	if bucket, ok := b[0].(*string); ok {
		if bucketStr := aws.StringValue(bucket); bucketStr != "" {
			return bucketStr, true
		}
	}
	return "", false
}
Attempts to retrieve the bucket name from the request input parameters.
If no bucket is found, or the field is empty "", false will be returned.
package s3
import (
	"fmt"
	"net/url"
	"regexp"
	"strings"
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/awsutil"
	"github.com/aws/aws-sdk-go/aws/request"
)
type operationBlacklist []string
func (b operationBlacklist) Continue(r *request.Request) bool {
	for i := 0; i < len(b); i++ {
		if b[i] == r.Operation.Name {
			return false
		}
	}
	return true
}
var accelerateOpBlacklist = operationBlacklist{
	opListBuckets, opCreateBucket, opDeleteBucket,
}
func updateEndpointForS3Config(r *request.Request) {
	forceHostStyle := aws.BoolValue(r.Config.S3ForcePathStyle)
	accelerate := aws.BoolValue(r.Config.S3UseAccelerate)
	if accelerate && accelerateOpBlacklist.Continue(r) {
		if forceHostStyle {
			if r.Config.Logger != nil {
				r.Config.Logger.Log("ERROR: aws.Config.S3UseAccelerate is not compatible with aws.Config.S3ForcePathStyle, ignoring S3ForcePathStyle.")
			}
		}
		updateEndpointForAccelerate(r)
	} else if !forceHostStyle && r.Operation.Name != opGetBucketLocation {
		updateEndpointForHostStyle(r)
	}
}
func updateEndpointForHostStyle(r *request.Request) {
	bucket, ok := bucketNameFromReqParams(r.Params)
	if !ok {
		return
	}
	if !hostCompatibleBucketName(r.HTTPRequest.URL, bucket) {
		return
	}
	moveBucketToHost(r.HTTPRequest.URL, bucket)
}
var (
	accelElem = []byte("s3-accelerate.dualstack.")
)
func updateEndpointForAccelerate(r *request.Request) {
	bucket, ok := bucketNameFromReqParams(r.Params)
	if !ok {
		return
	}
	if !hostCompatibleBucketName(r.HTTPRequest.URL, bucket) {
		r.Error = awserr.New("InvalidParameterException",
			fmt.Sprintf("bucket name %s is not compatible with S3 Accelerate", bucket),
			nil)
		return
	}
	parts := strings.Split(r.HTTPRequest.URL.Host, ".")
	if len(parts) < 3 {
		r.Error = awserr.New("InvalidParameterExecption",
			fmt.Sprintf("unable to update endpoint host for S3 accelerate, hostname invalid, %s",
				r.HTTPRequest.URL.Host), nil)
		return
	}
	if parts[0] == "s3" || strings.HasPrefix(parts[0], "s3-") {
		parts[0] = "s3-accelerate"
	}
	for i := 1; i+1 < len(parts); i++ {
		if parts[i] == aws.StringValue(r.Config.Region) {
			parts = append(parts[:i], parts[i+1:]...)
			break
		}
	}
	r.HTTPRequest.URL.Host = strings.Join(parts, ".")
	moveBucketToHost(r.HTTPRequest.URL, bucket)
}