以前、以下のコードを使用してクライアント IP を取得しましたexpress.js
req.headers['x-forwarded-for'] ||
req.connection.remoteAddress ||
req.socket.remoteAddress ||
req.connection.socket.remoteAddress
grpc node アプリケーションでクライアントの IP を取得する方法を知りたいです。API呼び出しが外部からであっても常にipv4:127.0.0.1:33944を与えるgetPeer()を試しました。
以下の go コードに相当するものは機能しますか?
call.getAttributes().get(Grpc.TRANSPORT_ATTR_REMOTE_ADDR).toString();