From 3d2eab35722efeab8742ece94d2a2b2cc700f751 Mon Sep 17 00:00:00 2001 From: Louis Thibault <9452561+lthibault@users.noreply.github.com> Date: Thu, 1 Dec 2022 12:56:37 -0500 Subject: [PATCH] Add docstring for WithAppSpecificRPCInspector (#510) --- pubsub.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pubsub.go b/pubsub.go index cf4644a9..b94a1ecd 100644 --- a/pubsub.go +++ b/pubsub.go @@ -533,6 +533,10 @@ func WithSeenMessagesTTL(ttl time.Duration) Option { } } +// WithAppSpecificRpcInspector sets a hook that inspect incomings RPCs prior to +// processing them. The inspector is invoked on an accepted RPC just before it +// is handled. If inspector's error is nil, the RPC is handled. Otherwise, it +// is dropped. func WithAppSpecificRpcInspector(inspector func(peer.ID, *RPC) error) Option { return func(ps *PubSub) error { ps.appSpecificRpcInspector = inspector