cambio do lag a milisegundos para poder afinar máis

This commit is contained in:
serxoz 2024-04-15 13:52:29 +02:00
parent 38b24b53df
commit b9215cf188

View File

@ -17,8 +17,8 @@ use std::{env, io};
use tokio::net::UdpSocket;
use tokio::time::{sleep, Duration};
// delay seconds for tarpit feature
static TARPIT_DELAY: u64 = 0; // more than 2 seconds make spivicious go timeout
// delay miliseconds for tarpit feature
static TARPIT_DELAY: u64 = 1500; // more than 2 seconds make spivicious go timeout
struct Server {
socket: UdpSocket,
@ -47,7 +47,7 @@ impl Server {
match msg {
msg if msg.contains("OPTIONS") => {
// esperar - tarpit!
sleep(Duration::from_secs(TARPIT_DELAY)).await;
sleep(Duration::from_millis(TARPIT_DELAY)).await;
let options = Options::parse(&msg);
// respondemos con un 404 not found
@ -77,7 +77,7 @@ impl Server {
},
msg if msg.contains("REGISTER") => {
// esperar - tarpit!
sleep(Duration::from_secs(TARPIT_DELAY)).await;
sleep(Duration::from_millis(TARPIT_DELAY)).await;
let register = Register::parse(&msg);
@ -104,7 +104,7 @@ impl Server {
if exten.len() > 5 {
num = 9000;
}
if num < 500 {
let unauthorized = Unauthorized {
command: "SIP/2.0 401 Unauthorized".to_string(),