mirror of
https://github.com/cubixle/radius-rs.git
synced 2026-04-30 05:28:42 +01:00
Make the client configurable connection-timeout and socket-timeout
This commit is contained in:
+4
-2
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user