集成 Vector 日志处理

This commit is contained in:
2025-03-03 17:14:45 +08:00
parent cc0b74c5c2
commit 4b3cb8e354
8 changed files with 74 additions and 23 deletions

View File

@@ -122,7 +122,7 @@ func isTls(bytes []byte) (string, string, bool) {
}
func analysisHttp(reader *bufio.Reader) (string, error) {
slog.Debug("analysis http")
// reade top
top, err := httpReadLine(reader)
if err != nil {
@@ -164,7 +164,6 @@ func httpReadLine(reader *bufio.Reader) (line string, err error) {
}
func analysisTls(reader *bufio.Reader) (string, error) {
slog.Debug("analysis https")
// tls record
_, err := utils.ReadBuffer(reader, 5)

View File

@@ -48,9 +48,11 @@ func (s *Server) Run() error {
if err != nil {
return errors.Wrap(err, "dispatcher 监听失败")
}
defer utils.Close(ls)
m := cmux.New(ls)
m.SetReadTimeout(5 * time.Second)
defer m.Close()
go func() {
<-s.ctx.Done()

View File

@@ -125,7 +125,7 @@ func processHttps(ctx context.Context, req *Request) (*core.Conn, error) {
Conn: req.conn,
Reader: req.reader,
Tag: req.conn.RemoteAddr().String() + "_" + req.conn.LocalAddr().String(),
Protocol: "https",
Protocol: "http",
Dest: req.dest,
Auth: req.auth,
}, nil