mirror of
https://github.com/markqvist/Reticulum.git
synced 2025-02-19 22:57:40 +00:00
Compare commits
7 Commits
0a188a2d39
...
b5cb3a65dd
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b5cb3a65dd | ||
![]() |
c79cb3aa20 | ||
![]() |
8bff119691 | ||
![]() |
5e0b2c5b42 | ||
![]() |
8908022b88 | ||
![]() |
b0dda0ed86 | ||
![]() |
6ae72d4225 |
@ -1,3 +1,25 @@
|
|||||||
|
# MIT License
|
||||||
|
#
|
||||||
|
# Copyright (c) 2016-2023 Mark Qvist / unsigned.io and contributors.
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in all
|
||||||
|
# copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
import bz2
|
import bz2
|
||||||
import sys
|
import sys
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# MIT License
|
# MIT License
|
||||||
#
|
#
|
||||||
# Copyright (c) 2016-2022 Mark Qvist / unsigned.io
|
# Copyright (c) 2016-2023 Mark Qvist / unsigned.io and contributors
|
||||||
#
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# MIT License
|
# MIT License
|
||||||
#
|
#
|
||||||
# Copyright (c) 2016-2022 Mark Qvist / unsigned.io
|
# Copyright (c) 2016-2023 Mark Qvist / unsigned.io and contributors.
|
||||||
#
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# MIT License
|
# MIT License
|
||||||
#
|
#
|
||||||
# Copyright (c) 2016-2022 Mark Qvist / unsigned.io
|
# Copyright (c) 2016-2023 Mark Qvist / unsigned.io and contributors.
|
||||||
#
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# MIT License
|
# MIT License
|
||||||
#
|
#
|
||||||
# Copyright (c) 2016-2022 Mark Qvist / unsigned.io
|
# Copyright (c) 2016-2023 Mark Qvist / unsigned.io and contributors.
|
||||||
#
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
27
RNS/Resolver.py
Normal file
27
RNS/Resolver.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# MIT License
|
||||||
|
#
|
||||||
|
# Copyright (c) 2016-2023 Mark Qvist / unsigned.io and contributors.
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in all
|
||||||
|
# copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
|
|
||||||
|
class Resolver:
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def resolve_identity(full_name):
|
||||||
|
pass
|
@ -1,6 +1,6 @@
|
|||||||
# MIT License
|
# MIT License
|
||||||
#
|
#
|
||||||
# Copyright (c) 2016-2022 Mark Qvist / unsigned.io
|
# Copyright (c) 2016-2023 Mark Qvist / unsigned.io and contributors.
|
||||||
#
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# MIT License
|
# MIT License
|
||||||
#
|
#
|
||||||
# Copyright (c) 2016-2022 Mark Qvist / unsigned.io
|
# Copyright (c) 2016-2023 Mark Qvist / unsigned.io and contributors.
|
||||||
#
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# MIT License
|
# MIT License
|
||||||
#
|
#
|
||||||
# Copyright (c) 2016-2022 Mark Qvist / unsigned.io
|
# Copyright (c) 2016-2023 Mark Qvist / unsigned.io and contributors.
|
||||||
#
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
@ -352,12 +352,12 @@ class Transport:
|
|||||||
|
|
||||||
# Process announces needing retransmission
|
# Process announces needing retransmission
|
||||||
if time.time() > Transport.announces_last_checked+Transport.announces_check_interval:
|
if time.time() > Transport.announces_last_checked+Transport.announces_check_interval:
|
||||||
|
completed_announces = []
|
||||||
for destination_hash in Transport.announce_table:
|
for destination_hash in Transport.announce_table:
|
||||||
announce_entry = Transport.announce_table[destination_hash]
|
announce_entry = Transport.announce_table[destination_hash]
|
||||||
if announce_entry[2] > Transport.PATHFINDER_R:
|
if announce_entry[2] > Transport.PATHFINDER_R:
|
||||||
RNS.log("Completed announce processing for "+RNS.prettyhexrep(destination_hash)+", retry limit reached", RNS.LOG_EXTREME)
|
RNS.log("Completed announce processing for "+RNS.prettyhexrep(destination_hash)+", retry limit reached", RNS.LOG_EXTREME)
|
||||||
Transport.announce_table.pop(destination_hash)
|
completed_announces.append(destination_hash)
|
||||||
break
|
|
||||||
else:
|
else:
|
||||||
if time.time() > announce_entry[1]:
|
if time.time() > announce_entry[1]:
|
||||||
announce_entry[1] = time.time() + Transport.PATHFINDER_G + Transport.PATHFINDER_RW
|
announce_entry[1] = time.time() + Transport.PATHFINDER_G + Transport.PATHFINDER_RW
|
||||||
@ -404,6 +404,10 @@ class Transport:
|
|||||||
Transport.announce_table[destination_hash] = held_entry
|
Transport.announce_table[destination_hash] = held_entry
|
||||||
RNS.log("Reinserting held announce into table", RNS.LOG_DEBUG)
|
RNS.log("Reinserting held announce into table", RNS.LOG_DEBUG)
|
||||||
|
|
||||||
|
for destination_hash in completed_announces:
|
||||||
|
if destination_hash in Transport.announce_table:
|
||||||
|
Transport.announce_table.pop(destination_hash)
|
||||||
|
|
||||||
Transport.announces_last_checked = time.time()
|
Transport.announces_last_checked = time.time()
|
||||||
|
|
||||||
|
|
||||||
|
74
RNS/Utilities/ir.py
Normal file
74
RNS/Utilities/ir.py
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
# MIT License
|
||||||
|
#
|
||||||
|
# Copyright (c) 2023 Mark Qvist / unsigned.io
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in all
|
||||||
|
# copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
|
|
||||||
|
import RNS
|
||||||
|
import argparse
|
||||||
|
import time
|
||||||
|
|
||||||
|
from RNS._version import __version__
|
||||||
|
|
||||||
|
|
||||||
|
def program_setup(configdir, verbosity = 0, quietness = 0, service = False):
|
||||||
|
targetverbosity = verbosity-quietness
|
||||||
|
|
||||||
|
if service:
|
||||||
|
targetlogdest = RNS.LOG_FILE
|
||||||
|
targetverbosity = None
|
||||||
|
else:
|
||||||
|
targetlogdest = RNS.LOG_STDOUT
|
||||||
|
|
||||||
|
reticulum = RNS.Reticulum(configdir=configdir, verbosity=targetverbosity, logdest=targetlogdest)
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
def main():
|
||||||
|
try:
|
||||||
|
parser = argparse.ArgumentParser(description="Reticulum Distributed Identity Resolver")
|
||||||
|
parser.add_argument("--config", action="store", default=None, help="path to alternative Reticulum config directory", type=str)
|
||||||
|
parser.add_argument('-v', '--verbose', action='count', default=0)
|
||||||
|
parser.add_argument('-q', '--quiet', action='count', default=0)
|
||||||
|
parser.add_argument("--exampleconfig", action='store_true', default=False, help="print verbose configuration example to stdout and exit")
|
||||||
|
parser.add_argument("--version", action="version", version="ir {version}".format(version=__version__))
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if args.exampleconfig:
|
||||||
|
print(__example_rns_config__)
|
||||||
|
exit()
|
||||||
|
|
||||||
|
if args.config:
|
||||||
|
configarg = args.config
|
||||||
|
else:
|
||||||
|
configarg = None
|
||||||
|
|
||||||
|
program_setup(configdir = configarg, verbosity=args.verbose, quietness=args.quiet)
|
||||||
|
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("")
|
||||||
|
exit()
|
||||||
|
|
||||||
|
__example_rns_config__ = '''# This is an example Identity Resolver file.
|
||||||
|
'''
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
@ -196,7 +196,7 @@ def main():
|
|||||||
if args.hash:
|
if args.hash:
|
||||||
try:
|
try:
|
||||||
aspects = args.hash.split(".")
|
aspects = args.hash.split(".")
|
||||||
if not len(aspects) > 1:
|
if not len(aspects) > 0:
|
||||||
RNS.log("Invalid destination aspects specified", RNS.LOG_ERROR)
|
RNS.log("Invalid destination aspects specified", RNS.LOG_ERROR)
|
||||||
exit(32)
|
exit(32)
|
||||||
else:
|
else:
|
||||||
|
@ -84,7 +84,7 @@ def program_setup(configdir, destination_hexhash, size=None, full_name = None, v
|
|||||||
|
|
||||||
if time.time() > _timeout:
|
if time.time() > _timeout:
|
||||||
print("\r \rPath request timed out")
|
print("\r \rPath request timed out")
|
||||||
exit(2)
|
exit(1)
|
||||||
|
|
||||||
server_identity = RNS.Identity.recall(destination_hash)
|
server_identity = RNS.Identity.recall(destination_hash)
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ def program_setup(configdir, destination_hexhash, size=None, full_name = None, v
|
|||||||
probe.pack()
|
probe.pack()
|
||||||
except OSError:
|
except OSError:
|
||||||
print("Error: Probe packet size of "+str(len(probe.raw))+" bytes exceed MTU of "+str(RNS.Reticulum.MTU)+" bytes")
|
print("Error: Probe packet size of "+str(len(probe.raw))+" bytes exceed MTU of "+str(RNS.Reticulum.MTU)+" bytes")
|
||||||
exit(1)
|
exit(3)
|
||||||
|
|
||||||
receipt = probe.send()
|
receipt = probe.send()
|
||||||
|
|
||||||
@ -174,6 +174,7 @@ def program_setup(configdir, destination_hexhash, size=None, full_name = None, v
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
print("\r \rProbe timed out")
|
print("\r \rProbe timed out")
|
||||||
|
exit(2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# MIT License
|
# MIT License
|
||||||
#
|
#
|
||||||
# Copyright (c) 2016-2022 Mark Qvist / unsigned.io
|
# Copyright (c) 2016-2023 Mark Qvist / unsigned.io and contributors
|
||||||
#
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
@ -38,6 +38,7 @@ from .Transport import Transport
|
|||||||
from .Destination import Destination
|
from .Destination import Destination
|
||||||
from .Packet import Packet
|
from .Packet import Packet
|
||||||
from .Packet import PacketReceipt
|
from .Packet import PacketReceipt
|
||||||
|
from .Resolver import Resolver
|
||||||
from .Resource import Resource, ResourceAdvertisement
|
from .Resource import Resource, ResourceAdvertisement
|
||||||
from .Cryptography import HKDF
|
from .Cryptography import HKDF
|
||||||
from .Cryptography import Hashes
|
from .Cryptography import Hashes
|
||||||
|
1
setup.py
1
setup.py
@ -50,6 +50,7 @@ setuptools.setup(
|
|||||||
'rncp=RNS.Utilities.rncp:main',
|
'rncp=RNS.Utilities.rncp:main',
|
||||||
'rnx=RNS.Utilities.rnx:main',
|
'rnx=RNS.Utilities.rnx:main',
|
||||||
'rnodeconf=RNS.Utilities.rnodeconf:main',
|
'rnodeconf=RNS.Utilities.rnodeconf:main',
|
||||||
|
'ir=RNS.Utilities.ir:main',
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
install_requires=requirements,
|
install_requires=requirements,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user