github.com/koko1123/flow-go-1@v0.29.6/network/proxy/conduit.go (about)

     1  package proxy
     2  
     3  import (
     4  	"github.com/koko1123/flow-go-1/model/flow"
     5  	"github.com/koko1123/flow-go-1/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  func (c *ProxyConduit) Publish(event interface{}, targetIDs ...flow.Identifier) error {
    16  	return c.Conduit.Publish(event, c.targetNodeID)
    17  }
    18  
    19  func (c *ProxyConduit) Unicast(event interface{}, targetID flow.Identifier) error {
    20  	return c.Conduit.Unicast(event, c.targetNodeID)
    21  }
    22  
    23  func (c *ProxyConduit) Multicast(event interface{}, num uint, targetIDs ...flow.Identifier) error {
    24  	return c.Conduit.Multicast(event, 1, c.targetNodeID)
    25  }