package bootstrap;
import sun.net.spi.nameservice.NameService;
import sun.net.spi.nameservice.NameServiceDescriptor;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class BootstrapServer {
public static void main(String[] args) throws Exception {
// --- Read hostname from JVM property ---
String forcedHost = System.getProperty("forced.hostname", "egtpsga56.nam.nsroot.net");
String forcedIP = System.getProperty("forced.ip", "10.167.188.246"); // optional IP override
// --- Install custom NameService ---
System.setProperty("sun.net.spi.nameservice.provider.1", "dns,fake");
System.setProperty("sun.net.spi.nameservice.provider.2", "default");
// Set static fields in FakeNameService for bootstrap
FakeNameService.forcedHost = forcedHost;
FakeNameService.forcedIP = forcedIP;
// --- Delegate to real external main class ---
com.citigroup.get.quantum.server.Server.main(args);
}
// --- Custom NameService ---
public static class FakeNameService implements NameService {
static String forcedHost;
static String forcedIP;
@Override
public InetAddress[] lookupAllHostAddr(String host) throws UnknownHostException {
if (host.equalsIgnoreCase(InetAddress.getLocalHost().getHostName()) || host.equalsIgnoreCase("localhost")) {
return new InetAddress[]{InetAddress.getByName(forcedIP)};
}
return InetAddress.getAllByName(host);
}
@Override
public String getHostByAddr(byte[] addr) throws UnknownHostException {
return forcedHost;
}
}
// --- NameServiceDescriptor required by JVM ---
public static class FakeNameServiceDescriptor implements NameServiceDescriptor {
@Override
public NameService createNameService() {
return new FakeNameService();
}
@Override
public String getProviderName() { return "fake"; }
@Override
public String getType() { return "dns"; }
}
}
==============
jvmArgs(
"-Dforced.hostname=egtpsga56.nam.nsroot.net",
"-Dforced.ip=10.167.188.246",
)
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)