Documentation
¶
Index ¶
- Constants
- func BuildEnvoyGRPCHeaders(header http.Header, rawValue bool, endofstream bool) *pb.HttpHeaders
- func BuildTLSConfig(insecureSkip bool, caFile string) (*tls.Config, error)
- func NewGrpcConn(addr string, connectTimeout time.Duration, insecureSkip bool, caFile string, ...) (*grpc.ClientConn, error)
- type EppClient
- func (c *EppClient) Close()
- func (c *EppClient) CloseRespBody()
- func (c *EppClient) ProcRespBody(d []byte)
- func (c *EppClient) ProcRespHeader(header http.Header, endofstream bool)
- func (c *EppClient) Recv() (*extprocv3.ProcessingResponse, error)
- func (c *EppClient) RecvTimeout(timeout time.Duration) (*extprocv3.ProcessingResponse, error)
- func (c *EppClient) RespBodyAborted() bool
- func (c *EppClient) Send(req *extprocv3.ProcessingRequest) error
- type EppClientOption
- type EppResponseBodyFilter
- type EppState
Constants ¶
const DefaultRespBodyBufBudget = 1 << 20 // 1MB
DefaultRespBodyBufBudget is default byte budget for buffering response body chunks not yet consumed by EPP.
Variables ¶
This section is empty.
Functions ¶
func BuildEnvoyGRPCHeaders ¶
func BuildTLSConfig ¶ added in v1.8.7
BuildTLSConfig builds client TLS config for EPP connections.
func NewGrpcConn ¶ added in v1.8.7
func NewGrpcConn(addr string, connectTimeout time.Duration, insecureSkip bool, caFile string, plaintext bool) (*grpc.ClientConn, error)
NewGrpcConn dials a long-lived EPP data connection. The connection is lazy: it is established on first use and multiplexes all streams of this address. connectTimeout bounds the connect handshake (grpc.WithConnectParams). plaintext=true dials without TLS (EPP serves plaintext gRPC), in which case insecureSkip/caFile are ignored. Caller owns the returned conn and must Close it when done.
Types ¶
type EppClient ¶
type EppClient struct {
// contains filtered or unexported fields
}
func NewEppClient ¶
func NewEppClient(conn *grpc.ClientConn, callTimeout time.Duration, opts ...EppClientOption) (*EppClient, error)
NewEppClient creates an EPP stream client on given connection. callTimeout limits the first message (RequestHeaders Send+Recv) round trip. The conn is NOT owned by EppClient: Close only tears down this stream and its goroutines, so a conn shared by many streams (one per request) is never closed by an individual stream teardown.
func (*EppClient) Close ¶
func (c *EppClient) Close()
Close tears down this stream (response forwarding goroutines included) and releases stream resources. It never closes the shared *grpc.ClientConn.
func (*EppClient) CloseRespBody ¶
func (c *EppClient) CloseRespBody()
func (*EppClient) ProcRespBody ¶
ProcRespBody buffers a response body chunk for EPP. Buffering is bounded by a byte budget: on overflow the whole remaining body of this stream is skipped (with counter and one log line), instead of silently dropping individual chunks. Never blocks the response forwarding path.
func (*EppClient) ProcRespHeader ¶
func (*EppClient) RecvTimeout ¶ added in v1.8.7
RecvTimeout receives next message with timeout. On timeout the stream is left in unknown state; caller must Close the client.
func (*EppClient) RespBodyAborted ¶ added in v1.8.7
RespBodyAborted reports whether response body was skipped due to overflow.
type EppClientOption ¶ added in v1.8.7
type EppClientOption func(*EppClient)
EppClientOption customizes EppClient.
func WithRespBodyBufBudget ¶ added in v1.8.7
func WithRespBodyBufBudget(budget int) EppClientOption
WithRespBodyBufBudget sets byte budget of response body buffer.
type EppResponseBodyFilter ¶
type EppResponseBodyFilter struct {
// contains filtered or unexported fields
}
func NewEppResponseBodyFilter ¶
func NewEppResponseBodyFilter(source io.ReadCloser, c *EppClient) *EppResponseBodyFilter
func (*EppResponseBodyFilter) Close ¶
func (f *EppResponseBodyFilter) Close() error
type EppState ¶ added in v1.8.7
type EppState struct {
// RespBodyOverflow counts streams whose response body overflowed the
// bounded buffer and was skipped (see ProcRespBody).
RespBodyOverflow *metrics.Counter
}
EppState is monitor state of EPP client.
func GetEppState ¶ added in v1.8.7
func GetEppState() *EppState