From 69ae12542504479b7d6a993bdcc1bd39c95f917f Mon Sep 17 00:00:00 2001 From: sibowen <1265368338@qq.com> Date: Thu, 17 Feb 2022 09:57:05 +0800 Subject: [PATCH] =?UTF-8?q?MayReplaceLocalhost=E6=9B=BF=E6=8D=A2127.0.0.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dtmcli/dtmimp/utils.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dtmcli/dtmimp/utils.go b/dtmcli/dtmimp/utils.go index cdfe466..285d186 100644 --- a/dtmcli/dtmimp/utils.go +++ b/dtmcli/dtmimp/utils.go @@ -144,7 +144,9 @@ func GetFuncName() string { // MayReplaceLocalhost when run in docker compose, change localhost to host.docker.internal for accessing host network func MayReplaceLocalhost(host string) string { if os.Getenv("IS_DOCKER") != "" { - return strings.Replace(host, "localhost", "host.docker.internal", 1) + return strings.Replace(strings.Replace(host, + "localhost", "host.docker.internal", 1), + "127.0.0.1", "host.docker.internal", 1) } return host }