|
|
|
@ -4,23 +4,38 @@ use std::net::TcpStream;
|
|
|
|
|
|
|
|
|
|
#[derive(Copy, Clone, PartialEq, Debug)]
|
|
|
|
|
pub enum Type {
|
|
|
|
|
Text = '0' as isize, // 0
|
|
|
|
|
Menu, // 1
|
|
|
|
|
Text = '0' as isize, // 0 | 96 | cyan
|
|
|
|
|
Menu, // 1 | 94 | blue
|
|
|
|
|
CSOEntity, // 2
|
|
|
|
|
Error, // 3
|
|
|
|
|
Binhex, // 4
|
|
|
|
|
DOSFile, // 5
|
|
|
|
|
UUEncoded, // 6
|
|
|
|
|
Search, // 7
|
|
|
|
|
Error, // 3 | 91 | red
|
|
|
|
|
Binhex, // 4 | 4 | white underline
|
|
|
|
|
DOSFile, // 5 | 4 | white underline
|
|
|
|
|
UUEncoded, // 6 | 4 | white underline
|
|
|
|
|
Search, // 7 | 0 | white
|
|
|
|
|
Telnet, // 8
|
|
|
|
|
Binary, // 9
|
|
|
|
|
Binary, // 9 | 4 | white underline
|
|
|
|
|
Mirror = '+' as isize, // +
|
|
|
|
|
GIF = 'g' as isize, // g
|
|
|
|
|
GIF = 'g' as isize, // g | 4 | white underline
|
|
|
|
|
Telnet3270 = 'T' as isize, // T
|
|
|
|
|
HTML = 'h' as isize, // h
|
|
|
|
|
Info = 'i' as isize, // i
|
|
|
|
|
Sound = 's' as isize, // s
|
|
|
|
|
Document = 'd' as isize, // d
|
|
|
|
|
HTML = 'h' as isize, // h | 92 | green
|
|
|
|
|
Info = 'i' as isize, // i | 93 | yellow
|
|
|
|
|
Sound = 's' as isize, // s | 4 | white underline
|
|
|
|
|
Document = 'd' as isize, // d | 4 | white underline
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl Type {
|
|
|
|
|
pub fn is_download(&self) -> bool {
|
|
|
|
|
match self {
|
|
|
|
|
Type::Binhex
|
|
|
|
|
| Type::DOSFile
|
|
|
|
|
| Type::UUEncoded
|
|
|
|
|
| Type::Binary
|
|
|
|
|
| Type::GIF
|
|
|
|
|
| Type::Sound
|
|
|
|
|
| Type::Document => true,
|
|
|
|
|
_ => false,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Fetches a URL and returns a raw Gopher response.
|
|
|
|
|