Module: Lanet
- Defined in:
- lib/lanet.rb,
lib/lanet/cli.rb,
lib/lanet/mesh.rb,
lib/lanet/ping.rb,
lib/lanet/sender.rb,
lib/lanet/signer.rb,
lib/lanet/scanner.rb,
lib/lanet/version.rb,
lib/lanet/receiver.rb,
lib/lanet/encryptor.rb,
lib/lanet/traceroute.rb,
lib/lanet/file_transfer.rb
Defined Under Namespace
Classes: CLI, Encryptor, Error, FileTransfer, Mesh, Ping, Receiver, Scanner, Sender, Signer, Traceroute
Constant Summary collapse
- DEFAULT_PORT =
Default port used for communication
5000- VERSION =
"1.0.0"
Class Method Summary collapse
-
.decrypt(data, key) ⇒ Object
Helper to decrypt a message.
-
.encrypt(message, key) ⇒ Object
Helper to encrypt a message.
-
.file_transfer(port = 5001) ⇒ Object
Add file transfer functionality.
-
.mesh_network(port = 5050, max_hops = 10) ⇒ Object
Create a new mesh network instance.
- .pinger(timeout: 1, count: 3) ⇒ Object
-
.receiver(port = DEFAULT_PORT) ⇒ Object
Creates a new receiver instance.
-
.scanner ⇒ Object
Creates a new scanner instance.
-
.sender(port = DEFAULT_PORT) ⇒ Object
Creates a new sender instance.
-
.traceroute(protocol: :udp, max_hops: 30, timeout: 1, queries: 3) ⇒ Object
Create a new traceroute instance.
Class Method Details
.decrypt(data, key) ⇒ Object
Helper to decrypt a message
44 45 46 47 |
# File 'lib/lanet.rb', line 44 def decrypt(data, key) result = Encryptor.(data, key) result[:content] end |
.encrypt(message, key) ⇒ Object
Helper to encrypt a message
39 40 41 |
# File 'lib/lanet.rb', line 39 def encrypt(, key) Encryptor.(, key) end |
.file_transfer(port = 5001) ⇒ Object
Add file transfer functionality
54 55 56 |
# File 'lib/lanet.rb', line 54 def file_transfer(port = 5001) FileTransfer.new(port) end |
.mesh_network(port = 5050, max_hops = 10) ⇒ Object
Create a new mesh network instance
59 60 61 |
# File 'lib/lanet.rb', line 59 def mesh_network(port = 5050, max_hops = 10) Mesh.new(port, max_hops) end |
.pinger(timeout: 1, count: 3) ⇒ Object
49 50 51 |
# File 'lib/lanet.rb', line 49 def pinger(timeout: 1, count: 3) Ping.new(timeout: timeout, count: count) end |
.receiver(port = DEFAULT_PORT) ⇒ Object
Creates a new receiver instance
29 30 31 |
# File 'lib/lanet.rb', line 29 def receiver(port = DEFAULT_PORT) Receiver.new(port) end |
.scanner ⇒ Object
Creates a new scanner instance
34 35 36 |
# File 'lib/lanet.rb', line 34 def scanner Scanner.new end |
.sender(port = DEFAULT_PORT) ⇒ Object
Creates a new sender instance
24 25 26 |
# File 'lib/lanet.rb', line 24 def sender(port = DEFAULT_PORT) Sender.new(port) end |
.traceroute(protocol: :udp, max_hops: 30, timeout: 1, queries: 3) ⇒ Object
Create a new traceroute instance
64 65 66 |
# File 'lib/lanet.rb', line 64 def traceroute(protocol: :udp, max_hops: 30, timeout: 1, queries: 3) Traceroute.new(protocol: protocol, max_hops: max_hops, timeout: timeout, queries: queries) end |