New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deployment of basic features #1
Conversation
flask_app/app.py
Outdated
port = request.environ.get('REMOTE_PORT') | ||
mptcp = False | ||
|
||
conn = list(filter(None, check_output(["ss", "-Mt", "-n"]).decode("ascii").split('\n'))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use -H
to remove the header.
You can also use a filter at the end, not to have to list all connections, just the one you want:
ss -MtnH src {addr} sport {port}
Rendered webpage with connection status and MPTCP version if established. | ||
""" | ||
|
||
addr = request.remote_addr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does it display a v6 address? In ss
, it surrounds it with []
, you might need to handle that.
(to check if it is a v6 address, simply look for :
in the address)
flask_app/app.py
Outdated
conn = list(filter(None, check_output(["ss", "-Mt", "-n"]).decode("ascii").split('\n'))) | ||
for c in conn: | ||
args = list(filter(None, c.split(' '))) | ||
if (args[-1] == f"{addr}:{port}" and args[0] == "mptcp"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might be good to check if the entry is in the list → if not a different error.
So we could have 3 possibilities: MPTCP / TCP / Error
# print() | ||
return render_template('index.html', state_message=state_message, state_class=state_class) | ||
|
||
@app.route('/stream_audio') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you need this? Just to have a file to download?
You will need to put the license and the source somewhere to avoid troubles... (even if we can use it)
flask_app/static/styles.css
Outdated
} | ||
|
||
.loading { | ||
background-color: #f0ad4e; /* Couleur orange pour le chargement */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I quote "who put comments in French in their code???"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-_-'
@mux99 @CrapsDorian : if it is easy to do, it might be good to have a specific reply when curl is used, e.g. by checking if the user-agent starts with That's what we have when we do a |
flask_app/app.py
Outdated
try: | ||
conn = check_output(["ss", "-MtnH", "src", f"{addr}", "sport", f"{port}"]).decode("ascii") | ||
if (conn == ""): | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't forget to do something here, raise
an exception or:
if not conn:
(...)
elif (...) == "mptcp":
(...)
else:
(...)
protocol was missing form config, causing server to use the wrong one by default
We still need to check if it works in IPv6. |
And the service should not stop, but be detached. |
this PR as for objective to simply add the basic functionality of the app
to be noted: