grpc

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RetryProfile = []grpc.CallOption{
	RetryOption,
}

RetryProfile is the common retry profile for RPCs.

Functions

func DefaultMaxConcurrentStreams added in v0.9.1

func DefaultMaxConcurrentStreams() grpc.ServerOption

DefaultMaxConcurrentStreams constructs the default grpc.MaxConcurrentStreams Server Option. grpc-go prohibits more than MaxConcurrentStreams handlers from running at once, and setting this option so prevents easy resource exhaustion attacks from malicious clients.

func LogIDClientInterceptor

func LogIDClientInterceptor() grpc.UnaryClientInterceptor

func LogIDClientStreamInterceptor

func LogIDClientStreamInterceptor() grpc.StreamClientInterceptor

func LogIDServerInterceptor

func LogIDServerInterceptor() grpc.UnaryServerInterceptor

func LogIDServerStreamInterceptor

func LogIDServerStreamInterceptor() grpc.StreamServerInterceptor

func StreamClientInterceptor

func StreamClientInterceptor() grpc.DialOption

StreamClientInterceptor constructs the default stream RPC client-side interceptor for SCION control-plane applications.

func StreamServerInterceptor

func StreamServerInterceptor() grpc.ServerOption

StreamServerInterceptor constructs the default stream RPC server-side interceptor for SCION control-plane applications.

func UnaryClientInterceptor

func UnaryClientInterceptor() grpc.DialOption

UnaryClientInterceptor constructs the default unary RPC client-side interceptor for SCION control-plane applications.

func UnaryServerInterceptor

func UnaryServerInterceptor() grpc.ServerOption

UnaryServerInterceptor constructs the default unary RPC server-side interceptor for SCION control-plane applications.

Types

type AddressRewriter

type AddressRewriter interface {
	RedirectToQUIC(ctx context.Context, address net.Addr) (net.Addr, bool, error)
}

AddressRewriter redirects to QUIC endpoints.

type ConnDialer

type ConnDialer interface {
	Dial(context.Context, net.Addr) (net.Conn, error)
}

ConnDialer dials a net.Conn.

type ConnectionStater added in v0.9.0

type ConnectionStater interface {
	ConnectionState() tls.ConnectionState
}

type Dialer

type Dialer interface {
	// DialContext creates a client connection to the given target.
	Dial(context.Context, net.Addr) (*grpc.ClientConn, error)
}

Dialer creates a gRPC client connection to the given target.

type PassThroughCredentials added in v0.9.0

type PassThroughCredentials struct{}

PassThroughCredentials implements the grpc/credentials.TransportCredentials interface. It allows to pass the TLS connection state of an underlying TLS connection, e.g. from an underlying QUIC session, into the grpc stack. This allows accessing this information in the context of grpc/peer.Peer.AuthInfo. The handshake methods only extract the TLS state and otherwise simply pass-through the underlying connection object. The underlying connection must implement the ConnectionStater interface.

func (PassThroughCredentials) ClientHandshake added in v0.9.0

func (c PassThroughCredentials) ClientHandshake(
	ctx context.Context,
	authority string,
	conn net.Conn,
) (net.Conn, credentials.AuthInfo, error)

func (PassThroughCredentials) Clone added in v0.9.0

func (PassThroughCredentials) Info added in v0.9.0

func (PassThroughCredentials) OverrideServerName added in v0.9.0

func (c PassThroughCredentials) OverrideServerName(string) error

func (PassThroughCredentials) ServerHandshake added in v0.9.0

func (c PassThroughCredentials) ServerHandshake(
	conn net.Conn,
) (net.Conn, credentials.AuthInfo, error)

type QUICDialer

type QUICDialer struct {
	Rewriter AddressRewriter
	Dialer   ConnDialer
}

QUICDialer dials a gRPC connection over QUIC/SCION. This dialer is meant to be used for inter AS communication, and is capable of resolving svc addresses.

func (*QUICDialer) Dial

func (d *QUICDialer) Dial(ctx context.Context, addr net.Addr) (*grpc.ClientConn, error)

Dial dials a gRPC connection over QUIC/SCION.

type SimpleDialer

type SimpleDialer struct{}

SimpleDialer implements a wrapper around grpc.DialContext that implements the dialer interface. It simply uses the string of the address to dial.

func (SimpleDialer) Dial

func (SimpleDialer) Dial(ctx context.Context, address net.Addr) (*grpc.ClientConn, error)

Dial dials the address by converting it to a string.

type TCPDialer

type TCPDialer struct {
	SvcResolver func(addr.SVC) []resolver.Address
}

TCPDialer dials a gRPC connection over TCP. This dialer is meant to be used for AS internal communication, and is capable of resolving svc addresses.

func (*TCPDialer) Dial

func (t *TCPDialer) Dial(ctx context.Context, dst net.Addr) (*grpc.ClientConn, error)

Dial dials a gRPC connection over TCP. It resolves svc addresses.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL