pub struct StateBuilder {
pub port: u16,
pub directory: Option<PathBuf>,
pub max_upload: usize,
pub ip: IpAddr,
/* private fields */
}Expand description
Builder for server configuration
Fields§
§port: u16The 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: usizeMaximum upload size
ip: IpAddrThe IP to use for listening for connections
Implementations§
Source§impl StateBuilder
impl StateBuilder
Sourcepub async fn new(db_string: &str, pg_cert: Option<PathBuf>) -> Result<Self>
pub async fn new(db_string: &str, pg_cert: Option<PathBuf>) -> Result<Self>
Create the builder starting with the database configuration, and optionally, the certificate for communicating with Postgres.
§Errors
An error occurs if the database configuration isn’t valid or if an error occurs connecting to the database.
Sourcepub fn directory(self, directory: PathBuf) -> Self
pub fn directory(self, directory: PathBuf) -> Self
Specify the directory to store malware samples if we’re keeping them.
Default: No directory, no file saving
Sourcepub fn max_upload(self, max_upload: usize) -> Self
pub fn max_upload(self, max_upload: usize) -> Self
Specify the maximum upload size in bytes. Default is 100 MiB.
Sourcepub fn ip(self, ip: IpAddr) -> Self
pub fn ip(self, ip: IpAddr) -> Self
Indicate the IP address the server will list on. Default: 127.0.0.1
Sourcepub fn vt_client(self, vt_client: VirusTotalClient) -> Self
Available on crate feature vt only.
pub fn vt_client(self, vt_client: VirusTotalClient) -> Self
vt only.Provide the Virus Total API key.
Sourcepub async fn tls(self, cert_file: PathBuf, key_file: PathBuf) -> Result<Self>
pub async fn tls(self, cert_file: PathBuf, key_file: PathBuf) -> Result<Self>
Provide the certificate and private key for TLS mode. Files must match: both as PEM or both as DER.
§Errors
An error results if either file doesn’t exist, not in the same format, or cannot be parsed.
Sourcepub fn enable_mdns(self) -> Self
pub fn enable_mdns(self) -> Self
Indicate that Malware DB should advertise itself via multicast DNS. Default is false.
Sourcepub async fn into_state(self) -> Result<State>
pub async fn into_state(self) -> Result<State>
Auto Trait Implementations§
impl !Freeze for StateBuilder
impl !RefUnwindSafe for StateBuilder
impl Send for StateBuilder
impl Sync for StateBuilder
impl Unpin for StateBuilder
impl !UnwindSafe for StateBuilder
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more