for testing purpose

This commit is contained in:
Peter Hormanns 2019-10-04 18:08:05 +02:00
parent 8ecd2381a0
commit 8d017e93c7

View File

@ -7,6 +7,10 @@ import de.hsadmin.core.qserv.ProcessorException;
public class IPv6Trick { public class IPv6Trick {
private static final String IPv4_LOCALHOST = "127.0.0";
private static final String IPv6_LOCALHOST = "::1";
private static final String IPv6_LOCALHOST_ALT = "0:0:0:0:0:0:0:1";
private static final String IPv4_83_223_79 = "83.223.79"; // Alboin-Kontor Berlin private static final String IPv4_83_223_79 = "83.223.79"; // Alboin-Kontor Berlin
private static final String IPv4_83_223_91 = "83.223.91"; // Alboin-Kontor Berlin private static final String IPv4_83_223_91 = "83.223.91"; // Alboin-Kontor Berlin
private static final String IPv4_83_223_95 = "83.223.95"; // Alboin-Kontor Berlin private static final String IPv4_83_223_95 = "83.223.95"; // Alboin-Kontor Berlin
@ -42,6 +46,11 @@ public class IPv6Trick {
public static boolean isKnownRemote(final String remoteAddress) { public static boolean isKnownRemote(final String remoteAddress) {
boolean isKnown = false; boolean isKnown = false;
System.out.print(remoteAddress + "\n");
if (remoteAddress.startsWith(IPv4_LOCALHOST) || remoteAddress.startsWith(IPv6_LOCALHOST) || remoteAddress.startsWith(IPv6_LOCALHOST_ALT)) {
// localhost
isKnown = true;
}
if (remoteAddress.startsWith(IPv6_PREFIX_HS) || remoteAddress.startsWith(IPv6_PREFIX_HS_ALT)) { if (remoteAddress.startsWith(IPv6_PREFIX_HS) || remoteAddress.startsWith(IPv6_PREFIX_HS_ALT)) {
// Hostsharing IPv6 // Hostsharing IPv6
isKnown = true; isKnown = true;