Class SettingsPack
-
Constructor Summary
ConstructorsConstructorDescriptionExample, how to turn on the DHT using SettingsPack. -
Method Summary
Modifier and TypeMethodDescriptionintactive_checkingis the limit of number of simultaneous checking torrents.activeChecking(int value) intactive_dht_limitis the max number of torrents to announce to the DHT.activeDhtLimit(int value) intactive_downloadscontrols how many active downloading torrents the queuing mechanism allows.activeDownloads(int value) intactive_limitis a hard limit on the number of active (auto managed) torrents.activeLimit(int value) active_limitis a hard limit on the number of active (auto managed) torrents.intactive_lsd_limitis the max number of torrents to announce to the local network over the local service discovery protocol.activeLsdLimit(int value) intactive_seedscontrols how many active seeding torrents the queuing mechanism allows.activeSeeds(int value) intactive_tracker_limitis the max number of torrents to announce to their trackers.activeTrackerLimit(int value) intalertQueueSize(int value) alert_queue_sizeis the maximum number of alerts queued up internally.booleananonymousMode(boolean value) defaults to false.voidclear()voidclear(int name) intconnectionsLimit(int value) Sets a global limit on the number of connections opened.intdhtUploadRate(int value) intdownloadRateLimit(int value) Sets the session-global limits of download rate limit, in bytes per second.booleangetBoolean(int name) byte[]getBytes(int name) This is a comma-separated list of IP port-pairs.intgetInteger(int name) intThe maximum allowed size (in bytes) to be received by the metadata extension, i.e.byte[]The fingerprint for the client.getString(int name) This is the STUN server used by WebTorrent to enable ICE NAT traversal for WebRTC.booleanhasValue(int name) Queries whether the specified configuration option has a value set in this pack.intinactivityTimeout(int value) if a peer is uninteresting and uninterested for longer than this number of seconds, it will be disconnected.booleanStarts the dht node and makes the trackerless service available to torrents.booleanStarts and stops Local Service Discovery.listenInterfaces(String value) intmaxPeerlistSize(int value) Sets the maximum number of peers in the list of known peers.intmaxQueuedDiskBytes(int value) Sets the maximum number of bytes a connection may have pending in the disk write queue before its download rate is being throttled.booleanseedingOutgoingConnections(boolean value) Determines if seeding (and finished) torrents should attempt to make outgoing connections or not.intsendBufferWatermark(int value) Sets the upper limit of the send buffer low-watermark.setBoolean(int name, boolean value) voidsetBytes(int name, byte[] value) voidsetDhtBootstrapNodes(String value) This is a comma-separated list of IP port-pairs.voidsetEnableDht(boolean value) Starts the dht node and makes the trackerless service available to torrents.voidsetEnableLsd(boolean value) Starts and stops Local Service Discovery.setInteger(int name, int value) voidsetMaxMetadataSize(int value) The maximum allowed size (in bytes) to be received by the metadata extension, i.e.voidsetPeerFingerprint(byte[] value) The fingerprint for the client.voidsetWebtorrentStunServer(String value) This is the STUN server used by WebTorrent to enable ICE NAT traversal for WebRTC.intstopTrackerTimeout(int value) stop_tracker_timeoutis the number of seconds to wait when sending a stopped message before considering a tracker to have timed out.swig()inttickInterval(int value) Specifies the number of milliseconds between internal ticks.intuploadRateLimit(int value) Sets the session-global limits of upload rate limit, in bytes per second.booleanvalidateHttpsTrackers(boolean value) validate_https_trackerswhen set to true, the certificate of HTTPS trackers and HTTPS web seeds will be validated against the system's certificate store (as defined by OpenSSL).
-
Constructor Details
-
SettingsPack
-
SettingsPack
public SettingsPack()Example, how to turn on the DHT using SettingsPack.SettingsPack pack = new SettingsPack(); pack.setBoolean(settings_pack.bool_types.enable_dht.swigValue(), on); s.applySettings(pack);
-
-
Method Details
-
swig
- Returns:
-
getBoolean
public boolean getBoolean(int name) - Parameters:
name-- Returns:
-
setBoolean
- Parameters:
name-value-
-
getInteger
public int getInteger(int name) - Parameters:
name-- Returns:
-
setInteger
- Parameters:
name-value-
-
getString
- Parameters:
name-- Returns:
-
setString
- Parameters:
name-value-
-
getBytes
public byte[] getBytes(int name) -
setBytes
public void setBytes(int name, byte[] value) -
clear
public void clear() -
clear
public void clear(int name) -
hasValue
public boolean hasValue(int name) Queries whether the specified configuration option has a value set in this pack. ``name`` can be any enumeration value from string_types, int_types or bool_types.- Parameters:
name- name id of the setting- Returns:
- true if present
-
getPeerFingerprint
public byte[] getPeerFingerprint()The fingerprint for the client. It will be used as the prefix to the peer-id. If this is 20 bytes (or longer) it will be truncated to 20 bytes and used as the entire peer-id. -
setPeerFingerprint
public void setPeerFingerprint(byte[] value) The fingerprint for the client. It will be used as the prefix to the peer-id. If this is 20 bytes (or longer) it will be truncated to 20 bytes and used as the entire peer-id. -
downloadRateLimit
public int downloadRateLimit()- Returns:
- the session-global download rate limit in bytes per second. (0 for unlimited)
-
downloadRateLimit
Sets the session-global limits of download rate limit, in bytes per second.A value of 0 means unlimited.
- Parameters:
value-
-
uploadRateLimit
public int uploadRateLimit()- Returns:
- the session-global upload rate limit in bytes per second. (0 for unlimited)
-
uploadRateLimit
Sets the session-global limits of upload rate limit, in bytes per second.A value of 0 means unlimited.
- Parameters:
value-
-
activeDownloads
public int activeDownloads()active_downloadscontrols how many active downloading torrents the queuing mechanism allows.The target number of active torrents is
min(active_downloads + active_seeds, active_limit).active_downloadsandactive_seedsare upper limits on the number of downloading torrents and seeding torrents respectively. Setting the value to -1 means unlimited.For auto managed torrents, these are the limits they are subject to. If there are too many torrents some of the auto managed ones will be paused until some slots free up.
You can have more torrents *active*, even though they are not announced to the DHT, lsd or their tracker. If some peer knows about you for any reason and tries to connect, it will still be accepted, unless the torrent is paused, which means it won't accept any connections.
For example if there are 10 seeding torrents and 10 downloading torrents, and ``active_downloads`` is 4 and ``active_seeds`` is 4, there will be 4 seeds active and 4 downloading torrents. If the settings are ``active_downloads`` = 2 and ``active_seeds`` = 4, then there will be 2 downloading torrents and 4 seeding torrents active. Torrents that are not auto managed are also counted against these limits. If there are non-auto managed torrents that use up all the slots, no auto managed torrent will be activated.
- Returns:
-
activeDownloads
- Parameters:
value-- See Also:
-
activeSeeds
public int activeSeeds()active_seedscontrols how many active seeding torrents the queuing mechanism allows.- Returns:
- See Also:
-
activeSeeds
- Parameters:
value-- See Also:
-
activeChecking
public int activeChecking()active_checkingis the limit of number of simultaneous checking torrents.- Returns:
- See Also:
-
activeChecking
- Parameters:
value-- See Also:
-
activeDhtLimit
public int activeDhtLimit()active_dht_limitis the max number of torrents to announce to the DHT. By default this is set to 88, which is no more than one DHT announce every 10 seconds.- Returns:
- See Also:
-
activeDhtLimit
- Parameters:
value-- See Also:
-
dhtUploadRate
public int dhtUploadRate() -
dhtUploadRate
-
activeTrackerLimit
public int activeTrackerLimit()active_tracker_limitis the max number of torrents to announce to their trackers. By default this is 360, which is no more than one announce every 5 seconds.- Returns:
- See Also:
-
activeTrackerLimit
- Parameters:
value-- See Also:
-
activeLsdLimit
public int activeLsdLimit()active_lsd_limitis the max number of torrents to announce to the local network over the local service discovery protocol. By default this is 80, which is no more than one announce every 5 seconds (assuming the default announce interval of 5 minutes).- Returns:
- See Also:
-
activeLsdLimit
- Parameters:
value-- See Also:
-
activeLimit
public int activeLimit()active_limitis a hard limit on the number of active (auto managed) torrents. This limit also applies to slow torrents.- Returns:
- the value
- See Also:
-
activeLimit
active_limitis a hard limit on the number of active (auto managed) torrents. This limit also applies to slow torrents.- Parameters:
value- the value- See Also:
-
connectionsLimit
public int connectionsLimit()- Returns:
- global limit on the number of connections opened.
-
connectionsLimit
Sets a global limit on the number of connections opened. The number of connections is set to a hard minimum of at least two per torrent, so if you set a too low connections limit, and open too many torrents, the limit will not be met.- Parameters:
value-
-
maxPeerlistSize
public int maxPeerlistSize()- Returns:
- the maximum number of peers in the list of known peers. (0 for unlimited)
-
maxPeerlistSize
Sets the maximum number of peers in the list of known peers. These peers are not necessarily connected, so this number should be much greater than the maximum number of connected peers. Peers are evicted from the cache when the list grows passed 90% of this limit, and once the size hits the limit, peers are no longer added to the list. If this limit is set to 0, there is no limit on how many peers we'll keep in the peer list.- Parameters:
value-
-
maxQueuedDiskBytes
public int maxQueuedDiskBytes()- Returns:
- the maximum number of bytes a connection may have pending in the disk write queue before its download rate is being throttled.
-
maxQueuedDiskBytes
Sets the maximum number of bytes a connection may have pending in the disk write queue before its download rate is being throttled. This prevents fast downloads to slow medias to allocate more memory indefinitely. This should be set to at least 16 kB to not completely disrupt normal downloads. If it's set to 0, you will be starving the disk thread and nothing will be written to disk. this is a per session setting.When this limit is reached, the peer connections will stop reading data from their sockets, until the disk thread catches up. Setting this too low will severely limit your download rate.
- Parameters:
value-
-
sendBufferWatermark
public int sendBufferWatermark()- Returns:
- the upper limit of the send buffer low-watermark.
-
sendBufferWatermark
Sets the upper limit of the send buffer low-watermark.if the send buffer has fewer bytes than this, we'll read another 16kB block onto it. If set too small, upload rate capacity will suffer. If set too high, memory will be wasted. The actual watermark may be lower than this in case the upload rate is low, this is the upper limit.
- Parameters:
value-
-
tickInterval
public int tickInterval()- Returns:
-
tickInterval
Specifies the number of milliseconds between internal ticks. This is the frequency with which bandwidth quota is distributed to peers. It should not be more than one second (i.e. 1000 ms). Setting this to a low value (around 100) means higher resolution bandwidth quota distribution, setting it to a higher value saves CPU cycles.- Parameters:
value-
-
inactivityTimeout
public int inactivityTimeout()- Returns:
-
inactivityTimeout
if a peer is uninteresting and uninterested for longer than this number of seconds, it will be disconnected. default is 10 minutes- Parameters:
value-
-
seedingOutgoingConnections
public boolean seedingOutgoingConnections()- Returns:
-
seedingOutgoingConnections
Determines if seeding (and finished) torrents should attempt to make outgoing connections or not. By default this is true. It may be set to false in very specific applications where the cost of making outgoing connections is high, and there are no or small benefits of doing so. For instance, if no nodes are behind a firewall or a NAT, seeds don't need to make outgoing connections.- Parameters:
value-
-
anonymousMode
public boolean anonymousMode()- Returns:
-
anonymousMode
defaults to false. When set to true, the client tries to hide its identity to a certain degree. The peer-ID will no longer include the client's fingerprint. The user-agent will be reset to an empty string. It will also try to not leak other identifying information, such as your local listen port, your IP etc.If you're using I2P, a VPN or a proxy, it might make sense to enable anonymous mode.
- Parameters:
value-
-
isEnableDht
public boolean isEnableDht()Starts the dht node and makes the trackerless service available to torrents.- Returns:
- true if enable
-
setEnableDht
public void setEnableDht(boolean value) Starts the dht node and makes the trackerless service available to torrents.- Parameters:
value- true if enable
-
isEnableLsd
public boolean isEnableLsd()Starts and stops Local Service Discovery. This service will broadcast the info-hashes of all the non-private torrents on the local network to look for peers on the same swarm within multicast reach.- Returns:
- true if enable
-
setEnableLsd
public void setEnableLsd(boolean value) Starts and stops Local Service Discovery. This service will broadcast the info-hashes of all the non-private torrents on the local network to look for peers on the same swarm within multicast reach.- Parameters:
value- true if enable
-
getMaxMetadataSize
public int getMaxMetadataSize()The maximum allowed size (in bytes) to be received by the metadata extension, i.e. magnet links. -
setMaxMetadataSize
public void setMaxMetadataSize(int value) The maximum allowed size (in bytes) to be received by the metadata extension, i.e. magnet links.- Parameters:
value- true if enable
-
getDhtBootstrapNodes
This is a comma-separated list of IP port-pairs. They will be added to the DHT node (if it's enabled) as back-up nodes in case we don't know of any.Changing these after the DHT has been started may not have any effect until the DHT is restarted.
-
setDhtBootstrapNodes
This is a comma-separated list of IP port-pairs. They will be added to the DHT node (if it's enabled) as back-up nodes in case we don't know of any.Changing these after the DHT has been started may not have any effect until the DHT is restarted.
- Parameters:
value- the IP port-pairs list
-
getWebtorrentStunServer
This is the STUN server used by WebTorrent to enable ICE NAT traversal for WebRTC. It must have the format ``hostname:port``. TODO: Uncomment code below when settings_pack.hpp from libtorrent master is merged to RC_2_0 See https://github.com/arvidn/libtorrent/blob/master/include/libtorrent/settings_pack.hpp#L370 -
setWebtorrentStunServer
This is the STUN server used by WebTorrent to enable ICE NAT traversal for WebRTC. It must have the format ``hostname:port``. TODO: Uncomment code below when settings_pack.hpp from libtorrent master is merged to RC_2_0 See https://github.com/arvidn/libtorrent/blob/master/include/libtorrent/settings_pack.hpp#L370- Parameters:
value- the STUN server endpoint
-
listenInterfaces
- Returns:
-
listenInterfaces
- Parameters:
value-- Returns:
- this
-
stopTrackerTimeout
public int stopTrackerTimeout()- Returns:
- the current value
- See Also:
-
stopTrackerTimeout
stop_tracker_timeoutis the number of seconds to wait when sending a stopped message before considering a tracker to have timed out. This is usually shorter, to make the client quit faster. If the value is set to 0, the connections to trackers with the stopped event are suppressed.- Parameters:
value- the new value- Returns:
- this
-
alertQueueSize
public int alertQueueSize()- Returns:
- the current value
- See Also:
-
alertQueueSize
alert_queue_sizeis the maximum number of alerts queued up internally. If alerts are not popped, the queue will eventually fill up to this level.- Parameters:
value- the new value- Returns:
- this
-
validateHttpsTrackers
validate_https_trackerswhen set to true, the certificate of HTTPS trackers and HTTPS web seeds will be validated against the system's certificate store (as defined by OpenSSL). If the system does not have a certificate store, this option may have to be disabled in order to get trackers and web seeds to work). -
validateHttpsTrackers
public boolean validateHttpsTrackers()
-