antivm 1.0.0

Anti virtualmachine or sites for check you program
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::net::{SocketAddr, TcpStream};
use std::process;
use std::time::Duration;

use crate::config::NETWORK_CHECK_HOST;
use crate::protection::Protection;

impl Protection {
    pub(crate) fn check_network(&self) {
        let addr: SocketAddr = NETWORK_CHECK_HOST
            .parse()
            .expect("Invalid network check address");
        let timeout = Duration::from_secs(self.timeout_secs);
        if TcpStream::connect_timeout(&addr, timeout).is_err() {
            process::exit(0);
        }
    }
}