From 9fbd06521b65f5f3adf29c4d09c09e942edf253b Mon Sep 17 00:00:00 2001 From: cenk <391865+cenk@users.noreply.github.com> Date: Mon, 10 Jul 2023 17:58:33 +0300 Subject: [PATCH 1/2] Allow ignoring (".") names in logs and stats. Closes #5990 --- internal/aghnet/hostgen.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/aghnet/hostgen.go b/internal/aghnet/hostgen.go index e4031f5423c..4eb5013c427 100644 --- a/internal/aghnet/hostgen.go +++ b/internal/aghnet/hostgen.go @@ -42,9 +42,10 @@ func NewDomainNameSet(list []string) (set *stringutil.Set, err error) { set = stringutil.NewSet() for i, v := range list { - host := strings.ToLower(strings.TrimSuffix(v, ".")) - // TODO(a.garipov): Think about ignoring empty (".") names in the - // future. + if v != "." { + host := strings.ToLower(strings.TrimSuffix(v, ".")) + } + if host == "" { return nil, errors.Error("host name is empty") } From 8c5ce8af36083ca7d3db5410ffa0f506f6475e7c Mon Sep 17 00:00:00 2001 From: cenk <391865+cenk@users.noreply.github.com> Date: Mon, 10 Jul 2023 18:22:08 +0300 Subject: [PATCH 2/2] Remove white spaces --- internal/aghnet/hostgen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/aghnet/hostgen.go b/internal/aghnet/hostgen.go index 4eb5013c427..70517d8492f 100644 --- a/internal/aghnet/hostgen.go +++ b/internal/aghnet/hostgen.go @@ -43,7 +43,7 @@ func NewDomainNameSet(list []string) (set *stringutil.Set, err error) { for i, v := range list { if v != "." { - host := strings.ToLower(strings.TrimSuffix(v, ".")) + host := strings.ToLower(strings.TrimSuffix(v, ".")) } if host == "" {