1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-vps-admin.git synced 2025-03-09 15:40:05 +00:00

Default debug to false, add a debug info for tunnel creation, test speedtest

This commit is contained in:
Ycarus 2020-07-16 09:55:19 +02:00
parent c9254c470c
commit daba5f2a01
2 changed files with 14 additions and 1 deletions

View file

@ -15,5 +15,6 @@
"disabled": false "disabled": false
} }
} }
] ],
"debug": false
} }

View file

@ -41,6 +41,7 @@ from fastapi.openapi.docs import get_swagger_ui_html
from fastapi.openapi.models import OAuthFlows as OAuthFlowsModel from fastapi.openapi.models import OAuthFlows as OAuthFlowsModel
from fastapi.openapi.utils import get_openapi from fastapi.openapi.utils import get_openapi
from fastapi.openapi.models import SecurityBase as SecurityBaseModel from fastapi.openapi.models import SecurityBase as SecurityBaseModel
from fastapi.responses import StreamingResponse
from pydantic import BaseModel, ValidationError # pylint: disable=E0611 from pydantic import BaseModel, ValidationError # pylint: disable=E0611
from starlette.status import HTTP_403_FORBIDDEN from starlette.status import HTTP_403_FORBIDDEN
from starlette.responses import RedirectResponse, Response, JSONResponse from starlette.responses import RedirectResponse, Response, JSONResponse
@ -277,6 +278,7 @@ def add_gre_tunnels():
modif_config_user(user, {'gre_tunnels': user_gre_tunnels}) modif_config_user(user, {'gre_tunnels': user_gre_tunnels})
nbip = nbip + 1 nbip = nbip + 1
except Exception as exception: except Exception as exception:
LOG.error("Gre-tunnel exception (" + exception.message + " - " + exception.args + ")")
pass pass
final_md5 = hashlib.md5(file_as_bytes(open('/etc/shorewall/snat', 'rb'))).hexdigest() final_md5 = hashlib.md5(file_as_bytes(open('/etc/shorewall/snat', 'rb'))).hexdigest()
if initial_md5 != final_md5: if initial_md5 != final_md5:
@ -2002,6 +2004,16 @@ async def list_users(current_user: User = Depends(get_current_user)):
content = json.load(f) content = json.load(f)
return content['users'][0] return content['users'][0]
async def fake_data():
for i in range(100):
yield b"fake data speedtest"
@app.get('/speedtest', summary="Test speed from the server")
async def list_users(current_user: User = Depends(get_current_user)):
return StreamingResponse(fake_data())
if __name__ == '__main__': if __name__ == '__main__':
LOG.debug("Main OMR-Admin launch") LOG.debug("Main OMR-Admin launch")
with open('/etc/openmptcprouter-vps-admin/omr-admin-config.json') as f: with open('/etc/openmptcprouter-vps-admin/omr-admin-config.json') as f: