Package net.i2p.client.naming
Class HostsTxtNamingService
java.lang.Object
net.i2p.client.naming.NamingService
net.i2p.client.naming.DummyNamingService
net.i2p.client.naming.MetaNamingService
net.i2p.client.naming.HostsTxtNamingService
A naming service based on multiple "hosts.txt" files.
Supports .b32.i2p and {b64} lookups.
Supports caching.
All hostnames are converted to lower case.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
default hosts.txt filenamesstatic final String
If this system property is specified, the tunnel will read the given file for hostname=destKey values when resolving namesFields inherited from class net.i2p.client.naming.MetaNamingService
_services
Fields inherited from class net.i2p.client.naming.DummyNamingService
BASE32_HASH_LENGTH, CACHE_MAX_SIZE, DEST_SIZE, PROP_B32
Fields inherited from class net.i2p.client.naming.NamingService
_context, _listeners, _log, _updaters, PROP_IMPL
-
Constructor Summary
ConstructorDescriptionHostsTxtNamingService
(I2PAppContext context) The naming service should only be constructed and accessed through the application context. -
Method Summary
Modifier and TypeMethodDescriptiongetNames
(Properties options) All services aggregated, unless options contains the property "file", in which case only for that filelookup
(String hostname, Properties lookupOptions, Properties storedOptions) Same as lookup(hostname) but with in and out options Note that whether this (and lookup(hostname)) resolve Base 32 addresses in the form {52 chars}.b32.i2p is NamingService-specific.boolean
put
(String hostname, Destination d, Properties options) Stores in the last serviceboolean
putIfAbsent
(String hostname, Destination d, Properties options) Stores in the last serviceboolean
remove
(String hostname, Properties options) Removes from all servicesMethods inherited from class net.i2p.client.naming.MetaNamingService
addNamingService, export, getBase64Entries, getEntries, getNamingServices, registerListener, removeNamingService, reverseLookup, shutdown, size, unregisterListener
Methods inherited from class net.i2p.client.naming.DummyNamingService
clearCache, getCache, putCache, removeCache
Methods inherited from class net.i2p.client.naming.NamingService
addDestination, addDestination, addNamingService, createInstance, export, getConfiguration, getEntries, getName, getNames, getParent, lookup, lookup, lookupAll, lookupAll, lookupBase32, lookupBase64, put, putAll, putIfAbsent, registerUpdater, remove, remove, remove, requestUpdate, reverseLookup, reverseLookup, reverseLookupAll, reverseLookupAll, reverseLookupAll, setConfiguration, size, start, toString, unregisterUpdater, update
-
Field Details
-
PROP_HOSTS_FILE
If this system property is specified, the tunnel will read the given file for hostname=destKey values when resolving names- See Also:
-
DEFAULT_HOSTS_FILE
default hosts.txt filenames- See Also:
-
-
Constructor Details
-
HostsTxtNamingService
The naming service should only be constructed and accessed through the application context. This constructor should only be used by the appropriate application context itself.
-
-
Method Details
-
lookup
Description copied from class:NamingService
Same as lookup(hostname) but with in and out options Note that whether this (and lookup(hostname)) resolve Base 32 addresses in the form {52 chars}.b32.i2p is NamingService-specific.- Overrides:
lookup
in classMetaNamingService
- Parameters:
hostname
- mixed case as it could be a keylookupOptions
- input parameter, NamingService-specific, can be nullstoredOptions
- output parameter, NamingService-specific, any stored properties will be added if non-null- Returns:
- dest or null
-
put
Description copied from class:MetaNamingService
Stores in the last service- Overrides:
put
in classMetaNamingService
- Parameters:
options
- NamingService-specific, can be null- Returns:
- success
-
putIfAbsent
Description copied from class:MetaNamingService
Stores in the last service- Overrides:
putIfAbsent
in classMetaNamingService
- Parameters:
options
- NamingService-specific, can be null- Returns:
- success
-
remove
Description copied from class:MetaNamingService
Removes from all services- Overrides:
remove
in classMetaNamingService
- Parameters:
options
- NamingService-specific, can be null- Returns:
- true if removed successfully, false on error or if it did not exist
-
getNames
All services aggregated, unless options contains the property "file", in which case only for that file- Overrides:
getNames
in classMetaNamingService
- Parameters:
options
- NamingService-specific, can be null- Returns:
- all known hostnames (matching the options if non-null) or empty Set if none; Returned Set is not necessarily sorted, implementation dependent
-