🩹 Fix: corrects ipv6 loopback ip shown on UI (#1517)

Author:    Rupesh Harode <rupeshharode@gmail.com>

Co-authored-by: Rupesh Harode <rupesh.harode@dailyrounds.org>
pull/1523/head
Rupesh Harode 2021-09-03 17:53:03 +05:30 committed by GitHub
parent 12c1bf91bc
commit 9dd39c0e55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

5
app.go
View File

@ -954,8 +954,13 @@ func (app *App) startupMessage(addr string, tls bool, pids string) {
host, port := parseAddr(addr)
if host == "" {
if app.config.Network == NetworkTCP6 {
host = "[::1]"
} else {
host = "0.0.0.0"
}
}
scheme := "http"
if tls {

View File

@ -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", ""},
}

View File

@ -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")