added introduce command
This commit is contained in:
parent
d8d29b7c28
commit
8024d0e354
@ -91,13 +91,18 @@ class OnionrCommunicate:
|
||||
if command[0] == 'shutdown':
|
||||
logger.info('Daemon recieved exit command.', timestamp=True)
|
||||
break
|
||||
elif command[0] == 'anounceNode':
|
||||
announceAmount = 1
|
||||
elif command[0] == 'announceNode':
|
||||
announceAttempts = 3
|
||||
announceAttemptCount = 0
|
||||
announceVal = False
|
||||
for i in command[1]:
|
||||
logger.info('Announcing our node to ' + command[1][i], timestamp=True)
|
||||
logger.info('Announcing our node to ' + command[1], timestamp=True)
|
||||
while not announceVal:
|
||||
announceVal = self.performGet('announce', command[1][i], data=self._core.hsAdder, skipHighFailureAddress=True)
|
||||
announceAttemptCount += 1
|
||||
announceVal = self.performGet('announce', command[1], data=self._core.hsAdder.replace('\n', ''), skipHighFailureAddress=True)
|
||||
logger.info(announceVal)
|
||||
if announceAttemptCount >= announceAttempts:
|
||||
logger.warn('Unable to announce to ' + command[1])
|
||||
break
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
|
@ -555,6 +555,13 @@ class Core:
|
||||
'''
|
||||
Introduces our node into the network by telling X many nodes our HS address
|
||||
'''
|
||||
nodeList = self.listAdders().split('\n')
|
||||
self.daemonQueueAdd('announceNode', nodeList)
|
||||
announceAmount = 2
|
||||
nodeList = self.listAdders()
|
||||
if len(nodeList) == 0:
|
||||
self.addAddress('onionragxuddecmg.onion')
|
||||
nodeList.append('onionragxuddecmg.onion')
|
||||
if announceAmount > len(nodeList):
|
||||
announceAmount = len(nodeList)
|
||||
for i in range(announceAmount):
|
||||
self.daemonQueueAdd('announceNode', nodeList[i])
|
||||
return
|
||||
|
@ -149,6 +149,7 @@ class Onionr:
|
||||
'add-msg': self.addMessage,
|
||||
'add-message': self.addMessage,
|
||||
'pm': self.sendEncrypt,
|
||||
'introduce': self.onionrCore.introduceNode,
|
||||
|
||||
'getpms': self.getPMs,
|
||||
'get-pms': self.getPMs,
|
||||
@ -168,6 +169,7 @@ class Onionr:
|
||||
self.cmdhelp = {
|
||||
'help': 'Displays this Onionr help menu',
|
||||
'version': 'Displays the Onionr version',
|
||||
'introduce': 'Introduce your node to the public Onionr network. (DAEMON MUST BE RUNNING)',
|
||||
'config': 'Configures something and adds it to the file',
|
||||
'start': 'Starts the Onionr daemon',
|
||||
'stop': 'Stops the Onionr daemon',
|
||||
@ -178,7 +180,7 @@ class Onionr:
|
||||
'add-peer': 'Adds a peer (?)',
|
||||
'list-peers': 'Displays a list of peers',
|
||||
'add-msg': 'Broadcasts a message to the Onionr network',
|
||||
'pm': 'Adds a private message to block',
|
||||
'pm': 'Sends a private message to a user as an Onionr block',
|
||||
'get-pms': 'Shows private messages sent to you',
|
||||
'gui': 'Opens a graphical interface for Onionr'
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user