[BUG] Fix AWS SQS base domain parsing for China region

For AWS China region base domain is slightly different than for
the rest world. It is `amazon.com.cn`.
Currently AWS domain is hard coded in the `sqs.go`. Would be nice if
that will be configured parameter.

But this is a minimal posible change which is not breaking exist code
and make possible to use it for AWS China region.
This commit is contained in:
Yaroslav Shumlianskyi 2023-08-22 21:56:20 +03:00
parent 1d8c1f96c2
commit 8ac31c6234
1 changed files with 2 additions and 2 deletions

View File

@ -132,13 +132,13 @@ func newSQSConn(ep Endpoint) *SQSConn {
func probeSQS(s string) bool {
// https://sqs.eu-central-1.amazonaws.com/123456789/myqueue
return strings.HasPrefix(s, "https://sqs.") &&
strings.Contains(s, ".amazonaws.com/")
strings.Contains(s, ".amazonaws.com")
}
func sqsRegionFromPlainURL(s string) string {
parts := strings.Split(s, "https://sqs.")
if len(parts) > 1 {
parts = strings.Split(parts[1], ".amazonaws.com/")
parts = strings.Split(parts[1], ".amazonaws.com")
if len(parts) > 1 {
return parts[0]
}