Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
torgiren
External Dns
Commits
79ca84a9
Unverified
Commit
79ca84a9
authored
6 years ago
by
Nick Jüttner
Committed by
GitHub
6 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Revert "Fix domain-filter matching logic to not match similar domain names"
parent
2668b9f4
revert-736-fix-domainfilter
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
provider/domain_filter.go
+1
-10
provider/domain_filter.go
provider/domain_filter_test.go
+0
-30
provider/domain_filter_test.go
with
1 addition
and
40 deletions
+1
-40
provider/domain_filter.go
+
1
-
10
View file @
79ca84a9
...
...
@@ -46,17 +46,8 @@ func (df DomainFilter) Match(domain string) bool {
}
for
_
,
filter
:=
range
df
.
filters
{
strippedDomain
:=
strings
.
TrimSuffix
(
domain
,
"."
)
if
filter
==
""
{
return
true
}
else
if
strings
.
HasPrefix
(
filter
,
"."
)
&&
strings
.
HasSuffix
(
strippedDomain
,
filter
)
{
return
true
}
else
if
strings
.
Count
(
strippedDomain
,
"."
)
==
strings
.
Count
(
filter
,
"."
)
{
if
strippedDomain
==
filter
{
return
true
}
}
else
if
strings
.
HasSuffix
(
strippedDomain
,
"."
+
filter
)
{
if
strings
.
HasSuffix
(
strings
.
TrimSuffix
(
domain
,
"."
),
filter
)
{
return
true
}
}
...
...
This diff is collapsed.
Click to expand it.
provider/domain_filter_test.go
+
0
-
30
View file @
79ca84a9
...
...
@@ -99,36 +99,6 @@ var domainFilterTests = []domainFilterTest{
[]
string
{
"foo.bar.sub.example.org"
},
true
,
},
{
[]
string
{
"example.org"
},
[]
string
{
"anexample.org"
,
"test.anexample.org"
},
false
,
},
{
[]
string
{
".example.org"
},
[]
string
{
"anexample.org"
,
"test.anexample.org"
},
false
,
},
{
[]
string
{
".example.org"
},
[]
string
{
"example.org"
},
false
,
},
{
[]
string
{
".example.org"
},
[]
string
{
"test.example.org"
},
true
,
},
{
[]
string
{
"anexample.org"
},
[]
string
{
"example.org"
,
"test.example.org"
},
false
,
},
{
[]
string
{
".org"
},
[]
string
{
"example.org"
,
"test.example.org"
,
"foo.test.example.org"
},
true
,
},
}
func
TestDomainFilterMatch
(
t
*
testing
.
T
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help