Documentation ¶
Index ¶
- Variables
- type BackoffDuration
- type ClientConn
- type ClientConnBuilder
- type GRPCClientConnBuilder
- type Manager
- type Option
- func WithBackoff(b BackoffDuration) Option
- func WithClientConnBuilder(b ClientConnBuilder) Option
- func WithConnCheckInterval(i time.Duration) Option
- func WithLogger(l logrus.FieldLogger) Option
- func WithPeerClientBuilder(b peerTypes.ClientBuilder) Option
- func WithPeerServiceAddress(a string) Option
- func WithRetryTimeout(t time.Duration) Option
- type Options
- type Peer
- type PeerManager
Constants ¶
This section is empty.
Variables ¶
var DefaultOptions = Options{ PeerServiceAddress: "unix://" + defaults.HubbleSockPath, PeerClientBuilder: peerTypes.LocalClientBuilder{ DialTimeout: 5 * time.Second, }, ClientConnBuilder: GRPCClientConnBuilder{ DialTimeout: 5 * time.Second, Options: []grpc.DialOption{ grpc.WithInsecure(), grpc.WithBlock(), }, }, Backoff: &backoff.Exponential{ Min: 10 * time.Second, Max: 90 * time.Minute, Factor: 2.0, }, ConnCheckInterval: 2 * time.Minute, RetryTimeout: 30 * time.Second, Log: logging.DefaultLogger.WithField(logfields.LogSubsys, "hubble-relay"), }
DefaultOptions is the reference point for default values.
Functions ¶
This section is empty.
Types ¶
type BackoffDuration ¶
type BackoffDuration interface { // Duration returns a duration that depends on the given attempt count. Duration(attempt int) time.Duration }
BackoffDuration wraps Duration.
type ClientConn ¶ added in v1.8.2
type ClientConn interface { // GetState returns the connectivity.State of ClientConn. GetState() connectivity.State io.Closer // Invoke performs a unary RPC and returns after the response is received // into reply. Invoke(ctx context.Context, method string, args interface{}, reply interface{}, opts ...grpc.CallOption) error // NewStream begins a streaming RPC. NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (grpc.ClientStream, error) }
ClientConn is an interface that defines the functions clients need to perform unary and streaming RPCs. It is implemented by *grpc.ClientConn.
type ClientConnBuilder ¶ added in v1.8.2
type ClientConnBuilder interface { // ClientConn creates a new ClientConn using target. ClientConn(target string) (ClientConn, error) }
ClientConnBuilder wraps the ClientConn method.
type GRPCClientConnBuilder ¶
type GRPCClientConnBuilder struct { // DialTimeout specifies the timeout used when establishing a new // connection. DialTimeout time.Duration // Options is a set of grpc.DialOption to be used when creating a new // connection. Options []grpc.DialOption }
GRPCClientConnBuilder is a generic ClientConnBuilder implementation.
func (GRPCClientConnBuilder) ClientConn ¶
func (b GRPCClientConnBuilder) ClientConn(target string) (ClientConn, error)
ClientConn implements ClientConnBuilder.ClientConn.
type Manager ¶ added in v1.8.2
type Manager struct {
// contains filtered or unexported fields
}
Manager implements the PeerManager interface.
func NewManager ¶ added in v1.8.2
NewManager creates a new manager that connects to a peer gRPC service using target to manage peers and a connection to every peer's gRPC API.
func (*Manager) ReportOffline ¶ added in v1.8.2
ReportOffline implements PeerManager.ReportOffline.
type Option ¶
Option customizes the configuration of the Manager.
func WithBackoff ¶
func WithBackoff(b BackoffDuration) Option
WithBackoff sets the backoff between after a failed connection attempt.
func WithClientConnBuilder ¶
func WithClientConnBuilder(b ClientConnBuilder) Option
WithClientConnBuilder sets the GRPCClientConnBuilder that is used to create new gRPC connections to peers.
func WithConnCheckInterval ¶
WithConnCheckInterval sets the time interval between peer connections health checks.
func WithLogger ¶
func WithLogger(l logrus.FieldLogger) Option
WithLogger sets the logger to use for logging.
func WithPeerClientBuilder ¶
func WithPeerClientBuilder(b peerTypes.ClientBuilder) Option
WithPeerClientBuilder sets the ClientBuilder that is used to create new Peer service clients.
func WithPeerServiceAddress ¶
WithPeerServiceAddress sets the address of the peer gRPC service.
func WithRetryTimeout ¶
WithRetryTimeout sets the duration to wait before attempting to re-connect to the peer gRPC service.
type Options ¶ added in v1.8.2
type Options struct { PeerServiceAddress string PeerClientBuilder peerTypes.ClientBuilder ClientConnBuilder ClientConnBuilder Backoff BackoffDuration ConnCheckInterval time.Duration RetryTimeout time.Duration Log logrus.FieldLogger }
Options stores all the configuration values for peer manager.
type Peer ¶ added in v1.8.2
type Peer struct { hubblePeer.Peer Conn ClientConn }
Peer is like hubblePeer.Peer but includes a Conn attribute to reach the peer's gRPC API endpoint.
type PeerManager ¶
type PeerManager interface { // Start instructs the manager to start peer change notification handling // and connection management. Start() // Stop stops any peer manager activity. Stop() // List returns a list of peers with active connections. If a peer cannot // be connected to; its Conn attribute must be nil. List() []Peer // ReportOffline allows the caller to report a peer as being offline. The // peer is identified by its name. ReportOffline(name string) }
PeerManager defines the functions a peer manager must implement when handling peers and respective connections.