From b767036966dbc59031bd0ba44c239a62c9aef828 Mon Sep 17 00:00:00 2001 From: mzz2017 <2017@duck.com> Date: Wed, 15 Feb 2023 23:06:44 +0800 Subject: [PATCH] chore: simplify some error prompt --- component/outbound/dialer/connectivity_check.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/component/outbound/dialer/connectivity_check.go b/component/outbound/dialer/connectivity_check.go index a9ffe6b..e320c25 100644 --- a/component/outbound/dialer/connectivity_check.go +++ b/component/outbound/dialer/connectivity_check.go @@ -463,8 +463,11 @@ func (d *Dialer) Check(timeout time.Duration, } else { // Append timeout if there is any error or unexpected status code. if err != nil { - if strings.Contains(err.Error(), "network is unreachable") { + if strings.HasSuffix(err.Error(), "network is unreachable") { err = fmt.Errorf("network is unreachable") + } else if strings.HasSuffix(err.Error(), "no suitable address found") || + strings.HasSuffix(err.Error(), "non-IPv4 address") { + err = fmt.Errorf("IPv%v is not supported", opts.networkType.IpVersion) } d.Log.WithFields(logrus.Fields{ "network": opts.networkType.String(),