mirror of
https://github.com/cmz0228/hysteria-dev.git
synced 2025-07-20 02:18:02 +00:00
feat: HTTP auth
This commit is contained in:
24
extras/auth/http_test.py
Normal file
24
extras/auth/http_test.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from flask import Flask, request, jsonify
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
@app.route("/auth", methods=["POST"])
|
||||
def auth():
|
||||
data = request.json
|
||||
|
||||
if data is None:
|
||||
return jsonify({"ok": False, "id": ""}), 400
|
||||
|
||||
addr = data.get("addr", "")
|
||||
auth = data.get("auth", "")
|
||||
tx = data.get("tx", 0)
|
||||
|
||||
if addr == "123.123.123.123:5566" and auth == "wahaha" and tx == 12345:
|
||||
return jsonify({"ok": True, "id": "some_unique_id"})
|
||||
else:
|
||||
return jsonify({"ok": False, "id": ""})
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run()
|
Reference in New Issue
Block a user