- removed simplecache for now
* fixed existingRand bytes check in announce in onionrdaemontools * moved openhome to its own file * slight comment and boilerplate changes + added more readme files for subdirectories
This commit is contained in:
parent
737719cb54
commit
268325c07d
@ -26,7 +26,7 @@ import core
|
|||||||
from onionrblockapi import Block
|
from onionrblockapi import Block
|
||||||
import onionrutils, onionrexceptions, onionrcrypto, blockimporter, onionrevents as events, logger, config
|
import onionrutils, onionrexceptions, onionrcrypto, blockimporter, onionrevents as events, logger, config
|
||||||
import httpapi
|
import httpapi
|
||||||
from httpapi import friendsapi, simplecache, profilesapi, configapi, miscpublicapi
|
from httpapi import friendsapi, profilesapi, configapi, miscpublicapi
|
||||||
from onionrservices import httpheaders
|
from onionrservices import httpheaders
|
||||||
import onionr
|
import onionr
|
||||||
|
|
||||||
@ -199,7 +199,6 @@ class API:
|
|||||||
self.queueResponse = {}
|
self.queueResponse = {}
|
||||||
onionrInst.setClientAPIInst(self)
|
onionrInst.setClientAPIInst(self)
|
||||||
app.register_blueprint(friendsapi.friends)
|
app.register_blueprint(friendsapi.friends)
|
||||||
app.register_blueprint(simplecache.simplecache)
|
|
||||||
app.register_blueprint(profilesapi.profile_BP)
|
app.register_blueprint(profilesapi.profile_BP)
|
||||||
app.register_blueprint(configapi.config_BP)
|
app.register_blueprint(configapi.config_BP)
|
||||||
httpapi.load_plugin_blueprints(app)
|
httpapi.load_plugin_blueprints(app)
|
||||||
|
@ -67,9 +67,9 @@ class DaemonTools:
|
|||||||
combinedNodes = ourID + peer
|
combinedNodes = ourID + peer
|
||||||
if ourID != 1:
|
if ourID != 1:
|
||||||
#TODO: Extend existingRand for i2p
|
#TODO: Extend existingRand for i2p
|
||||||
existingRand = self.daemon._core.getAddressInfo(peer, 'powValue')
|
existingRand = self.daemon._core._utils.bytesToStr(self.daemon._core.getAddressInfo(peer, 'powValue'))
|
||||||
# Reset existingRand if it no longer meets the minimum POW
|
# Reset existingRand if it no longer meets the minimum POW
|
||||||
if type(existingRand) is type(None) or not existingRand.endswith(b'0' * ov.announce_pow):
|
if type(existingRand) is type(None) or not existingRand.endswith('0' * ov.announce_pow):
|
||||||
existingRand = ''
|
existingRand = ''
|
||||||
|
|
||||||
if peer in self.announceCache:
|
if peer in self.announceCache:
|
||||||
@ -216,5 +216,4 @@ class DaemonTools:
|
|||||||
fakePeer = 'OVPCZLOXD6DC5JHX4EQ3PSOGAZ3T24F75HQLIUZSDSMYPEOXCPFA===='
|
fakePeer = 'OVPCZLOXD6DC5JHX4EQ3PSOGAZ3T24F75HQLIUZSDSMYPEOXCPFA===='
|
||||||
data = secrets.token_hex(secrets.randbelow(1024) + 1)
|
data = secrets.token_hex(secrets.randbelow(1024) + 1)
|
||||||
self.daemon._core.insertBlock(data, header='pm', encryptType='asym', asymPeer=fakePeer, meta={'subject': 'foo'})
|
self.daemon._core.insertBlock(data, header='pm', encryptType='asym', asymPeer=fakePeer, meta={'subject': 'foo'})
|
||||||
self.daemon.decrementThreadCount('insertDeniableBlock')
|
self.daemon.decrementThreadCount('insertDeniableBlock')
|
||||||
return
|
|
5
onionr/etc/README.md
Normal file
5
onionr/etc/README.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# etc
|
||||||
|
|
||||||
|
pgpwords.py: represent data using the pgp word list: https://en.wikipedia.org/wiki/PGP_word_list
|
||||||
|
|
||||||
|
onionrvalues.py: spec values for onionr blocks and other things
|
@ -1,5 +1,5 @@
|
|||||||
'''
|
'''
|
||||||
Onionr - P2P Microblogging Platform & Social network
|
Onionr - Private P2P Communication
|
||||||
|
|
||||||
This file defines values and requirements used by Onionr
|
This file defines values and requirements used by Onionr
|
||||||
'''
|
'''
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
'''This file is adapted from https://github.com/thblt/pgp-words by github user 'thblt' ('Thibault Polge), GPL v3 license'''
|
'''This file is adapted from https://github.com/thblt/pgp-words by github user 'thblt' ('Thibault Polge), GPL v3 license'''
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Changes made for Onionr:
|
Changes made for Onionr by Kevin Froman in 2018-2019:
|
||||||
Minor changes such as slight word adjustment, line breaks
|
Minor changes such as slight word adjustment, line breaks
|
||||||
|
|
||||||
CLI commands/usage function removed
|
CLI commands/usage function removed
|
||||||
|
13
onionr/httpapi/README.md
Normal file
13
onionr/httpapi/README.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# httpapi
|
||||||
|
|
||||||
|
The httpapi contains collections of endpoints for the client API server.
|
||||||
|
|
||||||
|
## Files:
|
||||||
|
|
||||||
|
configapi: manage onionr configuration from the client http api
|
||||||
|
|
||||||
|
friendsapi: add, remove and list friends from the client http api
|
||||||
|
|
||||||
|
miscpublicapi: misculanious onionr network interaction from the **public** httpapi, such as announcements, block fetching and uploading.
|
||||||
|
|
||||||
|
profilesapi: work in progress in returning a profile page for an Onionr user
|
@ -1,5 +1,5 @@
|
|||||||
'''
|
'''
|
||||||
Onionr - P2P Anonymous Storage Network
|
Onionr - Private P2P Communication
|
||||||
|
|
||||||
This file handles configuration setting and getting from the HTTP API
|
This file handles configuration setting and getting from the HTTP API
|
||||||
'''
|
'''
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
'''
|
'''
|
||||||
Onionr - P2P Anonymous Storage Network
|
Onionr - Private P2P Communication
|
||||||
|
|
||||||
This file creates http endpoints for friend management
|
This file creates http endpoints for friend management
|
||||||
'''
|
'''
|
||||||
|
@ -1,3 +1,22 @@
|
|||||||
|
'''
|
||||||
|
Onionr - Private P2P Communication
|
||||||
|
|
||||||
|
Public endpoints to do various block sync actions and announcement
|
||||||
|
'''
|
||||||
|
'''
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
'''
|
||||||
from . import announce, upload, getblocks
|
from . import announce, upload, getblocks
|
||||||
|
|
||||||
announce = announce.handle_announce # endpoint handler for accepting peer announcements
|
announce = announce.handle_announce # endpoint handler for accepting peer announcements
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
'''
|
'''
|
||||||
Onionr - P2P Microblogging Platform & Social network
|
Onionr - Private P2P Communication
|
||||||
|
|
||||||
Handle announcements to the public API server
|
Handle announcements to the public API server
|
||||||
'''
|
'''
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
'''
|
'''
|
||||||
Onionr - P2P Microblogging Platform & Social network
|
Onionr - Private P2P Communication
|
||||||
|
|
||||||
Public endpoints to get block data and lists
|
Public endpoints to get block data and lists
|
||||||
'''
|
'''
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
'''
|
'''
|
||||||
Onionr - P2P Microblogging Platform & Social network
|
Onionr - Private P2P Communication
|
||||||
|
|
||||||
Accept block uploads to the public API server
|
Accept block uploads to the public API server
|
||||||
'''
|
'''
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
'''
|
'''
|
||||||
Onionr - P2P Anonymous Storage Network
|
Onionr - Private P2P Communication
|
||||||
|
|
||||||
This file creates http endpoints for user profile pages
|
This file creates http endpoints for user profile pages
|
||||||
'''
|
'''
|
||||||
|
@ -208,7 +208,7 @@ class Onionr:
|
|||||||
commands.onionrstatistics.show_details(self)
|
commands.onionrstatistics.show_details(self)
|
||||||
|
|
||||||
def openHome(self):
|
def openHome(self):
|
||||||
commands.open_home(self)
|
commands.openwebinterface.open_home(self)
|
||||||
|
|
||||||
def addID(self):
|
def addID(self):
|
||||||
commands.pubkeymanager.add_ID(self)
|
commands.pubkeymanager.add_ID(self)
|
||||||
|
25
onionr/onionrcommands/README.md
Normal file
25
onionr/onionrcommands/README.md
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# onionrcommands
|
||||||
|
|
||||||
|
This module contains handlers/functions for Onionr cli interface commands.
|
||||||
|
|
||||||
|
## Files
|
||||||
|
|
||||||
|
__init__.py: stores the command references (aside from plugins) and help info.
|
||||||
|
|
||||||
|
banblocks.py: command handler for manually removing blocks from one's node
|
||||||
|
|
||||||
|
daemonlaunch.py: command to run Onionr (start the api servers, tor and communicator)
|
||||||
|
|
||||||
|
exportblocks.py: command to export an onionr block to the export folder. Exported blocks can be manually shared outside of the Onionr network
|
||||||
|
|
||||||
|
filecommands.py commands to insert and fetch files from the Onionr network
|
||||||
|
|
||||||
|
keyadders.py: commands to add an onionr user key or transport address
|
||||||
|
|
||||||
|
onionrstatistics.py: commands to print out various information about one's Onionr node
|
||||||
|
|
||||||
|
openwebinterface.py: command to open the web interface (useful because it requires a randomly generated token)
|
||||||
|
|
||||||
|
plugincommands.py: commands to enable/disable/reload plugins
|
||||||
|
|
||||||
|
pubkeymanager.py: commands to generate a new onionr user id, change the active id, or add/remove/list friends
|
@ -20,7 +20,8 @@
|
|||||||
|
|
||||||
import webbrowser, sys
|
import webbrowser, sys
|
||||||
import logger
|
import logger
|
||||||
from . import pubkeymanager, onionrstatistics, daemonlaunch, filecommands, plugincommands, keyadders, banblocks, exportblocks
|
from . import pubkeymanager, onionrstatistics, daemonlaunch, filecommands, plugincommands, keyadders
|
||||||
|
from . import banblocks, exportblocks, openwebinterface
|
||||||
|
|
||||||
def show_help(o_inst, command):
|
def show_help(o_inst, command):
|
||||||
|
|
||||||
@ -39,16 +40,6 @@ def show_help(o_inst, command):
|
|||||||
for command, helpmessage in helpmenu.items():
|
for command, helpmessage in helpmenu.items():
|
||||||
o_inst.showHelp(command)
|
o_inst.showHelp(command)
|
||||||
|
|
||||||
def open_home(o_inst):
|
|
||||||
try:
|
|
||||||
url = o_inst.onionrUtils.getClientAPIServer()
|
|
||||||
except FileNotFoundError:
|
|
||||||
logger.error('Onionr seems to not be running (could not get api host)')
|
|
||||||
else:
|
|
||||||
url = 'http://%s/#%s' % (url, o_inst.onionrCore.config.get('client.webpassword'))
|
|
||||||
print('If Onionr does not open automatically, use this URL:', url)
|
|
||||||
webbrowser.open_new_tab(url)
|
|
||||||
|
|
||||||
def get_commands(onionr_inst):
|
def get_commands(onionr_inst):
|
||||||
return {'': onionr_inst.showHelpSuggestion,
|
return {'': onionr_inst.showHelpSuggestion,
|
||||||
'help': onionr_inst.showHelp,
|
'help': onionr_inst.showHelp,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
'''
|
'''
|
||||||
Onionr - P2P Anonymous Storage Network
|
Onionr - Private P2P Communication
|
||||||
|
|
||||||
This file contains the command for banning blocks from the node
|
This file contains the command for banning blocks from the node
|
||||||
'''
|
'''
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
'''
|
'''
|
||||||
Onionr - P2P Anonymous Storage Network
|
Onionr - Private P2P Communication
|
||||||
|
|
||||||
launch the api server and communicator
|
launch the api server and communicator
|
||||||
'''
|
'''
|
||||||
|
@ -1,3 +1,23 @@
|
|||||||
|
'''
|
||||||
|
Onionr - Private P2P Communication
|
||||||
|
|
||||||
|
This file handles the commands for adding and getting files from the Onionr network
|
||||||
|
'''
|
||||||
|
'''
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
'''
|
||||||
|
|
||||||
import base64, sys, os
|
import base64, sys, os
|
||||||
import logger
|
import logger
|
||||||
from onionrblockapi import Block
|
from onionrblockapi import Block
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
'''
|
'''
|
||||||
Onionr - P2P Anonymous Storage Network
|
Onionr - Private P2P Communication
|
||||||
|
|
||||||
add keys (transport and pubkey)
|
add keys (transport and pubkey)
|
||||||
'''
|
'''
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
'''
|
'''
|
||||||
Onionr - P2P Anonymous Storage Network
|
Onionr - Private P2P Communication
|
||||||
|
|
||||||
This module defines commands to show stats/details about the local node
|
This module defines commands to show stats/details about the local node
|
||||||
'''
|
'''
|
||||||
|
27
onionr/httpapi/simplecache/__init__.py → onionr/onionrcommands/openwebinterface.py
Executable file → Normal file
27
onionr/httpapi/simplecache/__init__.py → onionr/onionrcommands/openwebinterface.py
Executable file → Normal file
@ -1,7 +1,7 @@
|
|||||||
'''
|
'''
|
||||||
Onionr - P2P Anonymous Storage Network
|
Onionr - Private P2P Communication
|
||||||
|
|
||||||
This file creates http endpoints for friend management
|
Open the web interface properly into a web browser
|
||||||
'''
|
'''
|
||||||
'''
|
'''
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
@ -17,15 +17,14 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
'''
|
'''
|
||||||
import core
|
import webbrowser
|
||||||
from flask import Blueprint, Response, request, abort
|
import logger
|
||||||
|
def open_home(o_inst):
|
||||||
simplecache = Blueprint('simplecache', __name__)
|
try:
|
||||||
|
url = o_inst.onionrUtils.getClientAPIServer()
|
||||||
@simplecache.route('/get/<key>')
|
except FileNotFoundError:
|
||||||
def get_key(key):
|
logger.error('Onionr seems to not be running (could not get api host)')
|
||||||
return
|
else:
|
||||||
|
url = 'http://%s/#%s' % (url, o_inst.onionrCore.config.get('client.webpassword'))
|
||||||
@simplecache.route('/set/<key>', methods=['POST'])
|
print('If Onionr does not open automatically, use this URL:', url)
|
||||||
def set_key(key):
|
webbrowser.open_new_tab(url)
|
||||||
return
|
|
@ -1,5 +1,5 @@
|
|||||||
'''
|
'''
|
||||||
Onionr - P2P Anonymous Storage Network
|
Onionr - Private P2P Communication
|
||||||
|
|
||||||
plugin CLI commands
|
plugin CLI commands
|
||||||
'''
|
'''
|
||||||
@ -30,7 +30,6 @@ def enable_plugin(o_inst):
|
|||||||
logger.info('%s %s <plugin>' % (sys.argv[0], sys.argv[1]))
|
logger.info('%s %s <plugin>' % (sys.argv[0], sys.argv[1]))
|
||||||
|
|
||||||
def disable_plugin(o_inst):
|
def disable_plugin(o_inst):
|
||||||
|
|
||||||
if len(sys.argv) >= 3:
|
if len(sys.argv) >= 3:
|
||||||
plugin_name = sys.argv[2]
|
plugin_name = sys.argv[2]
|
||||||
logger.info('Disabling plugin "%s"...' % plugin_name)
|
logger.info('Disabling plugin "%s"...' % plugin_name)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
'''
|
'''
|
||||||
Onionr - P2P Anonymous Storage Network
|
Onionr - Private P2P Communication
|
||||||
|
|
||||||
This module defines ID-related CLI commands
|
This module defines user ID-related CLI commands
|
||||||
'''
|
'''
|
||||||
'''
|
'''
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
@ -51,7 +51,7 @@ def change_ID(o_inst):
|
|||||||
try:
|
try:
|
||||||
key = sys.argv[2]
|
key = sys.argv[2]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
logger.error('Specify pubkey to use')
|
logger.warn('Specify pubkey to use')
|
||||||
else:
|
else:
|
||||||
if o_inst.onionrUtils.validatePubKey(key):
|
if o_inst.onionrUtils.validatePubKey(key):
|
||||||
if key in o_inst.onionrCore._crypto.keyManager.getPubkeyList():
|
if key in o_inst.onionrCore._crypto.keyManager.getPubkeyList():
|
||||||
@ -60,9 +60,9 @@ def change_ID(o_inst):
|
|||||||
logger.info('Set active key to: %s' % (key,))
|
logger.info('Set active key to: %s' % (key,))
|
||||||
logger.info('Restart Onionr if it is running.')
|
logger.info('Restart Onionr if it is running.')
|
||||||
else:
|
else:
|
||||||
logger.error('That key does not exist')
|
logger.warn('That key does not exist')
|
||||||
else:
|
else:
|
||||||
logger.error('Invalid key %s' % (key,))
|
logger.warn('Invalid key %s' % (key,))
|
||||||
|
|
||||||
def friend_command(o_inst):
|
def friend_command(o_inst):
|
||||||
friend = ''
|
friend = ''
|
||||||
@ -86,7 +86,8 @@ def friend_command(o_inst):
|
|||||||
raise onionrexceptions.KeyNotKnown
|
raise onionrexceptions.KeyNotKnown
|
||||||
friend = onionrusers.OnionrUser(o_inst.onionrCore, friend)
|
friend = onionrusers.OnionrUser(o_inst.onionrCore, friend)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
logger.error('Friend ID is required.')
|
logger.warn('Friend ID is required.')
|
||||||
|
action = 'error' # set to 'error' so that the finally block does not process anything
|
||||||
except onionrexceptions.KeyNotKnown:
|
except onionrexceptions.KeyNotKnown:
|
||||||
o_inst.onionrCore.addPeer(friend)
|
o_inst.onionrCore.addPeer(friend)
|
||||||
friend = onionrusers.OnionrUser(o_inst.onionrCore, friend)
|
friend = onionrusers.OnionrUser(o_inst.onionrCore, friend)
|
||||||
@ -94,7 +95,7 @@ def friend_command(o_inst):
|
|||||||
if action == 'add':
|
if action == 'add':
|
||||||
friend.setTrust(1)
|
friend.setTrust(1)
|
||||||
logger.info('Added %s as friend.' % (friend.publicKey,))
|
logger.info('Added %s as friend.' % (friend.publicKey,))
|
||||||
else:
|
elif action == 'remove':
|
||||||
friend.setTrust(0)
|
friend.setTrust(0)
|
||||||
logger.info('Removed %s as friend.' % (friend.publicKey,))
|
logger.info('Removed %s as friend.' % (friend.publicKey,))
|
||||||
else:
|
else:
|
||||||
|
@ -1,73 +0,0 @@
|
|||||||
'''
|
|
||||||
Onionr - P2P Anonymous Storage Network
|
|
||||||
|
|
||||||
This file contains the OnionrFragment class which implements the fragment system
|
|
||||||
'''
|
|
||||||
'''
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
'''
|
|
||||||
|
|
||||||
# onionr:10ch+10ch+10chgdecryptionkey
|
|
||||||
import core, sys, binascii, os
|
|
||||||
|
|
||||||
FRAGMENT_SIZE = 0.25
|
|
||||||
TRUNCATE_LENGTH = 30
|
|
||||||
|
|
||||||
class OnionrFragment:
|
|
||||||
def __init__(self, uri=None):
|
|
||||||
uri = uri.replace('onionr:', '')
|
|
||||||
count = 0
|
|
||||||
blocks = []
|
|
||||||
appendData = ''
|
|
||||||
key = ''
|
|
||||||
for x in uri:
|
|
||||||
if x == 'k':
|
|
||||||
key = uri[uri.index('k') + 1:]
|
|
||||||
appendData += x
|
|
||||||
if count == TRUNCATE_LENGTH:
|
|
||||||
blocks.append(appendData)
|
|
||||||
appendData = ''
|
|
||||||
count = 0
|
|
||||||
count += 1
|
|
||||||
self.key = key
|
|
||||||
self.blocks = blocks
|
|
||||||
return
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def generateFragments(data=None, coreInst=None):
|
|
||||||
if coreInst is None:
|
|
||||||
coreInst = core.Core()
|
|
||||||
|
|
||||||
key = os.urandom(32)
|
|
||||||
data = coreInst._crypto.symmetricEncrypt(data, key).decode()
|
|
||||||
blocks = []
|
|
||||||
blockData = b""
|
|
||||||
uri = "onionr:"
|
|
||||||
total = sys.getsizeof(data)
|
|
||||||
for x in data:
|
|
||||||
blockData += x.encode()
|
|
||||||
if round(len(blockData) / len(data), 3) > FRAGMENT_SIZE:
|
|
||||||
blocks.append(core.Core().insertBlock(blockData))
|
|
||||||
blockData = b""
|
|
||||||
|
|
||||||
for bl in blocks:
|
|
||||||
uri += bl[:TRUNCATE_LENGTH]
|
|
||||||
uri += "k"
|
|
||||||
uri += binascii.hexlify(key).decode()
|
|
||||||
return (uri, key)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
uri = OnionrFragment.generateFragments("test")[0]
|
|
||||||
print(uri)
|
|
||||||
OnionrFragment(uri)
|
|
@ -1,5 +1,5 @@
|
|||||||
'''
|
'''
|
||||||
Onionr - P2P Anonymous Storage Network
|
Onionr - Private P2P Communication
|
||||||
|
|
||||||
Onionr services provide the server component to direct connections
|
Onionr services provide the server component to direct connections
|
||||||
'''
|
'''
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
'''
|
'''
|
||||||
Onionr - P2P Anonymous Storage Network
|
Onionr - Private P2P Communication
|
||||||
|
|
||||||
Bootstrap onion direct connections for the clients
|
Bootstrap onion direct connections for the clients
|
||||||
'''
|
'''
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
'''
|
'''
|
||||||
Onionr - P2P Anonymous Storage Network
|
Onionr - Private P2P Communication
|
||||||
|
|
||||||
Set default onionr http headers
|
Set default onionr http headers
|
||||||
'''
|
'''
|
||||||
|
Loading…
Reference in New Issue
Block a user