go-gost / gost

GO Simple Tunnel - a simple tunnel written in golang
https://gost.run
MIT License
4.39k stars 528 forks source link

Metadata all time null at the recorder.plugin.http #412

Open fiamma06 opened 9 months ago

fiamma06 commented 9 months ago

Metadata all time null at the recorder.plugin.http

services:
- name: service-0
  addr: :8080
  recorders:
  - name: recorder-0
    record: recorder.service.router.dial.address
    metadata:
      testKey: testValue
...

recorders:
- name: recorder-0
  plugin:
    type: http
    addr: http://127.0.0.1:8000/recorder

I expect that the result will be the value testValue in JSON. But metadata is bnVsbA== == null.

image

fiamma06 commented 9 months ago

It is very important for us. Please can you confirm that this is a bug? or not?

ginuerzh commented 9 months ago

The metadata option for Recorder.Record() is currently not used.

fiamma06 commented 9 months ago

I tried to put metadata to all blocks like Service, Handler etc. But still have the same problem. May you can help to resolve it?


  "services": [
    {
      "name": "proxy-http-private-0",
      "addr": ":1080",
       "metadata": {
         "asdf":"asdf2"
      },
      "handler": {
        "type": "http",
    "chain": "chain-http-0",
        "auth": {
          "username": "user15",
          "password": "pass15"
        },
        "metadata": {
          "authBasicRealm": "user",
          "test": "asdf"
        }
      },
      "listener": {
        "type": "tcp",
        "metadata": {
          "asdf":"asdf2"
        }
      },
      "recorders": [
        {
          "name": "recorder-1",
          "record": "recorder.service.client.address"
        }
      ]
    }
  ],
  "recorders": [
    {
      "name": "recorder-2",
      "http": {
    "url": "https://webhook.site/0c5ca863-f439-4f54-8764-7675838a13ea"
      }
    },
    {
      "name": "recorder-1",
      "plugin": {
    "type": "http",
    "addr": "https://typedwebhook.tools/webhook/b3a2c595-438c-45f7-b47a-1f740202df99"
      }
    },
    {
      "name": "recorder-0",
      "redis": {
    "addr": "127.0.0.1:6379",
    "key": "gost:recorder:recorder-0",
    "type": "set"
      }
    }
  ],
  "chains": [
    {
      "name": "chain-http-0",
      "hops": [
        {
          "name": "hop-http-0",
              "metadata": {
                "asdf":"asdf2"
              },
          "nodes": [
            {
              "name": "proxy-http-private-node-1",
              "addr": "100.93.120.66:3128",
          "metadata": {
        "asdf":"asdf"
          }
            },
            {
              "name": "proxy-http-private-node-2",
              "addr": "100.93.120.66:3129"
            },
            {
              "name": "proxy-http-private-node-3",
              "addr": "100.93.120.66:3130"
            },
            {
              "name": "proxy-http-private-node-4",
              "addr": "100.93.120.66:3131"
            },
            {
              "name": "proxy-http-private-node-5",
              "addr": "100.93.120.66:3132"
            },
            {
              "name": "proxy-http-private-node-6",
              "addr": "100.93.120.66:3133"
            },
            {
              "name": "proxy-http-private-node-7",
              "addr": "100.93.120.66:3134"
            }
          ]
        }
      ]
    }
  ],
  "api": {
    "addr": ":8080",
    "pathPrefix": "/",
    "auth": {
      "username": "user1",
      "password": "pass1"
    }
  },
  "log": {
    "output": "/var/log/gost/gost-access.log",
    "level": "debug",
    "format": "json",
    "rotation": {
      "maxSize": 100,
      "maxAge": 10,
      "maxBackups": 3,
      "localTime": false,
      "compress": false
    }
  }
}```