Make the client configurable connection-timeout and socket-timeout

This commit is contained in:
moznion
2020-12-03 00:39:12 +09:00
parent dfbf191896
commit e55679a4d6
4 changed files with 76 additions and 24 deletions
+4 -2
View File
@@ -5,6 +5,7 @@ use radius::packet::Packet;
use radius::rfc2865;
use radius_client::client::Client;
use std::net::SocketAddr;
use tokio::time::Duration;
#[tokio::main]
async fn main() {
@@ -14,8 +15,9 @@ async fn main() {
let mut req_packet = Packet::new(Code::AccessRequest, &b"secret".to_vec());
rfc2865::add_user_name(&mut req_packet, "admin");
rfc2865::add_user_password(&mut req_packet, b"p@ssw0rd").unwrap(); // TODO
rfc2865::add_user_password(&mut req_packet, b"p@ssw0rd").unwrap();
let res = Client::send_packet(&remote_addr, &req_packet).await;
let client = Client::new(Some(Duration::from_secs(3)), Some(Duration::from_secs(5)));
let res = client.send_packet(&remote_addr, &req_packet).await;
info!("response: {:?}", res);
}