Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ClientKeepalive = keepalive.ClientParameters{ Time: helper.NetworkTimeout, Timeout: helper.NetworkTimeout, PermitWithoutStream: true, }
To prevent unidirectional network partitions from keeping an unhealthy connection alive, we use both client-side and server-side keepalive pings.
var ClientTestingKeepalive = keepalive.ClientParameters{ Time: 200 * time.Millisecond, Timeout: 300 * time.Millisecond, PermitWithoutStream: true, }
These aggressively low keepalive timeouts ensure that tests which use them don't take too long.
var ServerEnforcement = keepalive.EnforcementPolicy{ MinTime: time.Nanosecond, PermitWithoutStream: true, }
By default, gRPC disconnects clients that send "too many" pings, but we don't really care about that, so configure the server to be as permissive as possible.
var ServerKeepalive = keepalive.ServerParameters{ Time: helper.NetworkTimeout, Timeout: helper.NetworkTimeout, }
var ServerTestingKeepalive = keepalive.ServerParameters{ Time: 200 * time.Millisecond, Timeout: 300 * time.Millisecond, }
var SourceAddr = func() net.Addr { const envKey = "NENTROPY_SOURCE_IP_ADDRESS" if sourceAddr, ok := envutil.EnvString(envKey, 0); ok { sourceIP := net.ParseIP(sourceAddr) if sourceIP == nil { panic(fmt.Sprintf("unable to parse %s '%s' as IP address", envKey, sourceAddr)) } return &net.TCPAddr{ IP: sourceIP, } } return nil }()
SourceAddr provides a way to specify a source/local address for outgoing connections. It should only ever be set by testing code, and is not thread safe (so it must be initialized before the server starts).
Functions ¶
Types ¶
type Context ¶
type Context struct { *helper.Config AmbientCtx log.AmbientContext Stopper *stop.Stopper // contains filtered or unexported fields }
Context contains the fields required by the rpc framework.
func NewContext ¶
func NewContext( ambient log.AmbientContext, baseCtx *helper.Config, stopper *stop.Stopper) *Context
NewContext creates an rpc Context with the supplied values.
func (*Context) GRPCDial ¶
func (ctx *Context) GRPCDial(target string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
GRPCDial calls grpc.Dial with the options appropriate for the context.