// Copyright 2021 The Swarm Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.packagep2pimport("context""errors""time")varErrUnexpected=errors.New("unexpected request while in light mode")// WithDisconnectStreams will mutate the given spec and replace the handler with a always erroring one.funcWithDisconnectStreams(specProtocolSpec){fori:=rangespec.StreamSpecs{spec.StreamSpecs[i].Handler=func(ccontext.Context,pPeer,sStream)error{returnNewDisconnectError(ErrUnexpected)}}}// WithBlocklistStreams will mutate the given spec and replace the handler with a always erroring one.funcWithBlocklistStreams(durtime.Duration,specProtocolSpec){fori:=rangespec.StreamSpecs{spec.StreamSpecs[i].Handler=func(ccontext.Context,pPeer,sStream)error{returnNewBlockPeerError(dur,ErrUnexpected)}}}