Add docstring for WithAppSpecificRPCInspector (#510)

This commit is contained in:
Louis Thibault 2022-12-01 12:56:37 -05:00 committed by GitHub
parent d3f151c224
commit 3d2eab3572
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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