Giter Club home page Giter Club logo

lidi's Introduction

lidi

Github CI Github CI

What is lidi?

Lidi (leedee) allows you to copy TCP or Unix streams or files over a unidirectional link.

It is usually used along with an actual network diode device but it can also be used over regular bidirectional links for testing purposes.

For more information about the general purpose and concept of unidirectional networks and data diode: Unidirectional network.

Where to find some documentation?

The user documentation is available at https://anssi-fr.github.io/lidi/, or can be built and opened with:

$ cd doc
$ make html
$ xdg-open _build/html/index.html

The developer documentation can be built and opened by running:

$ cargo doc --document-private-items --no-deps --lib --open

lidi's People

Contributors

ad-anssi avatar af-anssi avatar royweisfeld avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lidi's Issues

Receiver decoding process stuck in an infinite loop

When transferring files, if there is a loss of UDP packets and the reblock process cannot assemble a block for decoding, such a loss of synchronization may occur, in which, as a result, the decoding process gets stuck in an infinite loop (the condition *to_receive == block_id is not met)

loop {
let mut to_receive = receiver.block_to_receive.lock().expect("acquire lock");
if *to_receive == block_id {
receiver
.to_dispatch
.send(protocol::Message::deserialize(block))?;
*to_receive = to_receive.wrapping_add(1);
break;
}
}

Packet loss can be simulated with such a simple code

diff --git a/src/receive/reblock.rs b/src/receive/reblock.rs
index 1e44c5b..8b08564 100644
--- a/src/receive/reblock.rs
+++ b/src/receive/reblock.rs
@@ -15,6 +15,7 @@ pub(crate) fn start<F>(receiver: &receive::Receiver<F>) -> Result<(), receive::E
     let mut prev_queue: Option<Vec<raptorq::EncodingPacket>> = None;
     let mut queue = Vec::with_capacity(capacity);
     let mut block_id = 0;
+    let mut pktcnt = 0;

     loop {
         let packets = match receiver
@@ -49,6 +50,14 @@ pub(crate) fn start<F>(receiver: &receive::Receiver<F>) -> Result<(), receive::E
         };

         for packet in packets {
+            // simple simulation of packet loss
+            pktcnt += 1;
+            if pktcnt > (353 + 44) {
+                pktcnt = 0;
+            }
+            else if pktcnt > 353 {
+                continue;
+            }
             let payload_id = packet.payload_id();
             let message_block_id = payload_id.source_block_number();

BR,
Pavel

Getting startet doc: basic example needs to_tcp specified ?

To reproduce:

$ cargo run --release --bin diode-receive 
    Finished `release` profile [optimized] target(s) in 0.05s
     Running `target/release/diode-receive`
error: the following required arguments were not provided:
  <--to_tcp <ip:port>|--to_unix <path>>

Usage: diode-receive <--to_tcp <ip:port>|--to_unix <path>>

Works better:

$ cargo run --release --bin diode-receive -- --to_tcp 127.0.0.1:7000
    Finished `release` profile [optimized] target(s) in 0.02s
     Running `target/release/diode-receive --to_tcp '127.0.0.1:7000'`
2024-06-19T08:59:35.840Z INFO  [diode_receive] sending traffic to TCP 127.0.0.1:7000

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.