support for ip address in announce
This commit is contained in:
parent
b75a69cd47
commit
5b5f3b3ca2
|
@ -238,6 +238,10 @@ namespace libtorrent
|
||||||
// the number of seconds between chokes/unchokes
|
// the number of seconds between chokes/unchokes
|
||||||
int unchoke_interval;
|
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
|
#ifndef TORRENT_DISABLE_DHT
|
||||||
// while this is true, the dht will note be used unless the
|
// while this is true, the dht will note be used unless the
|
||||||
// tracker is online
|
// tracker is online
|
||||||
|
|
|
@ -411,6 +411,12 @@ namespace libtorrent
|
||||||
std::min(req.num_want, 999));
|
std::min(req.num_want, 999));
|
||||||
m_send_buffer += '&';
|
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
|
#ifndef TORRENT_DISABLE_ENCRYPTION
|
||||||
m_send_buffer += "supportcrypto=1&";
|
m_send_buffer += "supportcrypto=1&";
|
||||||
|
|
|
@ -307,7 +307,10 @@ namespace libtorrent
|
||||||
// event
|
// event
|
||||||
detail::write_int32(req.event, out);
|
detail::write_int32(req.event, out);
|
||||||
// ip address
|
// ip address
|
||||||
detail::write_int32(0, out);
|
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
|
// key
|
||||||
detail::write_int32(req.key, out);
|
detail::write_int32(req.key, out);
|
||||||
// num_want
|
// num_want
|
||||||
|
|
Loading…
Reference in New Issue