1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00

Async all the things

Flask → Sanic, Requests → HTTP3, Add SSHTunnel for SSH Proxying, Remove Gunicorn dependency
This commit is contained in:
Matt Love
2019-07-15 02:30:42 -07:00
parent c53a8ce373
commit b7747cf1df
15 changed files with 535 additions and 587 deletions

View File

@@ -2,6 +2,8 @@
Global Constants for hyperglass
"""
protocol_map = {80: "http", 8080: "http", 443: "https", 8443: "https"}
class Status:
"""
@@ -9,8 +11,6 @@ class Status:
hyperglass.
"""
# pylint: disable=too-few-public-methods
codes_dict = {
200: ("valid", "Valid Query"),
405: ("not_allowed", "Query Not Allowed"),
@@ -163,3 +163,21 @@ class Supported:
query_type tuple.
"""
return bool(query_type in Supported.query_types)
@staticmethod
def map_transport(nos):
"""
Returns "scrape" if input nos is in Supported.scrape tuple, or
"rest" if input nos is in Supported.rest tuple.
"""
transport = None
if nos in Supported.scrape:
transport = "scrape"
elif nos in Supported.rest:
transport = "rest"
return transport
@staticmethod
def map_rest(nos):
uri_map = {"frr": "frr", "bird": "bird"}
return uri_map.get(nos)