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

Add remote_addr to context #70

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

joshrendek
Copy link

No description provided.

@joshrendek joshrendek changed the title Add remote_addr to contexxt Add remote_addr to context Jun 27, 2024
@joshrendek joshrendek mentioned this pull request Jun 27, 2024
@@ -127,11 +127,13 @@ func (srv *Server) Serve(listener net.Listener) error {

func (srv *Server) serve(ctx context.Context, conn net.Conn) error {
ctx = setTypeInfo(ctx, srv.types)
ctx = context.WithValue(ctx, "remote_addr", conn.RemoteAddr())
Copy link
Owner

Choose a reason for hiding this comment

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

Would you be able to create a wrapper function to fetch the remote_addr from the context? Similar as done within the conn.go: https://github.com/jeroenrinzema/psql-wire/blob/main/conn.go#L24-L31

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

Successfully merging this pull request may close these issues.

2 participants