func Sign4(request *http.Request, credentials ...Credentials) *http.Request {
	keys := chooseKeys(credentials)
	if keys.SecurityToken != "" {
		request.Header.Set("X-Amz-Security-Token", keys.SecurityToken)
	}
	prepareRequestV4(request)
	meta := new(metadata)
	hashedCanonReq := hashedCanonicalRequestV4(request, meta)
	stringToSign := stringToSignV4(request, hashedCanonReq, meta)
	signingKey := signingKeyV4(keys.SecretAccessKey, meta.date, meta.region, meta.service)
	signature := signatureV4(signingKey, stringToSign)
	request.Header.Set("Authorization", buildAuthHeaderV4(signature, meta, keys))
	return request
}
Sign4 signs a request with Signed Signature Version 4.
package awsauth
import (
	"net/http"
	"net/url"
	"time"
)
type Credentials struct {
	AccessKeyID     string
	SecretAccessKey string
	SecurityToken   string `json:"Token"`
	Expiration      time.Time
}
func Sign(request *http.Request, credentials ...Credentials) *http.Request {
	service, _ := serviceAndRegion(request.URL.Host)
	signVersion := awsSignVersion[service]
	switch signVersion {
	case 2:
		return Sign2(request, credentials...)
	case 3:
		return Sign3(request, credentials...)
	case 4:
		return Sign4(request, credentials...)
	case -1:
		return SignS3(request, credentials...)
	}
	return nil
}