3 releases (breaking)
0.3.0 | Jun 14, 2019 |
---|---|
0.2.0 | Jun 13, 2019 |
0.1.0 | Jun 11, 2019 |
#6 in #behaviour
21KB
429 lines
What is lancat?
lancat is a tool that extends the behaviour of cat
linux utility to the LAN.
It sends a multicast message for searching lancat listeners in the LAN,
then creates one-to-one tcp connection for each listener found in order to transfer the information
in a reliable way and without saturating the network.
Installation
lancat is a rust application. You can use the cargo package manager in order to install it.
$ cargo install lancat
If you have ~/.cargo/bin
in your PATH, you will be able to use lancat everywhere in your computer!
Supported on linux
and windows
, but can be works in others platforms.
How it works?
It has two main modes: write to the LAN, and read from the LAN.
To the LAN
To write data to the LAN, run lancat
into write mode with w
:
$ lancat -w
hello lan
Furthermore, you can redirect the standard input from a file to write it into the LAN:
$ lancat -w < to_share.txt
From the LAN
To read data from the LAN, run lancat
into read mode with -r
:
$ lancat -r
=========== username - 192.168.1.35:43230 ===========
hello lan
In the case you want to send the incoming data to a certain file, you can redirect the standard output:
$ lancat -r -q > shared.txt
the -q
flag (also --quiet
) will avoid to write the user name line into the file.
Filtering users
By default lancat notifies to the LAN with your OS user name.
It is possbile to change this name with the -n
flag.
You can filter for writing or reading only for certain users:
$ lancat -w -u user1 user2
$ lancat -r -u user1 user2
In order to see which users are listening the lan, you can run lancat in search mode with -s
:
$ lancat -s
Found 'user1' at: 192.168.1.72:44435
Found 'user2' at: 192.168.1.72:44439
Found 'user3' at: 192.168.1.54:44432
To see all available options see the help: lancat --help
.
Usage Examples
Pair to pair LAN communication
Default user names
Sending a message filtering by user1:
$ echo "Hello user1" | lancat -w -u user1
Receiving messages filtering by user2:
$ lancat -r -q -u user2
Hello user1
Only users with names user1 and user2 will be able participate in the communication.
Aliasing names
Sending a message to Juanito identifying us as Pepito:
$ echo "Hello Juanito, I'm Pepito" | lancat -w -n Pepito -u Juanito
Receiving messages intended for Juanito that only Pepito sends:
$ lancat -r -q -n Juanito -u Pepito
Hello Juanito, I'm Pepito
Changelog
v0.3.0
- Windows support.
- Listen callback is also called when port and ip changes (not only the user name).
v0.2.0
- Modified cli
v0.1.0
- lancat base
Dependencies
~3–4MB
~72K SLoC