Exemple #1
0
package tchannel

import (
	"context"
	"io"

	"go.uber.org/yarpc/internal/encoding"
	"go.uber.org/yarpc/internal/errors"
	"go.uber.org/yarpc/transport"

	"github.com/uber-go/atomic"
	"github.com/uber/tchannel-go"
)

var errOutboundNotStarted = errors.ErrOutboundNotStarted("tchannel.Outbound")

// OutboundOption configures Outbound.
type OutboundOption func(*outbound)

// HostPort specifies that the requests made by this outbound should be to
// the given address.
//
// By default, if HostPort was not specified, the Outbound will use the
// TChannel global peer list.
func HostPort(hostPort string) OutboundOption {
	return func(o *outbound) {
		o.HostPort = hostPort
	}
}
Exemple #2
0
	"net/url"
	"strings"
	"time"

	"go.uber.org/yarpc/internal/errors"
	"go.uber.org/yarpc/transport"
	terrors "go.uber.org/yarpc/transport/internal/errors"
	"go.uber.org/yarpc/transport/peer/hostport"
	"go.uber.org/yarpc/transport/peer/peerlist"

	"github.com/opentracing/opentracing-go"
	"github.com/opentracing/opentracing-go/ext"
	"github.com/uber-go/atomic"
)

var errOutboundNotStarted = errors.ErrOutboundNotStarted("http.Outbound")

// this ensures the HTTP outbound implements both transport.Outbound interfaces
var (
	_ transport.UnaryOutbound  = (*Outbound)(nil)
	_ transport.OnewayOutbound = (*Outbound)(nil)
)

type outboundConfig struct {
	keepAlive time.Duration
}

// NewOutbound builds a new HTTP outbound that sends requests to the given
// URL.
//
// Deprecated: create outbounds through NewPeerListOutbound instead