Skip to content

Code refactor to improve naming, logging and connection handling (GSoC2025/issue 161)#189

Open
furusiyya wants to merge 9 commits into
mainfrom
gsoc2025/issue-161
Open

Code refactor to improve naming, logging and connection handling (GSoC2025/issue 161)#189
furusiyya wants to merge 9 commits into
mainfrom
gsoc2025/issue-161

Conversation

@furusiyya
Copy link
Copy Markdown
Collaborator

@furusiyya furusiyya commented Apr 26, 2026

  • Renamed the TCP passthrough handler to proxy_tcp to describe the active proxy behavior more clearly.
  • Code refactor to improve naming, logging and connection handling like metadata, timeout, closing/cleanup.
  • Updated docs for the proxy TCP configurations

Fixes #161

@furusiyya furusiyya changed the title Refactor TCP passthrough into proxy TCP (GSoC2025/issue 161) Code refactor to improve naming, logging and connection handling (GSoC2025/issue 161) Apr 26, 2026
@furusiyya furusiyya force-pushed the gsoc2025/issue-161 branch from 7b9ad0f to 20d95ae Compare April 26, 2026 17:17
@furusiyya
Copy link
Copy Markdown
Collaborator Author

@glaslos This is ready from my side. Let me know if you’re okay with merging it into master.

@furusiyya furusiyya requested a review from glaslos April 26, 2026 17:24
Comment thread glutton.go Outdated
g.Logger.Error("Failed to handle TCP connection", producer.ErrAttr(err), slog.String("handler", rule.Target))
}
}()
if rule.Type == "proxy_tcp" {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use switch instead

Comment thread protocols/tcp/proxy_tcp.go Outdated
}

func (r reader) Read(p []byte) (int, error) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no newline after function signature

Comment thread protocols/tcp/proxy_tcp.go Outdated

// A Write can partially succeed. Only p[:n] reached the destination, so only
// those bytes should affect logs, byte counts, and capture samples.
if n > 0 {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we should still handle the error first

Copy link
Copy Markdown
Collaborator Author

@furusiyya furusiyya May 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, so that means recording partial writes isn't useful when err!=nil. I will also update tests accordingly.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please let me know if I understood your comment correctly.

@furusiyya
Copy link
Copy Markdown
Collaborator Author

@glaslos, I've updated the PR, let me know if you have any additional comments. Thanks!

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

Successfully merging this pull request may close these issues.

Implement a pass-through configuration

3 participants