add aioupnp version to upnp status

-set non-blank not found message if upnp fails
This commit is contained in:
Jack Robison 2018-10-26 12:42:12 -04:00
parent 5f2f06c269
commit d9b1be6214
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 4 additions and 1 deletions

View file

@ -8,6 +8,7 @@ from hashlib import sha256
from types import SimpleNamespace from types import SimpleNamespace
from twisted.internet import defer, threads, reactor, error, task from twisted.internet import defer, threads, reactor, error, task
import lbryschema import lbryschema
from aioupnp import __version__ as aioupnp_version
from aioupnp.upnp import UPnP from aioupnp.upnp import UPnP
from aioupnp.fault import UPnPError from aioupnp.fault import UPnPError
from lbrynet import conf from lbrynet import conf
@ -792,8 +793,9 @@ class UPnPComponent(Component):
def get_status(self): def get_status(self):
return { return {
'aioupnp_version': aioupnp_version,
'redirects': self.upnp_redirects, 'redirects': self.upnp_redirects,
'gateway': '' if not self.upnp else self.upnp.gateway.manufacturer_string, 'gateway': 'No gateway found' if not self.upnp else self.upnp.gateway.manufacturer_string,
'dht_redirect_set': 'UDP' in self.upnp_redirects, 'dht_redirect_set': 'UDP' in self.upnp_redirects,
'peer_redirect_set': 'TCP' in self.upnp_redirects, 'peer_redirect_set': 'TCP' in self.upnp_redirects,
'external_ip': self.external_ip 'external_ip': self.external_ip

View file

@ -773,6 +773,7 @@ class Daemon(AuthJSONRPCServer):
'managed_files': (int) count of files in the file manager, 'managed_files': (int) count of files in the file manager,
}, },
'upnp': { 'upnp': {
'aioupnp_version': (str),
'redirects': { 'redirects': {
<TCP | UDP>: (int) external_port, <TCP | UDP>: (int) external_port,
}, },