Class WebSeedEntry
java.lang.Object
com.frostwire.jlibtorrent.WebSeedEntry
Information about a web seed (HTTP/FTP server) providing torrent content.
WebSeedEntry represents a web server URL that provides files for a torrent.
Web seeding allows distributing content via HTTP/FTP servers alongside peer-to-peer
transfer. Useful for seeding large files from CDNs or reducing peer dependency.
See BEP 17 (URL seeds) and BEP 19 (HTTP/FTP seeding) for protocol details.
Understanding Web Seeds:
Web seeds provide an alternative source for torrent data:
- HTTP Downloads: Fetch pieces from web server (like regular HTTP)
- Redundancy: Supplement peer downloads if peers are slow/unavailable
- Seeding: Host files on web server without running bittorrent client
- CDN Integration: Use CDN to distribute content efficiently
Web Seed Types:
URL_SEED (BEP 17): - Standard URL seed format - Request: GET /path/to/file.torrent/16384-131072 - Requests byte range from file - Works with any HTTP server supporting range requests HTTP_SEED (BEP 19): - HTTP seed format by John Hoffman - Different request format for range retrieval - Optimized for seeding (no full file on each seed) - Less common than URL seeds
Accessing Web Seed Information:
// From TorrentInfo
TorrentInfo info = new TorrentInfo(torrentFile);
java.util.List<WebSeedEntry> webSeeds = info.webSeeds();
for (WebSeedEntry seed : webSeeds) {
// Get seed URL
String url = seed.url();
System.out.println(\"Web seed: \" + url);
// Get type
WebSeedEntry.Type type = seed.type();
System.out.println(\"Type: \" + type);
// Get authentication (if needed)
String auth = seed.auth();
if (auth != null && !auth.isEmpty()) {
System.out.println(\"Requires auth\");
}
// Get custom HTTP headers
java.util.ArrayList<Pair<String, String>> headers = seed.extraHeaders();
for (Pair<String, String> header : headers) {
System.out.println(\"Header: \" + header.first() + \" = \" + header.second());
}
}
Adding Web Seeds Programmatically:
AddTorrentParams params = new AddTorrentParams(); // Add web seed URL // Web seeds can be added to params for torrents without seeds in .torrent
Web Seed Authentication:
// From WebSeedEntry
String auth = seed.auth();
// Format: "username:password" (HTTP Basic Auth)
if (auth != null && !auth.isEmpty()) {
String[] parts = auth.split(\":\", 2);
String username = parts[0];
String password = parts.length > 1 ? parts[1] : \"\";
// Use for HTTP Basic Auth in request headers
}
Custom HTTP Headers:
// Get extra headers for web seed requests
java.util.ArrayList<Pair<String, String>> headers = seed.extraHeaders();
// Headers may include:
// - User-Agent
// - Accept-Language
// - Custom application headers
// - Authorization tokens
for (Pair<String, String> header : headers) {
String name = header.first();
String value = header.second();
// Add to HTTP request
}
URL Format Examples:
// URL seed for single file http://example.com/downloads/file.iso // URL seed for multi-file torrent http://cdn.example.com/content/ // With custom port http://example.com:8080/torrents/archive.tar.gz // Authenticated URL seed // auth field contains credentials separately
Performance Considerations:
- Web seeds supplement peer downloads; don't replace them
- Download speed limited by web server bandwidth
- HTTP requests have TCP setup overhead
- CDN web seeds typically faster than peer downloads
- Range requests must be supported by server (HTTP 206)
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumHttp seeds are different from url seeds in the protocol they use. -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
WebSeedEntry
public WebSeedEntry(com.frostwire.jlibtorrent.swig.web_seed_entry e)
-
-
Method Details
-
swig
public com.frostwire.jlibtorrent.swig.web_seed_entry swig() -
url
-
auth
Optional authentication. If this is set, it's passed in as HTTP basic auth to the web seed. The format is: username:password.- Returns:
-
extraHeaders
-
type
-