From 9dd39c0e55376b68b368a82f181446da8d96962f Mon Sep 17 00:00:00 2001 From: Rupesh Harode Date: Fri, 3 Sep 2021 17:53:03 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20=20Fix:=20corrects=20ipv6=20loop?= =?UTF-8?q?back=20ip=20shown=20on=20UI=20(#1517)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Author: Rupesh Harode Co-authored-by: Rupesh Harode --- app.go | 7 ++++++- helpers_test.go | 2 +- prefork_test.go | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app.go b/app.go index 8a776af4..66b6ef5c 100644 --- a/app.go +++ b/app.go @@ -954,9 +954,14 @@ func (app *App) startupMessage(addr string, tls bool, pids string) { host, port := parseAddr(addr) if host == "" { - host = "0.0.0.0" + if app.config.Network == NetworkTCP6 { + host = "[::1]" + } else { + host = "0.0.0.0" + } } + scheme := "http" if tls { scheme = "https" diff --git a/helpers_test.go b/helpers_test.go index 291d49a0..4597e37f 100644 --- a/helpers_test.go +++ b/helpers_test.go @@ -194,7 +194,7 @@ func Test_Utils_Parse_Address(t *testing.T) { testCases := []struct { addr, host, port string }{ - {"[::]:3000", "[::]", "3000"}, + {"[::1]:3000", "[::1]", "3000"}, {"127.0.0.1:3000", "127.0.0.1", "3000"}, {"/path/to/unix/socket", "/path/to/unix/socket", ""}, } diff --git a/prefork_test.go b/prefork_test.go index 73c92b53..0f879b98 100644 --- a/prefork_test.go +++ b/prefork_test.go @@ -31,7 +31,7 @@ func Test_App_Prefork_Child_Process(t *testing.T) { utils.AssertEqual(t, nil, app.Shutdown()) }() - utils.AssertEqual(t, nil, app.prefork(NetworkTCP6, "[::]:", nil)) + utils.AssertEqual(t, nil, app.prefork(NetworkTCP6, "[::1]:", nil)) // Create tls certificate cer, err := tls.LoadX509KeyPair("./.github/testdata/ssl.pem", "./.github/testdata/ssl.key")