cycls 0.0.2.17__py3-none-any.whl → 0.0.2.18__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
cycls/cycls.py
CHANGED
|
@@ -34,7 +34,7 @@ async def create_ssh_tunnel(x,y,z='tuns.sh'):
|
|
|
34
34
|
try:
|
|
35
35
|
async with asyncssh.connect(z,client_keys=[key_path],known_hosts=None) as conn:
|
|
36
36
|
listener = await conn.forward_remote_port(x, 80, 'localhost', y)
|
|
37
|
-
print("✦/✧","tunnel\n")
|
|
37
|
+
print("✦/✧","tunnel | open\n")
|
|
38
38
|
await listener.wait_closed()
|
|
39
39
|
except (OSError, asyncssh.Error) as e:
|
|
40
40
|
print("✦/✧",f"tunnel disconnected: {e}")
|
|
@@ -45,14 +45,14 @@ def register(handles, network, url, mode):
|
|
|
45
45
|
response = client.post(f"{network}/register", json={"handles":handles, "url":url, "mode":mode})
|
|
46
46
|
if response.status_code==200:
|
|
47
47
|
data = (response.json()).get("content")
|
|
48
|
-
for i in data:print(f"✦/✧ {i[0]}
|
|
48
|
+
for i in data:print(f"✦/✧ {i[0]} | {network}/{i[1]}")
|
|
49
49
|
else:
|
|
50
50
|
print("✦/✧ failed to register ⚠️")
|
|
51
51
|
except Exception as e:
|
|
52
52
|
print(f"An error occurred: {e}")
|
|
53
53
|
|
|
54
54
|
async def run_server(x,y):
|
|
55
|
-
config = uvicorn.Config(x, host="127.0.0.1", port=y, log_level="error")
|
|
55
|
+
config = uvicorn.Config(x, host="127.0.0.1", port=y, log_level="error") # loop="asyncio"
|
|
56
56
|
server = uvicorn.Server(config)
|
|
57
57
|
await server.serve()
|
|
58
58
|
|
|
@@ -97,19 +97,28 @@ class Cycls:
|
|
|
97
97
|
if self.url != "":
|
|
98
98
|
prod=True
|
|
99
99
|
|
|
100
|
-
print(f"✦/✧
|
|
100
|
+
print(f"✦/✧ port | {self.port}")
|
|
101
101
|
if prod:
|
|
102
102
|
print("✦/✧",f"production mode | url: {self.url}")
|
|
103
103
|
register(list(self.apps.keys()), self.network, self.url+"/gateway", "prod")
|
|
104
104
|
else:
|
|
105
105
|
self.url = f"http://{self.subdomain}-cycls.tuns.sh"
|
|
106
|
-
print("✦/✧","development
|
|
106
|
+
print("✦/✧","mode | development")
|
|
107
107
|
# print("✦/✧",f"url {self.url}")
|
|
108
108
|
register(list(self.apps.keys()), self.network, self.url+"/gateway", "dev")
|
|
109
109
|
t1 = asyncio.create_task(create_ssh_tunnel(f"{self.subdomain}-cycls", self.port))
|
|
110
110
|
|
|
111
111
|
t2 = asyncio.create_task(run_server(self.server,self.port))
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
|
|
113
|
+
try:
|
|
114
|
+
if not prod:
|
|
115
|
+
await asyncio.gather(t1, t2)
|
|
116
|
+
else:
|
|
117
|
+
await asyncio.gather(t2)
|
|
118
|
+
except KeyboardInterrupt:
|
|
119
|
+
# print("🔥")
|
|
120
|
+
tasks = asyncio.all_tasks()
|
|
121
|
+
for task in tasks:
|
|
122
|
+
task.cancel()
|
|
114
123
|
|
|
115
124
|
# poetry publish --build
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
cycls/__init__.py,sha256=HPPQikt_Trbc4s8XyEOeOjB_JRWXlXIkJuh762nUM_g,24
|
|
2
|
+
cycls/cycls.py,sha256=-jm2IM_yNlZoUYmcDhqTcz_Umiwf7jQLBq_s6pbpAQM,4304
|
|
3
|
+
cycls/tuns,sha256=CT8olxDKOM0cY6r_bbSGtnWyEmEYFVDVHj9ug3gbYHk,1843
|
|
4
|
+
cycls-0.0.2.18.dist-info/METADATA,sha256=bpAtiAC5ACoddUPX7EYzzikKgT-IZf0f_CyJCGqFasA,2018
|
|
5
|
+
cycls-0.0.2.18.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
6
|
+
cycls-0.0.2.18.dist-info/RECORD,,
|
cycls-0.0.2.17.dist-info/RECORD
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
cycls/__init__.py,sha256=HPPQikt_Trbc4s8XyEOeOjB_JRWXlXIkJuh762nUM_g,24
|
|
2
|
-
cycls/cycls.py,sha256=t1-4vkJ-hltM-vKAnye0IauGk35WffOm7-4JbL1721Q,4063
|
|
3
|
-
cycls/tuns,sha256=CT8olxDKOM0cY6r_bbSGtnWyEmEYFVDVHj9ug3gbYHk,1843
|
|
4
|
-
cycls-0.0.2.17.dist-info/METADATA,sha256=Si9de9uRafOo5zo3ueXulHlzzaMyR5mO-Da-rXRMR4U,2018
|
|
5
|
-
cycls-0.0.2.17.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
6
|
-
cycls-0.0.2.17.dist-info/RECORD,,
|
|
File without changes
|