add upnp status dictionary to status response

-log upnp debugging information as an error
This commit is contained in:
Jack Robison 2018-10-18 15:10:00 -04:00
parent 07d353a947
commit fb34476cd7
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
3 changed files with 20 additions and 1 deletions

View file

@ -54,6 +54,7 @@ most commands.
* added `address_unused` command to get existing or generate a new unused address. * added `address_unused` command to get existing or generate a new unused address.
* added pagination support for `address_list`, `channel_list`, `claim_list_mine`, * added pagination support for `address_list`, `channel_list`, `claim_list_mine`,
`transaction_list` and `utxo_list`. `transaction_list` and `utxo_list`.
* added `upnp` field to `status` response
* removed `send_amount_to_address` command previously marked as deprecated * removed `send_amount_to_address` command previously marked as deprecated
* removed `channel_list_mine` command previously marked as deprecated * removed `channel_list_mine` command previously marked as deprecated
* removed `get_availability` command previously marked as deprecated * removed `get_availability` command previously marked as deprecated

View file

@ -718,12 +718,18 @@ class UPnPComponent(Component):
else: else:
log.info("got external ip from upnp: %s", self.external_ip) log.info("got external ip from upnp: %s", self.external_ip)
yield self._setup_redirects() yield self._setup_redirects()
log.info("set up upnp port redirects")
except Exception as err: except Exception as err:
log.warning("error trying to set up upnp: %s", err) log.warning("error trying to set up upnp: %s", err)
self.external_ip = CS.get_external_ip() self.external_ip = CS.get_external_ip()
else: else:
self.external_ip = CS.get_external_ip() self.external_ip = CS.get_external_ip()
if self.upnp:
if not self.upnp_redirects:
log.error("failed to setup upnp, debugging infomation: %s", self.upnp.zipped_debugging_info)
else:
log.info("set up upnp port redirects for gateway: %s", self.upnp.gateway.manufacturer_string)
else:
log.error("failed to setup upnp")
def stop(self): def stop(self):
return defer.DeferredList( return defer.DeferredList(
@ -731,6 +737,12 @@ class UPnPComponent(Component):
for protocol, port in self.upnp_redirects.items()] for protocol, port in self.upnp_redirects.items()]
) )
def get_status(self):
return {
'redirects': self.upnp_redirects,
'gateway': '' if not self.upnp else self.upnp.gateway.manufacturer_string,
}
class ExchangeRateManagerComponent(Component): class ExchangeRateManagerComponent(Component):
component_name = EXCHANGE_RATE_MANAGER_COMPONENT component_name = EXCHANGE_RATE_MANAGER_COMPONENT

View file

@ -771,6 +771,12 @@ class Daemon(AuthJSONRPCServer):
}, },
'file_manager': { 'file_manager': {
'managed_files': (int) count of files in the file manager, 'managed_files': (int) count of files in the file manager,
},
'upnp': {
'redirects': {
<TCP | UDP>: (int) external_port,
},
'gateway': (str) manufacturer and model,
} }
} }
""" """