Reticulum/t.py

37 lines
758 B
Python
Raw Normal View History

# from RNS.Destination import *
# from RNS.Packet import *
# from RNS import Reticulum
from RNS import *
# from RNS import Destination
2018-03-16 11:40:37 +01:00
import os
2018-03-16 10:50:37 +01:00
import time
def testCallback(message, receiver):
print("Got message from "+str(receiver)+": ")
print(message)
print("----------")
#RNS = Reticulum(configdir=os.path.expanduser("~")+"/.Reticulum2")
RNS = Reticulum()
2018-03-16 11:40:37 +01:00
identity = Identity()
d1=Destination(identity, Destination.IN, Destination.SINGLE, "messenger", "user")
2018-03-20 12:32:41 +01:00
#d1.setProofStrategy(Destination.PROVE_ALL)
2018-03-16 10:50:37 +01:00
d1.setCallback(testCallback)
msg=""
for x in range(300):
msg += "a"
signed = d1.sign(msg)
sl = len(signed)
2018-03-16 11:40:37 +01:00
pl = len(d1.identity.pub_bytes)
2018-03-16 10:50:37 +01:00
2018-03-19 18:11:50 +01:00
d1.announce()
2018-03-19 16:39:08 +01:00
p1=Packet(d1, msg)
2018-03-20 12:32:41 +01:00
p1.send()
2018-03-16 10:50:37 +01:00
2018-03-19 16:39:08 +01:00
# p2=Packet(d2,"Test af msg")
2018-03-16 10:50:37 +01:00
# p2.send()
2018-03-19 16:39:08 +01:00
raw_input()