mirror of https://github.com/tidwall/tile38.git
Merge pull request #702 from LLluma/bug_sqs_url_china_region
[BUG] Fix AWS SQS base domain parsing for China region
This commit is contained in:
commit
ee61cd11c1
|
@ -132,13 +132,13 @@ func newSQSConn(ep Endpoint) *SQSConn {
|
||||||
func probeSQS(s string) bool {
|
func probeSQS(s string) bool {
|
||||||
// https://sqs.eu-central-1.amazonaws.com/123456789/myqueue
|
// https://sqs.eu-central-1.amazonaws.com/123456789/myqueue
|
||||||
return strings.HasPrefix(s, "https://sqs.") &&
|
return strings.HasPrefix(s, "https://sqs.") &&
|
||||||
strings.Contains(s, ".amazonaws.com/")
|
strings.Contains(s, ".amazonaws.com")
|
||||||
}
|
}
|
||||||
|
|
||||||
func sqsRegionFromPlainURL(s string) string {
|
func sqsRegionFromPlainURL(s string) string {
|
||||||
parts := strings.Split(s, "https://sqs.")
|
parts := strings.Split(s, "https://sqs.")
|
||||||
if len(parts) > 1 {
|
if len(parts) > 1 {
|
||||||
parts = strings.Split(parts[1], ".amazonaws.com/")
|
parts = strings.Split(parts[1], ".amazonaws.com")
|
||||||
if len(parts) > 1 {
|
if len(parts) > 1 {
|
||||||
return parts[0]
|
return parts[0]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue