Documentation ¶
Index ¶
- Constants
- func ConvertErrorStreamClientInterceptor(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, ...) (grpc.ClientStream, error)
- func ConvertErrorStreamServerInterceptor(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, ...) error
- func ConvertErrorUnaryClientInterceptor(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, ...) error
- func ConvertErrorUnaryServerInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, ...) (any, error)
- func IsVsock(target string) bool
- func Listen(netAddr dfnet.NetAddr) (net.Listener, error)
- func ListenWithPortRange(listen string, startPort, endPort int) (net.Listener, int, error)
- func NewClientCredentials(tlsPolicy string, certs []tls.Certificate, pemRootCAs []byte) (credentials.TransportCredentials, error)
- func NewClientCredentialsByCertify(tlsPolicy string, pemRootCAs []byte, certifyClient *certify.Certify) (credentials.TransportCredentials, error)
- func NewMuxTransportCredentials(c *tls.Config, opts ...func(m *muxTransportCredentials)) credentials.TransportCredentials
- func NewServerCredentialsByCertify(tlsPolicy string, tlsVerify bool, pemClientCAs []byte, ...) (credentials.TransportCredentials, error)
- func RefresherStreamClientInterceptor(r Refresher) grpc.StreamClientInterceptor
- func RefresherUnaryClientInterceptor(r Refresher) grpc.UnaryClientInterceptor
- func VsockDialer(ctx context.Context, address string) (net.Conn, error)
- func WithTLSPreferClientHandshake(prefer bool) func(m *muxTransportCredentials)
- type RateLimiterInterceptor
- type Refresher
Constants ¶
const ( // ForceTLSPolicy is both ClientHandshake and // ServerHandshake are only support tls. ForceTLSPolicy = "force" // PreferTLSPolicy is ServerHandshake supports tls and // insecure (non-tls), ClientHandshake will only support tls. PreferTLSPolicy = "prefer" // DefaultTLSPolicy is ServerHandshake supports tls // and insecure (non-tls), ClientHandshake will only support tls. DefaultTLSPolicy = "default" )
Variables ¶
This section is empty.
Functions ¶
func ConvertErrorStreamClientInterceptor ¶ added in v2.0.6
func ConvertErrorStreamClientInterceptor(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error)
ConvertErrorStreamClientInterceptor returns a new stream client interceptor that convert error when trigger custom error.
func ConvertErrorStreamServerInterceptor ¶ added in v2.0.6
func ConvertErrorStreamServerInterceptor(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error
ConvertErrorStreamServerInterceptor returns a new stream server interceptor that convert error when trigger custom error.
func ConvertErrorUnaryClientInterceptor ¶ added in v2.0.6
func ConvertErrorUnaryClientInterceptor(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error
ConvertErrorUnaryClientInterceptor returns a new unary client interceptor that convert error when trigger custom error.
func ConvertErrorUnaryServerInterceptor ¶ added in v2.0.6
func ConvertErrorUnaryServerInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error)
ConvertErrorUnaryServerInterceptor returns a new unary server interceptor that convert error when trigger custom error.
func Listen ¶
Listen wraps net.Listen with dfnet.NetAddr Example: Listen(dfnet.NetAddr{Type: dfnet.UNIX, Addr: "/var/run/df.sock"}) Listen(dfnet.NetAddr{Type: dfnet.TCP, Addr: ":12345"})
func ListenWithPortRange ¶
ListenWithPortRange tries to listen a port between startPort and endPort, return net.Listener and listen port Example: ListenWithPortRange("0.0.0.0", 12345, 23456) ListenWithPortRange("192.168.0.1", 12345, 23456) ListenWithPortRange("192.168.0.1", 0, 0) // random port
func NewClientCredentials ¶ added in v2.0.6
func NewClientCredentials(tlsPolicy string, certs []tls.Certificate, pemRootCAs []byte) (credentials.TransportCredentials, error)
NewClientCredentials returns client transport credentials.
func NewClientCredentialsByCertify ¶ added in v2.0.6
func NewClientCredentialsByCertify(tlsPolicy string, pemRootCAs []byte, certifyClient *certify.Certify) (credentials.TransportCredentials, error)
NewClientCredentialsByCertify returns client transport credentials by certify.
func NewMuxTransportCredentials ¶ added in v2.0.6
func NewMuxTransportCredentials(c *tls.Config, opts ...func(m *muxTransportCredentials)) credentials.TransportCredentials
func NewServerCredentialsByCertify ¶ added in v2.0.6
func NewServerCredentialsByCertify(tlsPolicy string, tlsVerify bool, pemClientCAs []byte, certifyClient *certify.Certify) (credentials.TransportCredentials, error)
NewServerCredentialsByCertify returns server transport credentials by certify.
func RefresherStreamClientInterceptor ¶ added in v2.0.6
func RefresherStreamClientInterceptor(r Refresher) grpc.StreamClientInterceptor
RefresherStreamClientInterceptor returns a new stream client interceptor that refresh dynconfig addresses when calling error.
func RefresherUnaryClientInterceptor ¶ added in v2.0.6
func RefresherUnaryClientInterceptor(r Refresher) grpc.UnaryClientInterceptor
RefresherUnaryClientInterceptor returns a new unary client interceptor that refresh dynconfig addresses when calling error.
func VsockDialer ¶ added in v2.0.3
VsockDialer is the dialer for vsock.
func WithTLSPreferClientHandshake ¶ added in v2.0.6
func WithTLSPreferClientHandshake(prefer bool) func(m *muxTransportCredentials)
Types ¶
type RateLimiterInterceptor ¶ added in v2.0.6
type RateLimiterInterceptor struct {
// contains filtered or unexported fields
}
RateLimiterInterceptor is the interface for ratelimit interceptor.
func NewRateLimiterInterceptor ¶ added in v2.0.6
func NewRateLimiterInterceptor(qps float64, burst int64) *RateLimiterInterceptor
NewRateLimiterInterceptor returns a RateLimiterInterceptor instance.
func (*RateLimiterInterceptor) Limit ¶ added in v2.0.6
func (r *RateLimiterInterceptor) Limit() bool
Limit is the predicate which limits the requests.
Directories ¶
Path | Synopsis |
---|---|
cdnsystem
|
|
client/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
dfdaemon
|
|
client/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
health
|
|
client/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
inference
|
|
client/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
manager
|
|
client/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
scheduler
|
|
client/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
security
|
|
client/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
trainer
|
|
client/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |