Link to tracking issues from BEP support table

type: documentation
This commit is contained in:
Casey Rodarmor 2020-01-30 01:21:20 -08:00
parent ff3a30ae21
commit 1a20f0d0b3
No known key found for this signature in database
GPG Key ID: 556186B153EC6FE0
3 changed files with 160 additions and 88 deletions

124
README.md
View File

@ -52,66 +52,66 @@ To force colored output, pass `--use-color always` on the command line.
### BEP Support ### BEP Support
| Symbol | Meaning | | Symbol | Meaning |
|--------------------|----------------| |--------------------|---------------------------------------|
| :white_check_mark: | Supported | | :white_check_mark: | Supported |
| :x: | Unsupported | | :x: | Unsupported (links to tracking issue) |
| :heavy_minus_sign: | Not Applicable | | :heavy_minus_sign: | Not Applicable |
| BEP | Status | Title | | BEP | Status | Title |
|:----------------------------------------------:|:------------------:|:-----------------------------------------------------------------| |:----------------------------------------------:|:-----------------------------------------------------:|:-----------------------------------------------------------------|
| [00](http://bittorrent.org/beps/bep_0000.html) | :heavy_minus_sign: | Index of BitTorrent Enhancement Proposals | | [00](http://bittorrent.org/beps/bep_0000.html) | :heavy_minus_sign: | Index of BitTorrent Enhancement Proposals |
| [01](http://bittorrent.org/beps/bep_0001.html) | :heavy_minus_sign: | The BitTorrent Enhancement Proposal Process | | [01](http://bittorrent.org/beps/bep_0001.html) | :heavy_minus_sign: | The BitTorrent Enhancement Proposal Process |
| [02](http://bittorrent.org/beps/bep_0002.html) | :heavy_minus_sign: | Sample reStructured Text BEP Template | | [02](http://bittorrent.org/beps/bep_0002.html) | :heavy_minus_sign: | Sample reStructured Text BEP Template |
| [03](http://bittorrent.org/beps/bep_0003.html) | :white_check_mark: | The BitTorrent Protocol Specification | | [03](http://bittorrent.org/beps/bep_0003.html) | :white_check_mark: | The BitTorrent Protocol Specification |
| [04](http://bittorrent.org/beps/bep_0004.html) | :heavy_minus_sign: | Assigned Numbers | | [04](http://bittorrent.org/beps/bep_0004.html) | :heavy_minus_sign: | Assigned Numbers |
| [05](http://bittorrent.org/beps/bep_0005.html) | :x: | DHT Protocol | | [05](http://bittorrent.org/beps/bep_0005.html) | [:x:](https://github.com/casey/intermodal/issues/90) | DHT Protocol |
| [06](http://bittorrent.org/beps/bep_0006.html) | :heavy_minus_sign: | Fast Extension | | [06](http://bittorrent.org/beps/bep_0006.html) | :heavy_minus_sign: | Fast Extension |
| [07](http://bittorrent.org/beps/bep_0007.html) | :heavy_minus_sign: | IPv6 Tracker Extension | | [07](http://bittorrent.org/beps/bep_0007.html) | :heavy_minus_sign: | IPv6 Tracker Extension |
| [08](http://bittorrent.org/beps/bep_0008.html) | :heavy_minus_sign: | Tracker Peer Obfuscation | | [08](http://bittorrent.org/beps/bep_0008.html) | :heavy_minus_sign: | Tracker Peer Obfuscation |
| [09](http://bittorrent.org/beps/bep_0009.html) | :x: | Extension for Peers to Send Metadata Files | | [09](http://bittorrent.org/beps/bep_0009.html) | [:x:](https://github.com/casey/intermodal/issues/91) | Extension for Peers to Send Metadata Files |
| [10](http://bittorrent.org/beps/bep_0010.html) | :heavy_minus_sign: | Extension Protocol | | [10](http://bittorrent.org/beps/bep_0010.html) | :heavy_minus_sign: | Extension Protocol |
| [11](http://bittorrent.org/beps/bep_0011.html) | :heavy_minus_sign: | Peer Exchange (PEX) | | [11](http://bittorrent.org/beps/bep_0011.html) | :heavy_minus_sign: | Peer Exchange (PEX) |
| [12](http://bittorrent.org/beps/bep_0012.html) | :white_check_mark: | Multitracker Metadata Extension | | [12](http://bittorrent.org/beps/bep_0012.html) | :white_check_mark: | Multitracker Metadata Extension |
| [14](http://bittorrent.org/beps/bep_0014.html) | :heavy_minus_sign: | Local Service Discovery | | [14](http://bittorrent.org/beps/bep_0014.html) | :heavy_minus_sign: | Local Service Discovery |
| [15](http://bittorrent.org/beps/bep_0015.html) | :heavy_minus_sign: | UDP Tracker Protocol for BitTorrent | | [15](http://bittorrent.org/beps/bep_0015.html) | :heavy_minus_sign: | UDP Tracker Protocol for BitTorrent |
| [16](http://bittorrent.org/beps/bep_0016.html) | :heavy_minus_sign: | Superseeding | | [16](http://bittorrent.org/beps/bep_0016.html) | :heavy_minus_sign: | Superseeding |
| [17](http://bittorrent.org/beps/bep_0017.html) | :x: | HTTP Seeding | | [17](http://bittorrent.org/beps/bep_0017.html) | [:x:](https://github.com/casey/intermodal/issues/92) | HTTP Seeding |
| [18](http://bittorrent.org/beps/bep_0018.html) | :heavy_minus_sign: | Search Engine Specificiation | | [18](http://bittorrent.org/beps/bep_0018.html) | :heavy_minus_sign: | Search Engine Specificiation |
| [19](http://bittorrent.org/beps/bep_0019.html) | :x: | WebSeed - HTTP/FTP Seeding (GetRight style) | | [19](http://bittorrent.org/beps/bep_0019.html) | [:x:](https://github.com/casey/intermodal/issues/93) | WebSeed - HTTP/FTP Seeding (GetRight style) |
| [20](http://bittorrent.org/beps/bep_0020.html) | :heavy_minus_sign: | Peer ID Conventions | | [20](http://bittorrent.org/beps/bep_0020.html) | :heavy_minus_sign: | Peer ID Conventions |
| [21](http://bittorrent.org/beps/bep_0021.html) | :heavy_minus_sign: | Extension for partial seeds | | [21](http://bittorrent.org/beps/bep_0021.html) | :heavy_minus_sign: | Extension for partial seeds |
| [22](http://bittorrent.org/beps/bep_0022.html) | :heavy_minus_sign: | BitTorrent Local Tracker Discovery Protocol | | [22](http://bittorrent.org/beps/bep_0022.html) | :heavy_minus_sign: | BitTorrent Local Tracker Discovery Protocol |
| [23](http://bittorrent.org/beps/bep_0023.html) | :heavy_minus_sign: | Tracker Returns Compact Peer Lists | | [23](http://bittorrent.org/beps/bep_0023.html) | :heavy_minus_sign: | Tracker Returns Compact Peer Lists |
| [24](http://bittorrent.org/beps/bep_0024.html) | :heavy_minus_sign: | Tracker Returns External IP | | [24](http://bittorrent.org/beps/bep_0024.html) | :heavy_minus_sign: | Tracker Returns External IP |
| [25](http://bittorrent.org/beps/bep_0025.html) | :heavy_minus_sign: | An Alternate BitTorrent Cache Discovery Protocol | | [25](http://bittorrent.org/beps/bep_0025.html) | :heavy_minus_sign: | An Alternate BitTorrent Cache Discovery Protocol |
| [26](http://bittorrent.org/beps/bep_0026.html) | :heavy_minus_sign: | Zeroconf Peer Advertising and Discovery | | [26](http://bittorrent.org/beps/bep_0026.html) | :heavy_minus_sign: | Zeroconf Peer Advertising and Discovery |
| [27](http://bittorrent.org/beps/bep_0027.html) | :white_check_mark: | Private Torrents | | [27](http://bittorrent.org/beps/bep_0027.html) | :white_check_mark: | Private Torrents |
| [28](http://bittorrent.org/beps/bep_0028.html) | :heavy_minus_sign: | Tracker exchange extension | | [28](http://bittorrent.org/beps/bep_0028.html) | :heavy_minus_sign: | Tracker exchange extension |
| [29](http://bittorrent.org/beps/bep_0029.html) | :heavy_minus_sign: | uTorrent transport protocol | | [29](http://bittorrent.org/beps/bep_0029.html) | :heavy_minus_sign: | uTorrent transport protocol |
| [30](http://bittorrent.org/beps/bep_0030.html) | :x: | Merkle hash torrent extension | | [30](http://bittorrent.org/beps/bep_0030.html) | [:x:](https://github.com/casey/intermodal/issues/94) | Merkle hash torrent extension |
| [31](http://bittorrent.org/beps/bep_0031.html) | :heavy_minus_sign: | Failure Retry Extension | | [31](http://bittorrent.org/beps/bep_0031.html) | :heavy_minus_sign: | Failure Retry Extension |
| [32](http://bittorrent.org/beps/bep_0032.html) | :heavy_minus_sign: | BitTorrent DHT Extensions for IPv6 | | [32](http://bittorrent.org/beps/bep_0032.html) | :heavy_minus_sign: | BitTorrent DHT Extensions for IPv6 |
| [33](http://bittorrent.org/beps/bep_0033.html) | :heavy_minus_sign: | DHT Scrapes | | [33](http://bittorrent.org/beps/bep_0033.html) | :heavy_minus_sign: | DHT Scrapes |
| [34](http://bittorrent.org/beps/bep_0034.html) | :x: | DNS Tracker Preferences | | [34](http://bittorrent.org/beps/bep_0034.html) | :heavy_minus_sign: | DNS Tracker Preferences |
| [35](http://bittorrent.org/beps/bep_0035.html) | :x: | Torrent Signing | | [35](http://bittorrent.org/beps/bep_0035.html) | [:x:](https://github.com/casey/intermodal/issues/96) | Torrent Signing |
| [36](http://bittorrent.org/beps/bep_0036.html) | :x: | Torrent RSS feeds | | [36](http://bittorrent.org/beps/bep_0036.html) | :heavy_minus_sign: | Torrent RSS feeds |
| [37](http://bittorrent.org/beps/bep_0037.html) | :heavy_minus_sign: | Anonymous BitTorrent over proxies | | [37](http://bittorrent.org/beps/bep_0037.html) | :heavy_minus_sign: | Anonymous BitTorrent over proxies |
| [38](http://bittorrent.org/beps/bep_0038.html) | :x: | Finding Local Data Via Torrent File Hints | | [38](http://bittorrent.org/beps/bep_0038.html) | :heavy_minus_sign: | Finding Local Data Via Torrent File Hints |
| [39](http://bittorrent.org/beps/bep_0039.html) | :x: | Updating Torrents Via Feed URL | | [39](http://bittorrent.org/beps/bep_0039.html) | [:x:](https://github.com/casey/intermodal/issues/98) | Updating Torrents Via Feed URL |
| [40](http://bittorrent.org/beps/bep_0040.html) | :heavy_minus_sign: | Canonical Peer Priority | | [40](http://bittorrent.org/beps/bep_0040.html) | :heavy_minus_sign: | Canonical Peer Priority |
| [41](http://bittorrent.org/beps/bep_0041.html) | :x: | UDP Tracker Protocol Extensions | | [41](http://bittorrent.org/beps/bep_0041.html) | [:x:](https://github.com/casey/intermodal/issues/97) | UDP Tracker Protocol Extensions |
| [42](http://bittorrent.org/beps/bep_0042.html) | :heavy_minus_sign: | DHT Security extension | | [42](http://bittorrent.org/beps/bep_0042.html) | :heavy_minus_sign: | DHT Security extension |
| [43](http://bittorrent.org/beps/bep_0043.html) | :heavy_minus_sign: | Read-only DHT Nodes | | [43](http://bittorrent.org/beps/bep_0043.html) | :heavy_minus_sign: | Read-only DHT Nodes |
| [44](http://bittorrent.org/beps/bep_0044.html) | :x: | Storing arbitrary data in the DHT | | [44](http://bittorrent.org/beps/bep_0044.html) | :heavy_minus_sign: | Storing arbitrary data in the DHT |
| [45](http://bittorrent.org/beps/bep_0045.html) | :x: | Multiple-address operation for the BitTorrent DHT | | [45](http://bittorrent.org/beps/bep_0045.html) | :heavy_minus_sign: | Multiple-address operation for the BitTorrent DHT |
| [46](http://bittorrent.org/beps/bep_0046.html) | :x: | Updating Torrents Via DHT Mutable Items | | [46](http://bittorrent.org/beps/bep_0046.html) | :heavy_minus_sign: | Updating Torrents Via DHT Mutable Items |
| [47](http://bittorrent.org/beps/bep_0047.html) | :x: | Padding files and extended file attributes | | [47](http://bittorrent.org/beps/bep_0047.html) | [:x:](https://github.com/casey/intermodal/issues/99) | Padding files and extended file attributes |
| [48](http://bittorrent.org/beps/bep_0048.html) | :x: | Tracker Protocol Extension: Scrape | | [48](http://bittorrent.org/beps/bep_0048.html) | :heavy_minus_sign: | Tracker Protocol Extension: Scrape |
| [49](http://bittorrent.org/beps/bep_0049.html) | :x: | Distributed Torrent Feeds | | [49](http://bittorrent.org/beps/bep_0049.html) | [:x:](https://github.com/casey/intermodal/issues/100) | Distributed Torrent Feeds |
| [50](http://bittorrent.org/beps/bep_0050.html) | :heavy_minus_sign: | Publish/Subscribe Protocol | | [50](http://bittorrent.org/beps/bep_0050.html) | :heavy_minus_sign: | Publish/Subscribe Protocol |
| [51](http://bittorrent.org/beps/bep_0051.html) | :heavy_minus_sign: | DHT Infohash Indexing | | [51](http://bittorrent.org/beps/bep_0051.html) | :heavy_minus_sign: | DHT Infohash Indexing |
| [52](http://bittorrent.org/beps/bep_0052.html) | :x: | The BitTorrent Protocol Specification v2 | | [52](http://bittorrent.org/beps/bep_0052.html) | [:x:](https://github.com/casey/intermodal/issues/101) | The BitTorrent Protocol Specification v2 |
| [53](http://bittorrent.org/beps/bep_0053.html) | :x: | Magnet URI extension - Select specific file indices for download | | [53](http://bittorrent.org/beps/bep_0053.html) | :heavy_minus_sign: | Magnet URI extension - Select specific file indices for download |
| [54](http://bittorrent.org/beps/bep_0054.html) | :heavy_minus_sign: | The lt_donthave extension | | [54](http://bittorrent.org/beps/bep_0054.html) | :heavy_minus_sign: | The lt_donthave extension |
| [55](http://bittorrent.org/beps/bep_0055.html) | :heavy_minus_sign: | Holepunch extension | | [55](http://bittorrent.org/beps/bep_0055.html) | :heavy_minus_sign: | Holepunch extension |

View File

@ -149,31 +149,62 @@ impl Opt {
assert_eq!(originals.len(), beps.len()); assert_eq!(originals.len(), beps.len());
let mut width = (0, 0, 0);
let rows = beps
.into_iter()
.zip(originals)
.map(|(bep, original)| {
assert_eq!(bep.number, original.number);
let row = (
format!(
"[{:02}](http://bittorrent.org/beps/bep_{:04}.html)",
bep.number, bep.number
),
original.status.to_string(),
bep.title,
);
width.0 = width.0.max(row.0.len());
width.1 = width.1.max(row.1.len());
width.2 = width.2.max(row.2.len());
row
})
.collect::<Vec<(String, String, String)>>();
let mut lines = Vec::new(); let mut lines = Vec::new();
let width = beps.iter().map(|bep| bep.title.len()).max().unwrap_or(0);
lines.push(format!( lines.push(format!(
"| BEP | Status | {:width$} |", "| {:w0$} | {:w1$} | {:w2$} |",
"BEP",
"Status",
"Title", "Title",
width = width w0 = width.0,
w1 = width.1,
w2 = width.2,
)); ));
lines.push(format!( lines.push(format!(
"|:----------------------------------------------:|:------------------:|:{:-<width$}-|", "|:{:-<w0$}:|:{:-<w1$}:|:{:-<w2$}-|",
"", "",
width = width "",
"",
w0 = width.0,
w1 = width.1,
w2 = width.2,
)); ));
for (bep, original) in beps.into_iter().zip(originals) { for (bep, status, title) in rows {
assert_eq!(bep.number, original.number);
lines.push(format!( lines.push(format!(
"| [{:02}](http://bittorrent.org/beps/bep_{:04}.html) | {:18} | {:width$} |", "| {:w0$} | {:w1$} | {:w2$} |",
bep.number, bep,
bep.number, status,
original.status.to_string(), title,
bep.title, w0 = width.0,
width = width w1 = width.1,
w2 = width.2,
)); ));
} }

View File

@ -4,23 +4,55 @@ pub(crate) enum Status {
Unknown, Unknown,
NotApplicable, NotApplicable,
Supported, Supported,
NotSupported, NotSupported { tracking_issue: Option<u64> },
} }
impl FromStr for Status { impl FromStr for Status {
type Err = String; type Err = String;
fn from_str(text: &str) -> Result<Self, Self::Err> { fn from_str(text: &str) -> Result<Self, Self::Err> {
match text.replace('\\', "").as_str() { let error = || format!("invalid status: {}", text);
"x" => Ok(Self::NotSupported),
"+" => Ok(Self::Supported), let unescaped = text.replace('\\', "");
"-" => Ok(Self::NotApplicable),
"?" => Ok(Self::Unknown), let (emoji, tracking_issue) = if !unescaped.starts_with('[') {
":x:" => Ok(Self::NotSupported), (text, None)
":white_check_mark:" => Ok(Self::Supported), } else {
":heavy_minus_sign:" => Ok(Self::NotApplicable), let status_pattern = Regex::new(
":grey_question:" => Ok(Self::Unknown), r"(?x)
_ => Err(format!("invalid status: {}", text)), ^
\[
(?P<emoji>:[a-zA-Z0-9]+:)
\]
\(
https://github.com/casey/intermodal/issues/(?P<tracking_issue>[0-9]+)
\)
$
",
)
.unwrap();
let captures = status_pattern.captures(&unescaped).ok_or_else(error)?;
let emoji = captures.name("emoji").unwrap().as_str();
let tracking_issue = captures
.name("tracking_issue")
.map(|text| text.as_str().parse::<u64>().unwrap());
(emoji, tracking_issue)
};
match emoji {
"x" => Ok(Status::NotSupported { tracking_issue }),
"+" => Ok(Status::Supported),
"-" => Ok(Status::NotApplicable),
"?" => Ok(Status::Unknown),
":x:" => Ok(Status::NotSupported { tracking_issue }),
":white_check_mark:" => Ok(Status::Supported),
":heavy_minus_sign:" => Ok(Status::NotApplicable),
":grey_question:" => Ok(Status::Unknown),
_ => Err(error()),
} }
} }
} }
@ -31,7 +63,16 @@ impl Display for Status {
Self::Unknown => write!(f, ":grey_question:"), Self::Unknown => write!(f, ":grey_question:"),
Self::NotApplicable => write!(f, ":heavy_minus_sign:"), Self::NotApplicable => write!(f, ":heavy_minus_sign:"),
Self::Supported => write!(f, ":white_check_mark:"), Self::Supported => write!(f, ":white_check_mark:"),
Self::NotSupported => write!(f, ":x:"), Self::NotSupported {
tracking_issue: None,
} => write!(f, ":x:"),
Self::NotSupported {
tracking_issue: Some(number),
} => write!(
f,
"[:x:](https://github.com/casey/intermodal/issues/{})",
number
),
} }
} }
} }