Reticulum/t.py

50 lines
1.1 KiB
Python
Raw Normal View History

2018-03-16 09:50:37 +00:00
# from FPE.Destination import *
# from FPE.Packet import *
# from FPE import FlexPE
from FPE import *
# from FPE import Destination
2018-03-16 10:40:37 +00:00
import os
2018-03-16 09:50:37 +00:00
import time
def testCallback(message, receiver):
print("Got message from "+str(receiver)+": ")
print(message)
print("----------")
2018-03-16 10:40:37 +00:00
#fpe = FlexPE(config=os.path.expanduser("~")+"/.flexpe/config.test")
2018-03-16 09:50:37 +00:00
fpe = FlexPE()
2018-03-16 10:40:37 +00:00
identity = Identity()
d1=Destination(identity, Destination.IN, Destination.SINGLE, "messenger", "user")
2018-03-16 09:50:37 +00:00
d1.setCallback(testCallback)
2018-03-19 15:39:08 +00:00
d2=Destination(identity, Destination.IN, Destination.PLAIN, "messenger", "user")
d2.setCallback(testCallback)
2018-03-16 10:40:37 +00:00
# d2=Destination(identity, Destination.IN, Destination.PLAIN, "plainchat", "markqvist")
# d2.setCallback(testCallback)
2018-03-16 09:50:37 +00:00
2018-03-19 15:39:08 +00:00
#print identity.hexhash
#print d1.name
#print d1.hexhash
#print d1.identity.pub
#print "---"
#print
2018-03-16 09:50:37 +00:00
msg=""
for x in range(300):
msg += "a"
signed = d1.sign(msg)
sl = len(signed)
2018-03-16 10:40:37 +00:00
pl = len(d1.identity.pub_bytes)
2018-03-19 15:39:08 +00:00
#print("Signature length is "+str(sl))
#print("Minimum announce is "+str(pl+sl+8))
2018-03-16 09:50:37 +00:00
2018-03-19 15:39:08 +00:00
p1=Packet(d1, msg)
p1.send()
2018-03-16 09:50:37 +00:00
2018-03-19 15:39:08 +00:00
# p2=Packet(d2,"Test af msg")
2018-03-16 09:50:37 +00:00
# p2.send()
2018-03-19 15:39:08 +00:00
raw_input()