public ReusableTask AddTrackerAsync(Uri trackerUri) { if (Private) { throw new InvalidOperationException("Cannot add trackers to a private Torrent"); } var tracker = TrackerFactory.Create(trackerUri); if (tracker != null) { return(AddTrackerAsync(tracker)); } else { throw new NotSupportedException($"TrackerFactory.Create could not create an ITracker for this {trackerUri}."); } }
public void Setup() { keys.Clear(); server = new TrackerServer(trackerId); server.AllowUnregisteredTorrents = true; server.RegisterListener(listener); tracker = (HTTPTracker)TrackerFactory.Create(AnnounceUrl); var infoHashBytes = new [] { ' ', '%', '&', '?', '&', '&', '?', '5', '1', '=' } .Select(t => (byte)t); infoHash = new InfoHash(infoHashBytes.Concat(infoHashBytes).ToArray()); announceParams = new AnnounceParameters() .WithPeerId(peerId) .WithInfoHash(infoHash); scrapeParams = new ScrapeParameters(new InfoHash(new byte[20])); }
public void Setup() { keys = new List <BEncodedString> (); server = new MonoTorrent.Tracker.TrackerServer(); server.AllowUnregisteredTorrents = true; server.RegisterListener(listener); peerEndpoints = new List <IPEndPoint> { new IPEndPoint(IPAddress.Parse("123.123.123.123"), 12312), new IPEndPoint(IPAddress.Parse("254.254.254.254"), 3522), new IPEndPoint(IPAddress.Parse("1.1.1.1"), 123), new IPEndPoint(IPAddress.Parse("1.2.3.4"), 65000), }; tracker = (UdpTracker)TrackerFactory.Create(new Uri($"udp://127.0.0.1:{listener.EndPoint.Port}/announce/")); announceparams = announceparams.WithPort(listener.EndPoint.Port); listener.IgnoreAnnounces = false; listener.IgnoreConnects = false; listener.IgnoreErrors = false; listener.IgnoreScrapes = false; listener.IncompleteAnnounce = listener.IncompleteConnect = listener.IncompleteScrape = false; }