github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/network/proxy/conduit.go (about) 1 package proxy 2 3 import ( 4 "github.com/onflow/flow-go/model/flow" 5 "github.com/onflow/flow-go/network" 6 ) 7 8 // ProxyConduit is a special conduit which wraps the given conduit and replaces the target 9 // of every network send with the given target node. 10 type ProxyConduit struct { 11 network.Conduit 12 targetNodeID flow.Identifier 13 } 14 15 var _ network.Conduit = (*ProxyConduit)(nil) 16 17 func (c *ProxyConduit) Publish(event interface{}, targetIDs ...flow.Identifier) error { 18 return c.Conduit.Publish(event, c.targetNodeID) 19 } 20 21 func (c *ProxyConduit) Unicast(event interface{}, targetID flow.Identifier) error { 22 return c.Conduit.Unicast(event, c.targetNodeID) 23 } 24 25 func (c *ProxyConduit) Multicast(event interface{}, num uint, targetIDs ...flow.Identifier) error { 26 return c.Conduit.Multicast(event, 1, c.targetNodeID) 27 }