Beispiel #1
0
// NewOutbound builds a new TChannel outbound which uses the given Channel to
// make requests.
func NewOutbound(ch *tchannel.Channel, options ...OutboundOption) transport.UnaryOutbound {
	o := outbound{Channel: ch, started: atomic.NewBool(false)}
	for _, opt := range options {
		opt(&o)
	}
	return o
}
Beispiel #2
0
// NewPeerListOutbound builds a new HTTP outbound built around a PeerList
// for getting potential downstream hosts.
// PeerList.ChoosePeer MUST return *hostport.Peer objects.
// PeerList.Start MUST be called before Outbound.Start
func NewPeerListOutbound(peerList transport.PeerList, urlTemplate *url.URL) *Outbound {
	return &Outbound{
		started:     atomic.NewBool(false),
		peerList:    peerList,
		urlTemplate: urlTemplate,
	}
}