GRPC Get Server Address

89 views
Skip to first unread message

Mingyu Lu

unread,
Apr 8, 2022, 10:55:55 AM4/8/22
to grpc.io
Hi, 
I am using GRPC with UNIX domain socket. I'd like to have one server listen on two sockets A and B.
If requests come from A, I'd like to do something but if from B, I want to do something different.
For security concern, I can't trust what comes from request.
I suppose if I can get server address when requests come in, problem solved.
Does anyone have any idea ? Thanks.

Eric Anderson

unread,
Apr 8, 2022, 11:54:06 AM4/8/22
to Mingyu Lu, grpc.io
What programming language are you using?

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/b4c59951-59c3-4b2c-9773-9a5ba6f589f3n%40googlegroups.com.

Mingyu Lu

unread,
Apr 10, 2022, 8:54:32 PM4/10/22
to grpc.io
C/C++

Mingyu Lu

unread,
Apr 13, 2022, 8:50:13 PM4/13/22
to grpc.io
Can anyone give any advice ?

yas...@google.com

unread,
May 1, 2023, 6:28:40 PM5/1/23
to grpc.io
Wow, I forgot to respond to this. Apologies!

`ServerContext` does give you `peer()` which I believe is filled with the appropriate address. For security related purposes, we do not recommend that this be used though.

You probably want to use a proper authentication mechanism like the ones documented at https://grpc.io/docs/guides/auth/ and then use `grpc::AuthContext()` to get the context per request.

Reply all
Reply to author
Forward
0 new messages