Reticulum/t.py

37 lines
746 B
Python
Raw Normal View History

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