Merge branch 'master' of github.com:markqvist/Reticulum

This commit is contained in:
Mark Qvist 2024-05-03 16:22:37 +02:00
commit 4edacf82f3
3 changed files with 31 additions and 6 deletions

View File

@ -35,6 +35,7 @@ Pull requests have a high chance of being accepted if they are:
- In alignment with the [Roadmap](./Roadmap.md) or solve an open issue or feature request - In alignment with the [Roadmap](./Roadmap.md) or solve an open issue or feature request
- Sufficiently tested to work with all API functions, and pass the standard test suite - Sufficiently tested to work with all API functions, and pass the standard test suite
- Functionally and conceptually complete and well-designed - Functionally and conceptually complete and well-designed
- Not simply formatting or code style changes
- Well-documented - Well-documented
Even new ideas and proposals that have not been approved by a maintainer, or fall outside the established roadmap, are *occasionally* accepted - if they possess the remaining of the above qualities. If not, they will be closed and removed without comments or explanation. Even new ideas and proposals that have not been approved by a maintainer, or fall outside the established roadmap, are *occasionally* accepted - if they possess the remaining of the above qualities. If not, they will be closed and removed without comments or explanation.

View File

@ -5,6 +5,7 @@
# of the packet. # # of the packet. #
########################################################## ##########################################################
import os
import argparse import argparse
import RNS import RNS
@ -27,8 +28,19 @@ def server(configpath):
# We must first initialise Reticulum # We must first initialise Reticulum
reticulum = RNS.Reticulum(configpath) reticulum = RNS.Reticulum(configpath)
# Randomly create a new identity for our echo server # Load identity from file if it exist or randomley create
server_identity = RNS.Identity() if configpath:
ifilepath = "%s/storage/identitiesy/%s" % (configpath,APP_NAME)
else:
ifilepath = "%s/storage/identities/%s" % (RNS.Reticulum.configdir,APP_NAME)
if os.path.exists(ifilepath):
# Load identity from file
server_identity = RNS.Identity.from_file(ifilepath)
RNS.log("loaded identity from file: "+ifilepath, RNS.LOG_VERBOSE)
else:
# Randomly create a new identity for our echo example
server_identity = RNS.Identity()
RNS.log("created new identity", RNS.LOG_VERBOSE)
# We create a destination that clients can query. We want # We create a destination that clients can query. We want
# to be able to verify echo replies to our clients, so we # to be able to verify echo replies to our clients, so we
@ -328,4 +340,4 @@ if __name__ == "__main__":
client(args.destination, configarg, timeout=timeoutarg) client(args.destination, configarg, timeout=timeoutarg)
except KeyboardInterrupt: except KeyboardInterrupt:
print("") print("")
exit() exit()

View File

@ -28,8 +28,20 @@ def server(configpath):
# We must first initialise Reticulum # We must first initialise Reticulum
reticulum = RNS.Reticulum(configpath) reticulum = RNS.Reticulum(configpath)
# Randomly create a new identity for our link example # Load identity from file if it exist or randomley create
server_identity = RNS.Identity() if configpath:
ifilepath = "%s/storage/identitiesy/%s" % (configpath,APP_NAME)
else:
ifilepath = "%s/storage/identities/%s" % (RNS.Reticulum.configdir,APP_NAME)
RNS.log("ifilepath: %s" % ifilepath)
if os.path.exists(ifilepath):
# Load identity from file
server_identity = RNS.Identity.from_file(ifilepath)
RNS.log("loaded identity from file: "+ifilepath, RNS.LOG_VERBOSE)
else:
# Randomly create a new identity for our link example
server_identity = RNS.Identity()
RNS.log("created new identity", RNS.LOG_VERBOSE)
# We create a destination that clients can connect to. We # We create a destination that clients can connect to. We
# want clients to create links to this destination, so we # want clients to create links to this destination, so we
@ -288,4 +300,4 @@ if __name__ == "__main__":
except KeyboardInterrupt: except KeyboardInterrupt:
print("") print("")
exit() exit()