mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-26 15:30:18 +00:00
Compare commits
No commits in common. "9bc957e442ab53709168eaae0d4ece1df3028b6e" and "dec9145d65d50e9a7e55593ff49cdd7a6b385e0a" have entirely different histories.
9bc957e442
...
dec9145d65
@ -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)
|
||||||
|
|
||||||
server_identity = RNS.Identity()
|
# Load identity from file if it exist or randomley create
|
||||||
RNS.log("created new identity", RNS.LOG_VERBOSE)
|
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
|
||||||
|
@ -1030,8 +1030,20 @@ destination, and passing traffic back and forth over the link.</p>
|
|||||||
<span class="c1"># We must first initialise Reticulum</span>
|
<span class="c1"># We must first initialise Reticulum</span>
|
||||||
<span class="n">reticulum</span> <span class="o">=</span> <span class="n">RNS</span><span class="o">.</span><span class="n">Reticulum</span><span class="p">(</span><span class="n">configpath</span><span class="p">)</span>
|
<span class="n">reticulum</span> <span class="o">=</span> <span class="n">RNS</span><span class="o">.</span><span class="n">Reticulum</span><span class="p">(</span><span class="n">configpath</span><span class="p">)</span>
|
||||||
|
|
||||||
<span class="n">server_identity</span> <span class="o">=</span> <span class="n">RNS</span><span class="o">.</span><span class="n">Identity</span><span class="p">()</span>
|
<span class="c1"># Load identity from file if it exist or randomley create</span>
|
||||||
<span class="n">RNS</span><span class="o">.</span><span class="n">log</span><span class="p">(</span><span class="s2">"created new identity"</span><span class="p">,</span> <span class="n">RNS</span><span class="o">.</span><span class="n">LOG_VERBOSE</span><span class="p">)</span>
|
<span class="k">if</span> <span class="n">configpath</span><span class="p">:</span>
|
||||||
|
<span class="n">ifilepath</span> <span class="o">=</span> <span class="s2">"</span><span class="si">%s</span><span class="s2">/storage/identitiesy/</span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">configpath</span><span class="p">,</span><span class="n">APP_NAME</span><span class="p">)</span>
|
||||||
|
<span class="k">else</span><span class="p">:</span>
|
||||||
|
<span class="n">ifilepath</span> <span class="o">=</span> <span class="s2">"</span><span class="si">%s</span><span class="s2">/storage/identities/</span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">RNS</span><span class="o">.</span><span class="n">Reticulum</span><span class="o">.</span><span class="n">configdir</span><span class="p">,</span><span class="n">APP_NAME</span><span class="p">)</span>
|
||||||
|
<span class="n">RNS</span><span class="o">.</span><span class="n">log</span><span class="p">(</span><span class="s2">"ifilepath: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">ifilepath</span><span class="p">)</span>
|
||||||
|
<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">ifilepath</span><span class="p">):</span>
|
||||||
|
<span class="c1"># Load identity from file</span>
|
||||||
|
<span class="n">server_identity</span> <span class="o">=</span> <span class="n">RNS</span><span class="o">.</span><span class="n">Identity</span><span class="o">.</span><span class="n">from_file</span><span class="p">(</span><span class="n">ifilepath</span><span class="p">)</span>
|
||||||
|
<span class="n">RNS</span><span class="o">.</span><span class="n">log</span><span class="p">(</span><span class="s2">"loaded identity from file: "</span><span class="o">+</span><span class="n">ifilepath</span><span class="p">,</span> <span class="n">RNS</span><span class="o">.</span><span class="n">LOG_VERBOSE</span><span class="p">)</span>
|
||||||
|
<span class="k">else</span><span class="p">:</span>
|
||||||
|
<span class="c1"># Randomly create a new identity for our link example</span>
|
||||||
|
<span class="n">server_identity</span> <span class="o">=</span> <span class="n">RNS</span><span class="o">.</span><span class="n">Identity</span><span class="p">()</span>
|
||||||
|
<span class="n">RNS</span><span class="o">.</span><span class="n">log</span><span class="p">(</span><span class="s2">"created new identity"</span><span class="p">,</span> <span class="n">RNS</span><span class="o">.</span><span class="n">LOG_VERBOSE</span><span class="p">)</span>
|
||||||
|
|
||||||
<span class="c1"># We create a destination that clients can connect to. We</span>
|
<span class="c1"># We create a destination that clients can connect to. We</span>
|
||||||
<span class="c1"># want clients to create links to this destination, so we</span>
|
<span class="c1"># want clients to create links to this destination, so we</span>
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user