Struct malwaredb_server::State
source · pub struct State {
pub port: u16,
pub directory: Option<PathBuf>,
pub max_upload: usize,
pub ip: IpAddr,
pub db_type: DatabaseType,
pub started: SystemTime,
pub db_config: MDBConfig,
}
Expand description
State & configuration of the running server instance
Fields§
§port: u16
The port which will be used to listen for connections.
directory: Option<PathBuf>
The directory to store malware samples, if we’re keeping them.
max_upload: usize
Maximum upload size
ip: IpAddr
The IP to use for listening for connections
db_type: DatabaseType
Handle to the database connection
started: SystemTime
Start time of the server
db_config: MDBConfig
Configuration which is stored in the database
Implementations§
source§impl State
impl State
pub async fn new( port: u16, directory: Option<PathBuf>, max_upload: usize, ip: IpAddr, db_string: &str ) -> Result<Self>
pub async fn new_first_run( port: u16, directory: Option<PathBuf>, max_upload: usize, ip: IpAddr, db_string: &str, compress: bool ) -> Result<Self>
sourcepub fn store_bytes(&self, data: &[u8]) -> Result<bool>
pub fn store_bytes(&self, data: &[u8]) -> Result<bool>
Store the sample with a depth of three based on the sample’s SHA-256 hash, even if compressed
sourcepub fn retrieve_bytes(&self, sha256: &String) -> Result<Vec<u8>>
pub fn retrieve_bytes(&self, sha256: &String) -> Result<Vec<u8>>
Retrieve a sample given the SHA-256 hash Assumes that permissions have already been checked to ensure this is permitted.
pub fn since(&self) -> Duration
pub async fn get_info(&self) -> Result<ServerInfo>
pub async fn serve(self) -> Result<()>
Auto Trait Implementations§
impl !RefUnwindSafe for State
impl Send for State
impl Sync for State
impl Unpin for State
impl !UnwindSafe for State
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more