blob: c32c96bc0dc9eed2488a6579503caf3ffdff7d76 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.provision.persistence;
import java.util.Optional;
import java.util.Set;
/**
* Interface for a basic DNS name resolver.
*
* @author mpolden
*/
public interface NameResolver {
/** Resolve {@link RecordType#A} and {@link RecordType#AAAA} records for given name */
Set<String> resolveAll(String name);
/** Resolve given record type(s) for given name */
Set<String> resolve(String name, RecordType first, RecordType... rest);
/** Resolve hostname from given IP address, if any exist */
Optional<String> resolveHostname(String ipAddress);
/** DNS record types */
enum RecordType {
A("A", "IPv4 address"),
AAAA("AAAA", "IPv6 address");
private final String value;
private final String description;
public String value() { return value; }
public String description() { return description; }
RecordType(String value, String description) {
this.value = value;
this.description = description;
}
}
}
|