Skip to content
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

使用http插件统计流量未收到上报数据 #458

Closed
xwydq opened this issue Apr 21, 2024 · 1 comment
Closed

使用http插件统计流量未收到上报数据 #458

xwydq opened this issue Apr 21, 2024 · 1 comment

Comments

@xwydq
Copy link

xwydq commented Apr 21, 2024

按照文档配置 支持使用插件获取统计数据:

services:
  - name: s-30175
    addr: :30175
    observer: observer-0 # 服务上的观测器
    handler:
      type: socks5
      chain: c-30175
    listener:
      type: tcp
    metadata:
      enableStats: true # 开启统计
observers:
- name: observer-0
  plugin:
    type: http
    addr: http://3.3.3.3:8000/observer

已经 开发 http://3.3.3.3:8000/observer 的接口服务

from fastapi import FastAPI
import json

app = FastAPI()

@app.post("/observer")
async def receive_data(data: dict):
    # Append the data to a file with newline for each item
    with open("data.json", "a") as f:
        for event in data["events"]:
            json.dump(event, f)
            f.write("\n")

    # Return a success message
    return {"message": "Data received and appended successfully"}

if __name__ == "__main__":
    import uvicorn
    uvicorn.run(app, host="0.0.0.0", port=8000)

测试单独 curl post 请求正常。
配置后中转代理使用正常,但是 插件服务不能收到任何数据。

请问插件是需要单独部署吗?

@ginuerzh
Copy link
Member

请确保GOST服务端可以连接并访问到插件服务3.3.3.3:8000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants