44import logging
55import os
66import ssl
7+ import urllib .parse
78
8- from .entrypoints import run_as_node , run_as_controller , run_as_ping , run_as_send
9+ from .entrypoints import run_as_node , run_as_ping , run_as_send , run_as_controller
910from .exceptions import ReceptorRuntimeError , ReceptorConfigError
1011
1112logger = logging .getLogger (__name__ )
1819 },
1920 'controller' : {
2021 'hint' : 'Run a Receptor controller' ,
21- 'entrypoint' : run_as_controller ,
22+ 'entrypoint' : run_as_controller , # TODO: New entrypoint
2223 },
2324 'ping' : {
2425 'hint' : 'Tell the local controller to ping a node' ,
@@ -108,17 +109,18 @@ def __init__(self, args=None):
108109 # Receptor node options
109110 self .add_config_option (
110111 section = 'node' ,
111- key = 'listen_address ' ,
112- default_value = '0.0.0.0' ,
112+ key = 'listen ' ,
113+ default_value = 'receptor:// 0.0.0.0:8888 ' ,
113114 value_type = 'str' ,
114- hint = 'Set/override IP address to listen on. If not set here or in a config file, the default is 0.0.0.0/0 .' ,
115+ hint = 'Set/override IP address and port to listen on. If not set here or in a config file, the default is receptor:// 0.0.0.0:8888 .' ,
115116 )
116117 self .add_config_option (
117118 section = 'node' ,
118- key = 'listen_port' ,
119- default_value = 8888 ,
120- value_type = 'int' ,
121- hint = 'Set/override TCP port to listen on. If not set here or in a config file, the default is 8888.' ,
119+ key = 'websocket_listen' ,
120+ default_value = '' ,
121+ value_type = 'str' ,
122+ hint = 'Set IP address and port to listen on for websocket clients in the form ws[s]://addr:port. '
123+ 'If not set here or in a config file then it is disabled' ,
122124 )
123125 self .add_config_option (
124126 section = 'node' ,
@@ -154,7 +156,7 @@ def __init__(self, args=None):
154156 )
155157 self .add_config_option (
156158 section = 'node' ,
157- key = 'ping_interval ' ,
159+ key = 'keepalive_interval ' ,
158160 default_value = - 1 ,
159161 value_type = 'int' ,
160162 hint = 'If specified, the node will ping all other known nodes in the mesh every N seconds. The default is -1, meaning no pings are sent.' ,
@@ -179,17 +181,18 @@ def __init__(self, args=None):
179181 )
180182 self .add_config_option (
181183 section = 'controller' ,
182- key = 'listen_address ' ,
183- default_value = '0.0.0.0' ,
184+ key = 'listen ' ,
185+ default_value = 'receptor:// 0.0.0.0:8888 ' ,
184186 value_type = 'str' ,
185- hint = 'Set/override IP address to listen on. If not set here or in a config file, the default is 0.0.0.0/0.' ,
187+ hint = 'Set IP address and port to listen on. If not set here or in a config file, the default is receptor:// 0.0.0.0/0:8888 .' ,
186188 )
187189 self .add_config_option (
188190 section = 'controller' ,
189- key = 'listen_port' ,
190- default_value = 8888 ,
191- value_type = 'int' ,
192- hint = 'Set/override TCP port to listen on. If not set here or in a config file, the default is 8888.' ,
191+ key = 'websocket_listen' ,
192+ default_value = '' ,
193+ value_type = 'str' ,
194+ hint = 'Set IP address and port to listen on for websocket clients in the form ws://addr:port. '
195+ 'If not set here or in a config file then it is disabled' ,
193196 )
194197 self .add_config_option (
195198 section = 'controller' ,
@@ -199,13 +202,12 @@ def __init__(self, args=None):
199202 value_type = 'str' ,
200203 hint = 'Set/override controller node identifier. If unspecified here or in a config file, one will be automatically generated.' ,
201204 )
202- # Ping options
203205 self .add_config_option (
204206 section = 'ping' ,
205- key = 'socket_path ' ,
206- default_value = '/var/run/receptor_controller.sock ' ,
207- value_type = 'path ' ,
208- hint = 'Path to control socket for controller commands.' ,
207+ key = 'peer ' ,
208+ default_value = '' ,
209+ value_type = 'str ' ,
210+ hint = 'The peer to relay the ping directive through'
209211 )
210212 self .add_config_option (
211213 section = 'controller' ,
@@ -455,7 +457,6 @@ def go(self):
455457 raise ReceptorRuntimeError ("you must specify a subcommand (%s)." % (", " .join (SUBCOMMAND_EXTRAS .keys ()),))
456458 self ._parsed_args .func (self )
457459
458-
459460 def get_client_ssl_context (self ):
460461 if self .auth_ssl_cert :
461462 logger .debug ("Loading SSL Client Context" )
0 commit comments