WIP: udp: add ipv6 support

Returning IPv6 peers doesn't really work with UDP. It is not supported by
https://libtorrent.org/udp_tracker_protocol.html. There is a suggestion in
https://web.archive.org/web/20170503181830/http://opentracker.blog.h3q.com/2007/12/28/the-ipv6-situation/
of using action number 4 and returning IPv6 octets just like for IPv4
addresses. Clients seem not to support it very well, but due to a lack of
alternative solutions, it is implemented here
This commit is contained in:
Joakim Frostegård 2020-07-31 05:37:58 +02:00
parent bdb6aced1c
commit a3a1d1606b
8 changed files with 230 additions and 111 deletions

View file

@ -96,7 +96,7 @@ pub fn handle_announce_requests(
let valid_until = ValidUntil::new(config.cleaning.max_peer_age);
responses.extend(requests.map(|(request_sender_meta, request)| {
let peer_ip = convert_ipv4_mapped_ipv4(
let peer_ip = convert_ipv4_mapped_ipv6(
request_sender_meta.peer_addr.ip()
);
@ -262,7 +262,7 @@ pub fn handle_scrape_requests(
files: BTreeMap::new(),
};
let peer_ip = convert_ipv4_mapped_ipv4(
let peer_ip = convert_ipv4_mapped_ipv6(
meta.peer_addr.ip()
);