Add tunnel support ,and implment TelegramTunnel. Now we can use telegram bot connect to installed agent/workflow.

This commit is contained in:
Liu Zhicong
2023-09-15 17:35:12 -07:00
parent c4d97942cb
commit ef9ab83e63
8 changed files with 234 additions and 228 deletions
+34
View File
@@ -0,0 +1,34 @@
from typing import List
class Contact:
def __init__(self,name:str) -> None:
self.name = name
self.tags = []
def is_zone_owner(self,zone_id=None) -> bool:
return True
def get_tags(self)->List[str]:
return self.tags
def get_name(self)->str:
return self.name
class ContactManager:
_instance = None
@classmethod
def get_instance(cls):
if cls._instance is None:
cls._instance = ContactManager()
return cls._instance
def __init__(self) -> None:
self.contacts = {}
self.contacts["liuzhicong"] = Contact("liuzhicong")
#def get_by_addr(self,addr:str) -> Contact:
# pass
def get_by_name(self,name:str) -> Contact:
return self.contacts.get(name)