2015-11-29 11:50:28 +01:00
|
|
|
extern crate mio;
|
2015-12-02 12:07:46 +01:00
|
|
|
mod host;
|
|
|
|
mod connection;
|
|
|
|
mod handshake;
|
|
|
|
mod session;
|
2015-11-30 16:38:55 +01:00
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub enum Error {
|
|
|
|
Crypto(::crypto::CryptoError),
|
|
|
|
Io(::std::io::Error),
|
2015-12-02 12:07:46 +01:00
|
|
|
Auth,
|
|
|
|
BadProtocol,
|
|
|
|
AddressParse(::std::net::AddrParseError),
|
|
|
|
AddressResolve(Option<::std::io::Error>),
|
|
|
|
NodeIdParse(::error::EthcoreError),
|
2015-11-30 16:38:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
impl From<::std::io::Error> for Error {
|
|
|
|
fn from(err: ::std::io::Error) -> Error {
|
|
|
|
Error::Io(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<::crypto::CryptoError> for Error {
|
|
|
|
fn from(err: ::crypto::CryptoError) -> Error {
|
|
|
|
Error::Crypto(err)
|
|
|
|
}
|
|
|
|
}
|
2015-12-02 12:07:46 +01:00
|
|
|
impl From<::std::net::AddrParseError> for Error {
|
|
|
|
fn from(err: ::std::net::AddrParseError) -> Error {
|
|
|
|
Error::AddressParse(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
impl From<::error::EthcoreError> for Error {
|
|
|
|
fn from(err: ::error::EthcoreError) -> Error {
|
|
|
|
Error::NodeIdParse(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
impl From<::rlp::DecoderError> for Error {
|
|
|
|
fn from(_err: ::rlp::DecoderError) -> Error {
|
|
|
|
Error::Auth
|
|
|
|
}
|
|
|
|
}
|
2015-11-30 16:38:55 +01:00
|
|
|
|
2015-12-02 12:07:46 +01:00
|
|
|
pub fn start_host()
|
|
|
|
{
|
|
|
|
let _ = host::Host::start();
|
|
|
|
}
|