diff --git a/pkg/api/interceptor.go b/pkg/api/interceptor.go index 81d7c2d3..3c30d59f 100644 --- a/pkg/api/interceptor.go +++ b/pkg/api/interceptor.go @@ -158,7 +158,7 @@ func (wa *WalletAuthorizer) applyLimits(ctx context.Context, fullMethod string, // * for other authorization failure return status.Errorf(codes.PermissionDenied, ...) _, method := splitMethodName(fullMethod) - ip := clientIPFromContext(ctx) + ip := ClientIPFromContext(ctx) if len(ip) == 0 { // requests without an IP address are bucketed together as "ip_unknown" ip = "ip_unknown" @@ -248,7 +248,7 @@ func allowedToPublish(topic string, wallet types.WalletAddr) bool { return true } -func clientIPFromContext(ctx context.Context) string { +func ClientIPFromContext(ctx context.Context) string { md, _ := metadata.FromIncomingContext(ctx) vals := md.Get("x-forwarded-for") if len(vals) == 0 { diff --git a/pkg/api/message/v1/service.go b/pkg/api/message/v1/service.go index 509737e7..b52e951c 100644 --- a/pkg/api/message/v1/service.go +++ b/pkg/api/message/v1/service.go @@ -17,6 +17,7 @@ import ( wakupb "github.com/status-im/go-waku/waku/v2/protocol/pb" wakurelay "github.com/status-im/go-waku/waku/v2/protocol/relay" proto "github.com/xmtp/proto/v3/go/message_api/v1" + api "github.com/xmtp/xmtp-node-go/pkg/api" apicontext "github.com/xmtp/xmtp-node-go/pkg/api/message/v1/context" "github.com/xmtp/xmtp-node-go/pkg/logging" "github.com/xmtp/xmtp-node-go/pkg/metrics" @@ -139,7 +140,7 @@ func (s *Service) Close() { func (s *Service) Publish(ctx context.Context, req *proto.PublishRequest) (*proto.PublishResponse, error) { for _, env := range req.Envelopes { log := s.log.Named("publish").With(zap.String("content_topic", env.ContentTopic)) - log.Debug("received message") + log.Info("received message", zap.String("client_ip", api.ClientIPFromContext(ctx))) if len(env.ContentTopic) > MaxContentTopicNameSize { return nil, status.Errorf(codes.InvalidArgument, "topic length too big")