4 releases
Uses old Rust 2015
0.2.0 | Jul 22, 2017 |
---|---|
0.1.2 | Jul 3, 2017 |
0.1.1 | Nov 5, 2016 |
0.1.0 | Oct 29, 2016 |
#15 in #ftp-server
Used in flep
42KB
1K
SLoC
flep
An FTP server library.
Example
Run ftp 127.0.0.1 2222
to connect to the server.
pub struct Server
{
file_system: flep::fs::Memory,
}
impl flep::server::Server for Server
{
fn welcome_message(&self) -> String { "Hello there!".to_string() }
fn file_system(&self) -> &flep::fs::FileSystem {
&self.file_system
}
fn file_system_mut(&mut self) -> &mut flep::fs::FileSystem {
&mut self.file_system
}
}
fn main() {
flep::util::log::initialize_default().expect("could not setup logging");
// Set up an in-memory file system.
let mut file_system = flep::fs::Memory::new();
file_system.write_file(&Path::new("README.txt"),
"hello there\nit is me".as_bytes().to_owned()).unwrap();
// Start on port 2222
let mut server = Server { file_system: file_system };
flep::server::run(&mut server, "127.0.0.1:2222")
.expect("error whilst running server");
}
lib.rs
:
Raw FTP protocol definitions.
Dependencies
~3–9MB
~79K SLoC