support for ip address in announce
This commit is contained in:
@@ -238,6 +238,10 @@ namespace libtorrent
|
||||
// the number of seconds between chokes/unchokes
|
||||
int unchoke_interval;
|
||||
|
||||
// if this is set, this IP will be reported do the
|
||||
// tracker in the ip= parameter.
|
||||
address announce_ip;
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
// while this is true, the dht will note be used unless the
|
||||
// tracker is online
|
||||
|
@@ -411,6 +411,12 @@ namespace libtorrent
|
||||
std::min(req.num_want, 999));
|
||||
m_send_buffer += '&';
|
||||
}
|
||||
if (m_settings.announce_ip != address() && !url_has_argument(request, "ip"))
|
||||
{
|
||||
m_send_buffer += "ip=";
|
||||
m_send_buffer += m_settings.announce_ip.to_string();
|
||||
m_send_buffer += '&';
|
||||
}
|
||||
|
||||
#ifndef TORRENT_DISABLE_ENCRYPTION
|
||||
m_send_buffer += "supportcrypto=1&";
|
||||
|
@@ -307,6 +307,9 @@ namespace libtorrent
|
||||
// event
|
||||
detail::write_int32(req.event, out);
|
||||
// ip address
|
||||
if (m_settings.announce_ip != address() && m_settings.announce_ip.is_v4())
|
||||
detail::write_uint32(m_settings.announce_ip.to_v4().to_ulong(), out);
|
||||
else
|
||||
detail::write_int32(0, out);
|
||||
// key
|
||||
detail::write_int32(req.key, out);
|
||||
|
Reference in New Issue
Block a user