diff --git a/Cargo.toml b/Cargo.toml index b60badf..7f6e795 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "p0f_api" -version = "0.1.1" +version = "0.1.2" authors = ["emk "] license = "WTFPL OR MIT OR Apache-2.0" description = "Interface for querying p0f unix socket API." diff --git a/README.md b/README.md index 391d137..45581ef 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ It has been developed with p0f version 3.09b. ### Cargo.toml: ```toml [dependencies] -p0f_api = "~0.1.1" +p0f_api = "~0.1.2" ``` ### Code: diff --git a/src/lib.rs b/src/lib.rs index 33ff1e3..1e396e6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -91,7 +91,7 @@ impl P0f { io::ErrorKind::InvalidData, format!( "p0f: invalid magic number received: 0x{:x}. Should be: 0x{:x}.", - resp.magic, + {resp.magic}, raw::P0F_RESP_MAGIC ) )); @@ -107,14 +107,15 @@ impl P0f { return Ok(None), raw::P0F_STATUS_OK => return Ok(Some(P0fResponse::from_raw_response(&resp))), - _ => + _ => { return Err(io::Error::new( io::ErrorKind::InvalidData, format!( "p0f: Unknown status received: 0x{:x}. [Please report this to p0f_api crate author].", - resp.status + {resp.status} ) - )), + )) + } } } @@ -186,8 +187,8 @@ pub struct P0fResponse { impl P0fResponse { /// Conversion from `raw::p0f_api_response`. fn from_raw_response(resp: &raw::p0f_api_response) -> Self { - debug_assert_eq!(resp.magic, raw::P0F_RESP_MAGIC); - debug_assert_eq!(resp.status, raw::P0F_STATUS_OK); + debug_assert_eq!({resp.magic}, raw::P0F_RESP_MAGIC); + debug_assert_eq!({resp.status}, raw::P0F_STATUS_OK); P0fResponse { first_seen: resp.first_seen as i64,