Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
discovery
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢捷峰
discovery
Commits
14077df7
Commit
14077df7
authored
Jun 30, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改异常信息
parent
0fb76da8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
12 deletions
+8
-12
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/listener/impl/IpAddressFilterRegisterListener.java
+8
-12
No files found.
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/listener/impl/IpAddressFilterRegisterListener.java
View file @
14077df7
...
@@ -79,27 +79,23 @@ public class IpAddressFilterRegisterListener extends AbstractRegisterListener {
...
@@ -79,27 +79,23 @@ public class IpAddressFilterRegisterListener extends AbstractRegisterListener {
switch
(
filterType
)
{
switch
(
filterType
)
{
case
BLACKLIST:
case
BLACKLIST:
validateBlacklist
(
allFilterValueList
,
serviceId
,
ipAddress
,
port
);
validateBlacklist
(
filterType
,
allFilterValueList
,
serviceId
,
ipAddress
,
port
);
break
;
break
;
case
WHITELIST:
case
WHITELIST:
validateWhitelist
(
allFilterValueList
,
serviceId
,
ipAddress
,
port
);
validateWhitelist
(
filterType
,
allFilterValueList
,
serviceId
,
ipAddress
,
port
);
break
;
break
;
}
}
}
}
private
void
validateBlacklist
(
List
<
String
>
allFilterValueList
,
String
serviceId
,
String
ipAddress
,
int
port
)
{
private
void
validateBlacklist
(
FilterType
filterType
,
List
<
String
>
allFilterValueList
,
String
serviceId
,
String
ipAddress
,
int
port
)
{
LOG
.
info
(
"********** IP address blacklist={}, current ip address={} **********"
,
allFilterValueList
,
ipAddress
);
for
(
String
filterValue
:
allFilterValueList
)
{
for
(
String
filterValue
:
allFilterValueList
)
{
if
(
ipAddress
.
startsWith
(
filterValue
))
{
if
(
ipAddress
.
startsWith
(
filterValue
))
{
onRegisterFaiure
(
FilterType
.
BLACKLIST
,
serviceId
,
ipAddress
,
port
);
onRegisterFaiure
(
filterType
,
allFilterValueList
,
serviceId
,
ipAddress
,
port
);
}
}
}
}
}
}
private
void
validateWhitelist
(
List
<
String
>
allFilterValueList
,
String
serviceId
,
String
ipAddress
,
int
port
)
{
private
void
validateWhitelist
(
FilterType
filterType
,
List
<
String
>
allFilterValueList
,
String
serviceId
,
String
ipAddress
,
int
port
)
{
LOG
.
info
(
"********** IP address whitelist={}, current ip address={} **********"
,
allFilterValueList
,
ipAddress
);
boolean
matched
=
true
;
boolean
matched
=
true
;
for
(
String
filterValue
:
allFilterValueList
)
{
for
(
String
filterValue
:
allFilterValueList
)
{
if
(
ipAddress
.
startsWith
(
filterValue
))
{
if
(
ipAddress
.
startsWith
(
filterValue
))
{
...
@@ -109,17 +105,17 @@ public class IpAddressFilterRegisterListener extends AbstractRegisterListener {
...
@@ -109,17 +105,17 @@ public class IpAddressFilterRegisterListener extends AbstractRegisterListener {
}
}
if
(
matched
)
{
if
(
matched
)
{
onRegisterFaiure
(
FilterType
.
WHITELIST
,
serviceId
,
ipAddress
,
port
);
onRegisterFaiure
(
filterType
,
allFilterValueList
,
serviceId
,
ipAddress
,
port
);
}
}
}
}
private
void
onRegisterFaiure
(
FilterType
filterType
,
String
serviceId
,
String
ipAddress
,
int
port
)
{
private
void
onRegisterFaiure
(
FilterType
filterType
,
List
<
String
>
allFilterValueList
,
String
serviceId
,
String
ipAddress
,
int
port
)
{
Boolean
registerFailureEventEnabled
=
environment
.
getProperty
(
PluginConstant
.
SPRING_APPLICATION_REGISTER_FAILURE_EVENT_ENABLED
,
Boolean
.
class
,
Boolean
.
FALSE
);
Boolean
registerFailureEventEnabled
=
environment
.
getProperty
(
PluginConstant
.
SPRING_APPLICATION_REGISTER_FAILURE_EVENT_ENABLED
,
Boolean
.
class
,
Boolean
.
FALSE
);
if
(
registerFailureEventEnabled
)
{
if
(
registerFailureEventEnabled
)
{
pluginPublisher
.
asyncPublish
(
new
RegisterFaiureEvent
(
filterType
,
serviceId
,
ipAddress
,
port
));
pluginPublisher
.
asyncPublish
(
new
RegisterFaiureEvent
(
filterType
,
serviceId
,
ipAddress
,
port
));
}
}
throw
new
PluginException
(
ipAddress
+
" isn't allowed to register to
Discovery server, because it is in blacklist"
);
throw
new
PluginException
(
ipAddress
+
" isn't allowed to register to
Register server, not match IP address "
+
filterType
+
"="
+
allFilterValueList
);
}
}
@Override
@Override
...
...
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