diff --git a/internal/updater/updater.go b/internal/updater/updater.go index 9b699947..475f5922 100644 --- a/internal/updater/updater.go +++ b/internal/updater/updater.go @@ -57,13 +57,7 @@ func detectIP(ctx context.Context, ppfmt pp.PP, } else { ppfmt.Warningf(pp.EmojiError, "Failed to detect the %s address", ipNet.Describe()) - if ShouldDisplayHints[HintDetectionTimeouts] && errors.Is(context.Cause(ctx), errTimeout) { - ppfmt.Infof(pp.EmojiHint, - "If your network is experiencing high latency, consider increasing DETECTION_TIMEOUT=%v", - c.DetectionTimeout, - ) - ShouldDisplayHints[HintDetectionTimeouts] = false - } else if ShouldDisplayHints[getHintIDForDetection(ipNet)] { + if ShouldDisplayHints[getHintIDForDetection(ipNet)] { switch ipNet { case ipnet.IP6: ppfmt.Infof(pp.EmojiHint, "If you are using Docker or Kubernetes, IPv6 often requires additional setups") //nolint:lll @@ -73,6 +67,12 @@ func detectIP(ctx context.Context, ppfmt pp.PP, ppfmt.Infof(pp.EmojiHint, "If your network does not support IPv4, you can disable it with IP4_PROVIDER=none") //nolint:lll } } + if ShouldDisplayHints[HintDetectionTimeouts] && errors.Is(context.Cause(ctx), errTimeout) { + ppfmt.Infof(pp.EmojiHint, + "If your network is experiencing high latency, consider increasing DETECTION_TIMEOUT=%v", + c.DetectionTimeout, + ) + } } ShouldDisplayHints[getHintIDForDetection(ipNet)] = false return ip, generateDetectMessage(ipNet, ok) diff --git a/internal/updater/updater_test.go b/internal/updater/updater_test.go index a593baa5..e6ac33c1 100644 --- a/internal/updater/updater_test.go +++ b/internal/updater/updater_test.go @@ -556,6 +556,7 @@ func TestUpdateIPs(t *testing.T) { }, ), p.EXPECT().Warningf(pp.EmojiError, "Failed to detect the %s address", "IPv4"), + p.EXPECT().Infof(pp.EmojiHint, "If your network does not support IPv4, you can disable it with IP4_PROVIDER=none"), //nolint:lll p.EXPECT().Infof(pp.EmojiHint, "If your network is experiencing high latency, consider increasing DETECTION_TIMEOUT=%v", time.Second), //nolint:lll ) },