2019-07-29 19:34:34 +00:00
|
|
|
package node
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
|
|
|
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
|
|
|
|
|
2019-10-18 04:47:41 +00:00
|
|
|
"github.com/filecoin-project/lotus/node/modules/lp2p"
|
2019-07-29 19:34:34 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func MockHost(mn mocknet.Mocknet) Option {
|
|
|
|
return Options(
|
2021-06-24 14:02:51 +00:00
|
|
|
ApplyIf(func(s *Settings) bool { return !s.Base },
|
|
|
|
Error(errors.New("MockHost must be specified after Base")),
|
2019-07-29 19:34:34 +00:00
|
|
|
),
|
|
|
|
|
|
|
|
Override(new(lp2p.RawHost), lp2p.MockHost),
|
|
|
|
Override(new(mocknet.Mocknet), mn),
|
|
|
|
)
|
|
|
|
}
|