Skip to content

dougcooper/rudi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

rudi - (r)ecieve (u)dp (di)stribution

deduplicates receiving udp sockets and distributes a copy of the data over broadcast channels for downstream tasks

let mut udp = UdpManager::default();
let unicast = IpConfigV4 {
    cast_mode: CastMode::Unicast,
    addr: "0.0.0.0:6993".parse::<SocketAddrV4>().unwrap(),
};
let channel_size = Some(100);
let mut rx1 = udp.subscribe(&unicast,channel_size).await.unwrap();
let mut rx2 = udp.subscribe(&unicast,None).await.unwrap();

tokio::spawn(async move {
    while let Ok(data) = rx1.recv().await {
        println!("rx1 {:?}", data);
    }
});

tokio::spawn(async move {
    while let Ok(data) = rx2.recv().await {
        println!("rx2 {:?}", data);
    }
});

assert_eq!(udp.count(), 2);

test using cross

cargo install cross
cross test --target x86_64-unknown-linux-gnu

generate test data

using netcat

#unicast
echo hello | netcat -c -w 1 -v -u 192.168.56.1 6993

#multicast
echo hello | netcat -c -w 1 -v -u 224.1.1.100 6993

ROADMAP

  • restrict to interface using connect

Issues

  • restricting to interface

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages