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
 
 
 
 
- 
 public class HostsTxtNamingService extends MetaNamingService 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 SummaryFields Modifier and Type Field Description static StringDEFAULT_HOSTS_FILEdefault hosts.txt filenamesstatic StringPROP_HOSTS_FILEIf this system property is specified, the tunnel will read the given file for hostname=destKey values when resolving names- 
Fields inherited from class net.i2p.client.naming.MetaNamingService_services
 - 
Fields inherited from class net.i2p.client.naming.DummyNamingServiceBASE32_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 SummaryConstructors Constructor Description HostsTxtNamingService(I2PAppContext context)The naming service should only be constructed and accessed through the application context.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>getNames(Properties options)All services aggregated, unless options contains the property "file", in which case only for that fileDestinationlookup(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.booleanput(String hostname, Destination d, Properties options)Stores in the last servicebooleanputIfAbsent(String hostname, Destination d, Properties options)Stores in the last servicebooleanremove(String hostname, Properties options)Removes from all services- 
Methods inherited from class net.i2p.client.naming.MetaNamingServiceaddNamingService, export, getBase64Entries, getEntries, getNamingServices, registerListener, removeNamingService, reverseLookup, shutdown, size, unregisterListener
 - 
Methods inherited from class net.i2p.client.naming.DummyNamingServiceclearCache, getCache, putCache, removeCache
 - 
Methods inherited from class net.i2p.client.naming.NamingServiceaddDestination, 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 Detail- 
PROP_HOSTS_FILEpublic static final String 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:
- Constant Field Values
 
 - 
DEFAULT_HOSTS_FILEpublic static final String DEFAULT_HOSTS_FILE default hosts.txt filenames- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
HostsTxtNamingServicepublic HostsTxtNamingService(I2PAppContext context) 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 Detail- 
lookuppublic Destination lookup(String hostname, Properties lookupOptions, Properties storedOptions) Description copied from class:NamingServiceSame 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:
- lookupin class- MetaNamingService
- Parameters:
- hostname- mixed case as it could be a key
- lookupOptions- input parameter, NamingService-specific, can be null
- storedOptions- output parameter, NamingService-specific, any stored properties will be added if non-null
- Returns:
- dest or null
 
 - 
putpublic boolean put(String hostname, Destination d, Properties options) Description copied from class:MetaNamingServiceStores in the last service- Overrides:
- putin class- MetaNamingService
- options- NamingService-specific, can be null
- Returns:
- success
 
 - 
putIfAbsentpublic boolean putIfAbsent(String hostname, Destination d, Properties options) Description copied from class:MetaNamingServiceStores in the last service- Overrides:
- putIfAbsentin class- MetaNamingService
- options- NamingService-specific, can be null
- Returns:
- success
 
 - 
removepublic boolean remove(String hostname, Properties options) Description copied from class:MetaNamingServiceRemoves from all services- Overrides:
- removein class- MetaNamingService
- options- NamingService-specific, can be null
- Returns:
- true if removed successfully, false on error or if it did not exist
 
 - 
getNamespublic Set<String> getNames(Properties options) All services aggregated, unless options contains the property "file", in which case only for that file- Overrides:
- getNamesin class- MetaNamingService
- 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
 
 
- 
 
-