hostname = Name.fromString(host, root);
} catch (TextParseException e) {
throw new IllegalArgumentException("Invalid hostname '" + host + "'");
}
final ResolverConfig currentConfig = ResolverConfig.getCurrentConfig();
if (currentConfig != null) {
final Name[] searchPath = currentConfig.searchPath();
if (searchPath != null) {
for (Name domain : searchPath) {
if (hostname.subdomain(domain)) {
return hostname.relativize(domain).toString();
}