mirror of
https://github.com/angryip/ipscan.git
synced 2025-10-26 11:18:17 +00:00
no need for a separate MACFetcher is CommentFetcher - MACFetcher will be activated by the PingerRegistry now for local networks (to do ARP ping)
This commit is contained in:
parent
339533c22f
commit
78e18f9b74
@ -178,11 +178,10 @@ public class ScanningSubject {
|
||||
}
|
||||
|
||||
public boolean isLocal() {
|
||||
return address.isSiteLocalAddress() || address.isLinkLocalAddress();
|
||||
return ifAddr != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
@Override public String toString() {
|
||||
StringBuilder sb = new StringBuilder(address.getHostAddress());
|
||||
if (requestedPorts != null) {
|
||||
sb.append(':');
|
||||
|
||||
@ -16,10 +16,8 @@ public class CommentFetcher extends AbstractFetcher {
|
||||
public static final String ID = "fetcher.comment";
|
||||
|
||||
private CommentsConfig commentsConfig;
|
||||
private MACFetcher macFetcher;
|
||||
|
||||
public CommentFetcher(MACFetcher macFetcher, CommentsConfig commentsConfig) {
|
||||
this.macFetcher = macFetcher;
|
||||
|
||||
public CommentFetcher(CommentsConfig commentsConfig) {
|
||||
this.commentsConfig = commentsConfig;
|
||||
}
|
||||
|
||||
@ -29,10 +27,6 @@ public class CommentFetcher extends AbstractFetcher {
|
||||
|
||||
public Object scan(ScanningSubject subject) {
|
||||
String mac = (String) subject.getParameter(MACFetcher.ID);
|
||||
if (mac == null && subject.isLocal()) {
|
||||
macFetcher.scan(subject);
|
||||
mac = (String) subject.getParameter(MACFetcher.ID);
|
||||
}
|
||||
return commentsConfig.getComment(subject.getAddress(), mac);
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ public class FetcherRegistryTest {
|
||||
ipFetcher = new IPFetcher();
|
||||
pingFetcher = new PingFetcher(null, null);
|
||||
hostnameFetcher = new HostnameFetcher();
|
||||
commentFetcher = new CommentFetcher(null, null);
|
||||
commentFetcher = new CommentFetcher(null);
|
||||
portsFetcher = new PortsFetcher(null);
|
||||
fetcherRegistry = new FetcherRegistry(asList(ipFetcher, pingFetcher, hostnameFetcher, commentFetcher, portsFetcher), preferences, null);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user