public class NodeClientCore extends java.lang.Object implements Persistable
Modifier and Type | Class and Description |
---|---|
static interface |
NodeClientCore.SimpleRequestSenderCompletionListener |
Modifier and Type | Field and Description |
---|---|
UserAlertManager |
alerts |
ArchiveManager |
archiveManager |
PersistentStatsPutter |
bandwidthStatsPutter |
ClientContext |
clientContext |
ClientLayerPersister |
clientLayerPersister |
RealCompressor |
compressor |
java.lang.String |
formPassword
Must be included as a hidden field in order for any dangerous HTTP operation to complete successfully.
|
MemoryLimitedJobRunner |
memoryLimitedJobRunner |
Node |
node |
FilenameGenerator |
persistentFilenameGenerator |
MaybeEncryptedRandomAccessBufferFactory |
persistentRAFFactory |
PersistentTempBucketFactory |
persistentTempBucketFactory |
protected freenet.node.Persister |
persister
If true, requests are resumed lazily i.e.
|
RandomSource |
random |
RequestStarterGroup |
requestStarters |
DatastoreChecker |
storeChecker |
TempBucketFactory |
tempBucketFactory |
FilenameGenerator |
tempFilenameGenerator |
RequestTracker |
tracker |
USKManager |
uskManager |
Modifier and Type | Method and Description |
---|---|
boolean |
allowDownloadTo(java.io.File filename) |
boolean |
allowUploadFrom(java.io.File filename) |
void |
asyncGet(Key key,
boolean offersOnly,
RequestCompletionListener listener,
boolean canReadClientCache,
boolean canWriteClientCache,
boolean realTimeFlag,
boolean localOnly,
boolean ignoreStore)
Start an asynchronous fetch for the key, which will complete by calling
tripPendingKey() if successful, as well as calling the listener in most cases.
|
long |
checkRecentlyFailed(Key key,
boolean realTime) |
long |
countQueuedRequests() |
FilterCallback |
createFilterCallback(java.net.URI uri,
FoundURICallback cb) |
void |
dequeueOfferedKey(Key key) |
ProgramDirectory |
downloadsDir() |
java.io.File[] |
getAllowedDownloadDirs() |
java.io.File[] |
getAllowedUploadDirs() |
BookmarkManager |
getBookmarkManager() |
FreenetURI[] |
getBookmarkURIs() |
TextModeClientInterface |
getDirectTMCI() |
java.io.File |
getDownloadsDir() |
Executor |
getExecutor() |
FCPServer |
getFCPServer() |
FProxyToadlet |
getFProxy() |
HealingQueue |
getHealingQueue() |
LinkFilterExceptionProvider |
getLinkFilterExceptionProvider()
Returns the link filter exception provider of the node.
|
static int |
getMaxBackgroundUSKFetchers() |
long |
getMinDiskFreeLongTerm() |
long |
getMinDiskFreeShortTerm() |
java.lang.String |
getMyName() |
ClientRequest[] |
getPersistentRequests() |
java.io.File |
getPersistentTempDir() |
PluginStores |
getPluginStores() |
java.io.File |
getTempDir() |
TextModeClientInterfaceServer |
getTextModeClientInterface() |
Ticker |
getTicker() |
SimpleToadletServer |
getToadletContainer() |
boolean |
isAdvancedModeEnabled() |
boolean |
isDownloadDisabled() |
boolean |
isFProxyJavascriptEnabled() |
boolean |
isTestnetEnabled() |
boolean |
killedDatabase() |
boolean |
loadedDatabase() |
HighLevelSimpleClient |
makeClient(short prioClass)
Deprecated.
Only provided for compatibility with old plugins! Plugins must specify!
|
HighLevelSimpleClient |
makeClient(short prioClass,
boolean forceDontIgnoreTooManyPathComponents)
Deprecated.
Only provided for compatibility with old plugins! Plugins must specify!
|
HighLevelSimpleClient |
makeClient(short prioClass,
boolean forceDontIgnoreTooManyPathComponents,
boolean realTimeFlag) |
int |
maxBackgroundUSKFetchers() |
SimpleFieldSet |
persistThrottlesToFieldSet() |
void |
queueOfferedKey(Key key,
boolean realTime)
Queue the offered key.
|
void |
queueRandomReinsert(KeyBlock block) |
ClientKeyBlock |
realGetKey(ClientKey key,
boolean localOnly,
boolean ignoreStore,
boolean canWriteClientCache,
boolean realTimeFlag) |
void |
realPut(KeyBlock block,
boolean canWriteClientCache,
boolean forkOnCacheable,
boolean preferInsert,
boolean ignoreLowBackoff,
boolean realTimeFlag)
Start a local request to insert a block.
|
void |
realPutCHK(CHKBlock block,
boolean canWriteClientCache,
boolean forkOnCacheable,
boolean preferInsert,
boolean ignoreLowBackoff,
boolean realTimeFlag) |
void |
realPutSSK(SSKBlock block,
boolean canWriteClientCache,
boolean forkOnCacheable,
boolean preferInsert,
boolean ignoreLowBackoff,
boolean realTimeFlag) |
void |
setDirectTMCI(TextModeClientInterface i) |
protected void |
setDownloadAllowedDirs(java.lang.String[] val) |
void |
setFProxy(FProxyToadlet fproxy) |
protected void |
setUploadAllowedDirs(java.lang.String[] val) |
void |
setupMasterSecret(MasterSecret persistentSecret) |
void |
start(Config config) |
void |
storeConfig() |
protected void |
updatePersistentRAFSpaceLimit() |
boolean |
wantKey(Key key) |
public final PersistentStatsPutter bandwidthStatsPutter
public final USKManager uskManager
public final ArchiveManager archiveManager
public final RequestStarterGroup requestStarters
public final MemoryLimitedJobRunner memoryLimitedJobRunner
public final java.lang.String formPassword
Must be included as a hidden field in order for any dangerous HTTP operation to complete successfully.
The name of the variable is badly chosen: formPassword is an anti-CSRF token. As for when to use one, two rules:
1) if you're changing server side state, you need a POST request
2) all POST requests need an anti-CSRF token (the exception being a login page, where credentials -that are unpredictable to an attacker- are exchanged).
In practice this means that you must use POST whenever the request can change anything such as your database contents. Other words for this would be requests which change your database or "write" requests. Read-only requests can be GET. When processing the POST-request, you MUST validate that the received password matches this variable. If it does not, you must NOT process the request. In particular, you must NOT modify anything.
To produce a form which already contains the password, use PluginRespirator.addFormChild(freenet.support.HTMLNode, String, String)
.
To validate that the right password was received, use WebInterfaceToadlet.isFormPassword(HTTPRequest)
.
public final FilenameGenerator tempFilenameGenerator
public final FilenameGenerator persistentFilenameGenerator
public final TempBucketFactory tempBucketFactory
public final PersistentTempBucketFactory persistentTempBucketFactory
public final MaybeEncryptedRandomAccessBufferFactory persistentRAFFactory
public final ClientLayerPersister clientLayerPersister
public final Node node
public final RequestTracker tracker
public final RandomSource random
public final UserAlertManager alerts
public final RealCompressor compressor
protected final freenet.node.Persister persister
public final DatastoreChecker storeChecker
public final transient ClientContext clientContext
protected void updatePersistentRAFSpaceLimit()
public boolean isDownloadDisabled()
protected void setDownloadAllowedDirs(java.lang.String[] val)
protected void setUploadAllowedDirs(java.lang.String[] val)
public void start(Config config) throws NodeInitException
NodeInitException
public void asyncGet(Key key, boolean offersOnly, RequestCompletionListener listener, boolean canReadClientCache, boolean canWriteClientCache, boolean realTimeFlag, boolean localOnly, boolean ignoreStore)
key
- The key to fetch.offersOnly
- If true, only fetch the key from nodes that have offered it, using GetOfferedKeys,
don't do a normal fetch for it.listener
- The listener is called if we start a request and fail to fetch, and also in most
cases on success or on not starting one. FIXME it may not always be called e.g. on fetching the data
from the datastore - is this a problem?canReadClientCache
- Can this request read the client-cache?canWriteClientCache
- Can this request write the client-cache?realTimeFlag
- Is this a real-time request? False = this is a bulk request.localOnly
- If true, only check the datastore, don't create a request if nothing is found.ignoreStore
- If true, don't check the datastore, create a request immediately.public ClientKeyBlock realGetKey(ClientKey key, boolean localOnly, boolean ignoreStore, boolean canWriteClientCache, boolean realTimeFlag) throws LowLevelGetException
LowLevelGetException
public void realPut(KeyBlock block, boolean canWriteClientCache, boolean forkOnCacheable, boolean preferInsert, boolean ignoreLowBackoff, boolean realTimeFlag) throws LowLevelPutException
block
- canWriteClientCache
- LowLevelPutException
public void realPutCHK(CHKBlock block, boolean canWriteClientCache, boolean forkOnCacheable, boolean preferInsert, boolean ignoreLowBackoff, boolean realTimeFlag) throws LowLevelPutException
LowLevelPutException
public void realPutSSK(SSKBlock block, boolean canWriteClientCache, boolean forkOnCacheable, boolean preferInsert, boolean ignoreLowBackoff, boolean realTimeFlag) throws LowLevelPutException
LowLevelPutException
@Deprecated public HighLevelSimpleClient makeClient(short prioClass)
@Deprecated public HighLevelSimpleClient makeClient(short prioClass, boolean forceDontIgnoreTooManyPathComponents)
public HighLevelSimpleClient makeClient(short prioClass, boolean forceDontIgnoreTooManyPathComponents, boolean realTimeFlag)
prioClass
- The priority to run requests at.realTimeFlag
- If true, requests are latency-optimised. If false, they are
throughput-optimised. Fewer latency-optimised ("real time") requests are accepted
but their transfers are faster. Latency-optimised requests are expected to be bursty,
whereas throughput-optimised (bulk) requests can be constant.public FCPServer getFCPServer()
public FProxyToadlet getFProxy()
public SimpleToadletServer getToadletContainer()
public LinkFilterExceptionProvider getLinkFilterExceptionProvider()
toadlet container
.public TextModeClientInterfaceServer getTextModeClientInterface()
public void setFProxy(FProxyToadlet fproxy)
public TextModeClientInterface getDirectTMCI()
public void setDirectTMCI(TextModeClientInterface i)
public java.io.File getDownloadsDir()
public ProgramDirectory downloadsDir()
public HealingQueue getHealingQueue()
public void queueRandomReinsert(KeyBlock block)
public void storeConfig()
public boolean isTestnetEnabled()
public boolean isAdvancedModeEnabled()
public boolean isFProxyJavascriptEnabled()
public java.lang.String getMyName()
public FilterCallback createFilterCallback(java.net.URI uri, FoundURICallback cb)
public int maxBackgroundUSKFetchers()
public boolean allowDownloadTo(java.io.File filename)
public boolean allowUploadFrom(java.io.File filename)
public java.io.File[] getAllowedDownloadDirs()
public java.io.File[] getAllowedUploadDirs()
public SimpleFieldSet persistThrottlesToFieldSet()
persistThrottlesToFieldSet
in interface Persistable
public Ticker getTicker()
public Executor getExecutor()
public java.io.File getPersistentTempDir()
public java.io.File getTempDir()
public void queueOfferedKey(Key key, boolean realTime)
public void dequeueOfferedKey(Key key)
public BookmarkManager getBookmarkManager()
public FreenetURI[] getBookmarkURIs()
public long countQueuedRequests()
public static int getMaxBackgroundUSKFetchers()
public boolean wantKey(Key key)
public long checkRecentlyFailed(Key key, boolean realTime)
public PluginStores getPluginStores()
public long getMinDiskFreeLongTerm()
public long getMinDiskFreeShortTerm()
public boolean killedDatabase()
public ClientRequest[] getPersistentRequests()
public void setupMasterSecret(MasterSecret persistentSecret)
public boolean loadedDatabase()