Skip to content

Commit

Permalink
remove dangling spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
prusnak committed Oct 11, 2024
1 parent ce9dc56 commit 06b9555
Show file tree
Hide file tree
Showing 62 changed files with 762 additions and 762 deletions.
2 changes: 1 addition & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,7 @@ This beta release brings a range of improvements and bugfixes.
- Improved documentation.
- Improved request timeouts and handling.
- Improved link establishment.
- Improved resource transfer timing.
- Improved resource transfer timing.

**Fixed bugs**
- Fixed a race condition in inbound proof handling.
Expand Down
6 changes: 3 additions & 3 deletions Examples/Announce.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
def program_setup(configpath):
# We must first initialise Reticulum
reticulum = RNS.Reticulum(configpath)

# Randomly create a new identity for our example
identity = RNS.Identity()

Expand Down Expand Up @@ -70,7 +70,7 @@ def program_setup(configpath):

# We register the announce handler with Reticulum
RNS.Transport.register_announce_handler(announce_handler)

# Everything's ready!
# Let's hand over control to the announce loop
announceLoop(destination_1, destination_2)
Expand All @@ -86,7 +86,7 @@ def announceLoop(destination_1, destination_2):
# know how to create messages directed towards it.
while True:
entered = input()

# Randomly select a fruit
fruit = fruits[random.randint(0,len(fruits)-1)]

Expand Down
4 changes: 2 additions & 2 deletions Examples/Broadcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
def program_setup(configpath, channel=None):
# We must first initialise Reticulum
reticulum = RNS.Reticulum(configpath)

# If the user did not select a "channel" we use
# a default one called "public_information".
# This "channel" is added to the destination name-
Expand All @@ -40,7 +40,7 @@ def program_setup(configpath, channel=None):
# We specify a callback that will get called every time
# the destination receives data.
broadcast_destination.set_packet_callback(packet_callback)

# Everything's ready!
# Let's hand over control to the main loop
broadcastLoop(broadcast_destination)
Expand Down
6 changes: 3 additions & 3 deletions Examples/Buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
def server(configpath):
# We must first initialise Reticulum
reticulum = RNS.Reticulum(configpath)

# Randomly create a new identity for our example
server_identity = RNS.Identity()

Expand Down Expand Up @@ -151,7 +151,7 @@ def client(destination_hexhash, configpath):
raise ValueError(
f"Destination length is invalid, must be {dest_len} hexadecimal characters ({dest_len // 2} bytes)."
)

destination_hash = bytes.fromhex(destination_hexhash)
except:
RNS.log("Invalid destination entered. Check your input!\n")
Expand Down Expand Up @@ -251,7 +251,7 @@ def link_closed(link):
RNS.log("The link was closed by the server, exiting now")
else:
RNS.log("Link closed, exiting now")

RNS.Reticulum.exit_handler()
time.sleep(1.5)
os._exit(0)
Expand Down
6 changes: 3 additions & 3 deletions Examples/Channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def unpack(self, raw):
def server(configpath):
# We must first initialise Reticulum
reticulum = RNS.Reticulum(configpath)

# Randomly create a new identity for our link example
server_identity = RNS.Identity()

Expand Down Expand Up @@ -206,7 +206,7 @@ def client(destination_hexhash, configpath):
raise ValueError(
f"Destination length is invalid, must be {dest_len} hexadecimal characters ({dest_len // 2} bytes)."
)

destination_hash = bytes.fromhex(destination_hexhash)
except:
RNS.log("Invalid destination entered. Check your input!\n")
Expand Down Expand Up @@ -315,7 +315,7 @@ def link_closed(link):
RNS.log("The link was closed by the server, exiting now")
else:
RNS.log("Link closed, exiting now")

RNS.Reticulum.exit_handler()
time.sleep(1.5)
os._exit(0)
Expand Down
20 changes: 10 additions & 10 deletions Examples/Echo.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def server(configpath):

# We must first initialise Reticulum
reticulum = RNS.Reticulum(configpath)

# Randomly create a new identity for our echo server
server_identity = RNS.Identity()

Expand All @@ -35,7 +35,7 @@ def server(configpath):
# create a "single" destination that can receive encrypted
# messages. This way the client can send a request and be
# certain that no-one else than this destination was able
# to read it.
# to read it.
echo_destination = RNS.Destination(
server_identity,
RNS.Destination.IN,
Expand All @@ -50,7 +50,7 @@ def server(configpath):
# generate a proof for each incoming packet and transmit it
# back to the sender of that packet.
echo_destination.set_proof_strategy(RNS.Destination.PROVE_ALL)

# Tell the destination which function in our program to
# run when a packet is received. We do this so we can
# print a log message when the server receives a request
Expand Down Expand Up @@ -79,7 +79,7 @@ def announceLoop(destination):

def server_callback(message, packet):
global reticulum

# Tell the user that we received an echo request, and
# that we are going to send a reply to the requester.
# Sending the proof is handled automatically, since we
Expand All @@ -92,14 +92,14 @@ def server_callback(message, packet):

if reception_rssi != None:
reception_stats += f" [RSSI {reception_rssi} dBm]"

if reception_snr != None:
reception_stats += f" [SNR {reception_snr} dBm]"

else:
if packet.rssi != None:
reception_stats += f" [RSSI {packet.rssi} dBm]"

if packet.snr != None:
reception_stats += f" [SNR {packet.snr} dB]"

Expand All @@ -114,7 +114,7 @@ def server_callback(message, packet):
# to run as a client
def client(destination_hexhash, configpath, timeout=None):
global reticulum

# We need a binary representation of the destination
# hash that was entered on the command line
try:
Expand Down Expand Up @@ -149,7 +149,7 @@ def client(destination_hexhash, configpath, timeout=None):
# command line.
while True:
input()

# Let's first check if RNS knows a path to the destination.
# If it does, we'll load the server identity and create a packet
if RNS.Transport.has_path(destination_hash):
Expand Down Expand Up @@ -230,15 +230,15 @@ def packet_delivered(receipt):

if reception_rssi != None:
reception_stats += f" [RSSI {reception_rssi} dBm]"

if reception_snr != None:
reception_stats += f" [SNR {reception_snr} dB]"

else:
if receipt.proof_packet != None:
if receipt.proof_packet.rssi != None:
reception_stats += f" [RSSI {receipt.proof_packet.rssi} dBm]"

if receipt.proof_packet.snr != None:
reception_stats += f" [SNR {receipt.proof_packet.snr} dB]"

Expand Down
20 changes: 10 additions & 10 deletions Examples/Filetransfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
def server(configpath, path):
# We must first initialise Reticulum
reticulum = RNS.Reticulum(configpath)

# Randomly create a new identity for our file server
server_identity = RNS.Identity()

Expand Down Expand Up @@ -120,7 +120,7 @@ def client_connected(link):
RNS.log("Too many files in served directory!", RNS.LOG_ERROR)
RNS.log("You should implement a function to split the filelist over multiple packets.", RNS.LOG_ERROR)
RNS.log("Hint: The client already supports it :)", RNS.LOG_ERROR)

# After this, we're just going to keep the link
# open until the client requests a file. We'll
# configure a function that get's called when
Expand All @@ -147,7 +147,7 @@ def client_request(message, packet):
# read it and pack it as a resource
RNS.log(f"Client requested \"{filename}\"")
file = open(os.path.join(serve_path, filename), "rb")

file_resource = RNS.Resource(
file,
packet.link,
Expand Down Expand Up @@ -220,7 +220,7 @@ def client(destination_hexhash, configpath):
raise ValueError(
f"Destination length is invalid, must be {dest_len} hexadecimal characters ({dest_len // 2} bytes)."
)

destination_hash = bytes.fromhex(destination_hexhash)
except:
RNS.log("Invalid destination entered. Check your input!\n")
Expand Down Expand Up @@ -291,7 +291,7 @@ def download(filename):
# packet receipt.
request_packet = RNS.Packet(server_link, filename.encode("utf-8"), create_receipt=False)
request_packet.send()

print("")
print(f"Requested \"{filename}\" from server, waiting for download to begin...")
menu_mode = "download_started"
Expand Down Expand Up @@ -474,7 +474,7 @@ def link_closed(link):
RNS.log("The link was closed by the server, exiting now")
else:
RNS.log("Link closed, exiting now")

RNS.Reticulum.exit_handler()
time.sleep(1.5)
os._exit(0)
Expand All @@ -486,17 +486,17 @@ def link_closed(link):
def download_began(resource):
global menu_mode, current_download, download_started, transfer_size, file_size
current_download = resource

if download_started == 0:
download_started = time.time()

transfer_size += resource.size
file_size = resource.total_size

menu_mode = "downloading"

# When the download concludes, successfully
# or not, we'll update our menu state and
# or not, we'll update our menu state and
# inform the user about how it all went.
def download_concluded(resource):
global menu_mode, current_filename, download_started, download_finished, download_time
Expand Down
6 changes: 3 additions & 3 deletions Examples/Identify.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
def server(configpath):
# We must first initialise Reticulum
reticulum = RNS.Reticulum(configpath)

# Randomly create a new identity for our link example
server_identity = RNS.Identity()

Expand Down Expand Up @@ -99,7 +99,7 @@ def server_packet_received(message, packet):
text = message.decode("utf-8")

RNS.log(f"Received data from {remote_peer}: {text}")

reply_text = f"I received \"{text}\" over the link from {remote_peer}"
reply_data = reply_text.encode("utf-8")
RNS.Packet(latest_client_link, reply_data).send()
Expand Down Expand Up @@ -239,7 +239,7 @@ def link_closed(link):
RNS.log("The link was closed by the server, exiting now")
else:
RNS.log("Link closed, exiting now")

RNS.Reticulum.exit_handler()
time.sleep(1.5)
os._exit(0)
Expand Down
8 changes: 4 additions & 4 deletions Examples/Link.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
def server(configpath):
# We must first initialise Reticulum
reticulum = RNS.Reticulum(configpath)

# Randomly create a new identity for our link example
server_identity = RNS.Identity()

Expand Down Expand Up @@ -89,7 +89,7 @@ def server_packet_received(message, packet):
# that connected.
text = message.decode("utf-8")
RNS.log(f"Received data on the link: {text}")

reply_text = f"I received \"{text}\" over the link"
reply_data = reply_text.encode("utf-8")
RNS.Packet(latest_client_link, reply_data).send()
Expand All @@ -113,7 +113,7 @@ def client(destination_hexhash, configpath):
raise ValueError(
f"Destination length is invalid, must be {dest_len} hexadecimal characters ({dest_len // 2} bytes)."
)

destination_hash = bytes.fromhex(destination_hexhash)
except:
RNS.log("Invalid destination entered. Check your input!\n")
Expand Down Expand Up @@ -217,7 +217,7 @@ def link_closed(link):
RNS.log("The link was closed by the server, exiting now")
else:
RNS.log("Link closed, exiting now")

RNS.Reticulum.exit_handler()
time.sleep(1.5)
os._exit(0)
Expand Down
4 changes: 2 additions & 2 deletions Examples/Minimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
def program_setup(configpath):
# We must first initialise Reticulum
reticulum = RNS.Reticulum(configpath)

# Randomly create a new identity for our example
identity = RNS.Identity()

Expand All @@ -42,7 +42,7 @@ def program_setup(configpath):
# tries to communicate with the destination know whether their
# communication was received correctly.
destination.set_proof_strategy(RNS.Destination.PROVE_ALL)

# Everything's ready!
# Let's hand over control to the announce loop
announceLoop(destination)
Expand Down
Loading

0 comments on commit 06b9555

Please sign in to comment.