currently the docs say
upload_rate_limit and download_rate_limit sets the session-global limits of upload and download rate limits, in bytes per second. By default peers on the local network are not rate limited.
but they offer no solution...
use case:
simulate traffic between libtorrent instances running on localhost
this paragraph was removed 9 years ago in 116802f
These rate limits are only used for local peers (peers within the same subnet as the client itself) and it is only used when ignore_limits_on_local_network is set to true (which it is by default). These rate limits default to unthrottled, but can be useful in case you want to treat local peers preferentially, but not quite unthrottled.
but meanwhile, ignore_limits_on_local_network has been deprecated
in favor of set_peer_class_filter
ignore_limits_on_local_network
rate-limiting of local peers with ignore_limits_on_local_network
import libtorrent as lt
settings = lt.default_settings()
settings["upload_rate_limit"] = 1024**2
settings["download_rate_limit"] = 1024**2
# also apply upload_rate_limit and download_rate_limit
# to peers on the local network
# NOTE ignore_limits_on_local_network is deprecated
# in favor of set_peer_class_filter
settings["ignore_limits_on_local_network"] = False
ses = lt.session(settings)
set_peer_class_filter
|
// if set to true, upload, download and unchoke limits are ignored for |
|
// peers on the local network. This option is *DEPRECATED*, please use |
|
// set_peer_class_filter() instead. |
|
ignore_limits_on_local_network TORRENT_DEPRECATED_ENUM, |
rate-limiting of local peers with set_peer_class_filter
based on libtorrent/bindings/python/test.py
import libtorrent as lt
settings = lt.default_settings()
settings["upload_rate_limit"] = 1024**2
settings["download_rate_limit"] = 1024**2
ses = lt.session(settings)
# also apply upload_rate_limit and download_rate_limit
# to peers on the local network
# based on libtorrent/bindings/python/test.py
# settings = ses.get_settings()
# if settings.get("ignore_limits_on_local_network") == False:
# define limits for the default global class
pci = ses.get_peer_class(lt.session.global_peer_class_id)
pci["upload_limit"] = settings["upload_rate_limit"]
pci["download_limit"] = settings["download_rate_limit"]
ses.set_peer_class(lt.session.global_peer_class_id, pci)
# force all peers into class 0
pcf = lt.peer_class_type_filter()
# all TCP peers
pcf.add(lt.peer_class_type_filter.tcp_socket, lt.session.global_peer_class_id)
# all UDP peers
pcf.add(lt.peer_class_type_filter.utp_socket, lt.session.global_peer_class_id)
ses.set_peer_class_type_filter(pcf)
currently the docs say
but they offer no solution...
use case:
simulate traffic between libtorrent instances running on localhost
this paragraph was removed 9 years ago in 116802f
but meanwhile,
ignore_limits_on_local_networkhas been deprecatedin favor of
set_peer_class_filterignore_limits_on_local_network
rate-limiting of local peers with
ignore_limits_on_local_networkset_peer_class_filter
libtorrent/include/libtorrent/settings_pack.hpp
Lines 417 to 420 in 3eb0ca1
rate-limiting of local peers with
set_peer_class_filterbased on libtorrent/bindings/python/test.py