Documentation ¶
Index ¶
- Variables
- func CtxWithIncomingToken(ctx context.Context, token string) context.Context
- func CtxWithIncomingUserID(ctx context.Context, userID string) context.Context
- func CtxWithToken(ctx context.Context, token string) context.Context
- func CtxWithUserID(ctx context.Context, userID string) context.Context
- func ForwardErrorf(code codes.Code, formatter string, args ...interface{}) error
- func ForwardFromError(code codes.Code, err error) error
- func NewClientConn(host string, tls security.TLSConfig, opt ...grpc.DialOption) (*grpc.ClientConn, error)
- func NewOAuthAccess(getTokenFunc OAuthGetTokenFunc) credentials.PerRPCCredentials
- func RegisterStubServiceServer(s *grpc.Server, srv StubServiceServer)
- func StreamServerInterceptor(intercept Interceptor) grpc.ServerOption
- func TokenFromMD(ctx context.Context) (string, error)
- func TokenFromOutgoingMD(ctx context.Context) (string, error)
- func UnaryServerInterceptor(intercept Interceptor) grpc.ServerOption
- func UserIDFromMD(ctx context.Context) (string, error)
- func UserIDFromOutgoingMD(ctx context.Context) (string, error)
- func UserIDFromTokenMD(ctx context.Context) (string, error)
- type AuthInterceptors
- type Claims
- type ClaimsFunc
- type Config
- type Interceptor
- type Iterator
- type OAuthGetTokenFunc
- type Server
- type StubServiceClient
- type StubServiceServer
- type StubService_TestStreamClient
- type StubService_TestStreamServer
- type TestRequest
- func (*TestRequest) Descriptor() ([]byte, []int)
- func (m *TestRequest) GetTest() string
- func (m *TestRequest) Marshal() (dAtA []byte, err error)
- func (m *TestRequest) MarshalTo(dAtA []byte) (int, error)
- func (*TestRequest) ProtoMessage()
- func (m *TestRequest) Reset()
- func (m *TestRequest) Size() (n int)
- func (m *TestRequest) String() string
- func (m *TestRequest) Unmarshal(dAtA []byte) error
- func (m *TestRequest) XXX_DiscardUnknown()
- func (m *TestRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *TestRequest) XXX_Merge(src proto.Message)
- func (m *TestRequest) XXX_Size() int
- func (m *TestRequest) XXX_Unmarshal(b []byte) error
- type TestResponse
- func (*TestResponse) Descriptor() ([]byte, []int)
- func (m *TestResponse) GetTest() string
- func (m *TestResponse) Marshal() (dAtA []byte, err error)
- func (m *TestResponse) MarshalTo(dAtA []byte) (int, error)
- func (*TestResponse) ProtoMessage()
- func (m *TestResponse) Reset()
- func (m *TestResponse) Size() (n int)
- func (m *TestResponse) String() string
- func (m *TestResponse) Unmarshal(dAtA []byte) error
- func (m *TestResponse) XXX_DiscardUnknown()
- func (m *TestResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *TestResponse) XXX_Merge(src proto.Message)
- func (m *TestResponse) XXX_Size() int
- func (m *TestResponse) XXX_Unmarshal(b []byte) error
- type UnimplementedStubServiceServer
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidLengthStub = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowStub = fmt.Errorf("proto: integer overflow") )
Functions ¶
func CtxWithIncomingToken ¶
CtxWithIncomingToken stores token to ctx of reponse.
func CtxWithIncomingUserID ¶
CtxWithIncomingUserID stores userID to ctx of reponse.
func CtxWithToken ¶
CtxWithToken stores token to ctx of request.
func CtxWithUserID ¶
CtxWithUserID stores userID to ctx of request.
func ForwardErrorf ¶
ForwardErrorf tries to unwrap args as error with GRPCStatus() and forward original code and details.
func ForwardFromError ¶
ForwardFromError tries to unwrap err as GRPCStatus() and forward original code and details.
func NewClientConn ¶
func NewClientConn(host string, tls security.TLSConfig, opt ...grpc.DialOption) (*grpc.ClientConn, error)
NewClientConn creates gRPC client connection
func NewOAuthAccess ¶
func NewOAuthAccess(getTokenFunc OAuthGetTokenFunc) credentials.PerRPCCredentials
NewOAuthAccess constructs the PerRPCCredentials using a given token.
func RegisterStubServiceServer ¶
func RegisterStubServiceServer(s *grpc.Server, srv StubServiceServer)
func StreamServerInterceptor ¶
func StreamServerInterceptor(intercept Interceptor) grpc.ServerOption
func TokenFromMD ¶
TokenFromMD is a helper function for extracting the :authorization header from the gRPC metadata of the request.
func TokenFromOutgoingMD ¶
TokenFromOutgoingMD extracts token stored by CtxWithToken.
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(intercept Interceptor) grpc.ServerOption
func UserIDFromMD ¶
UserIDFromMD is a helper function for extracting the :userid header from the gRPC metadata of the request.
func UserIDFromOutgoingMD ¶
UserIDFromOutgoingMD extracts userID stored by CtxWithUserID.
Types ¶
type AuthInterceptors ¶
type AuthInterceptors struct {
// contains filtered or unexported fields
}
func MakeAuthInterceptors ¶
func MakeAuthInterceptors(authFunc Interceptor, whiteListedMethods ...string) AuthInterceptors
func MakeJWTInterceptors ¶
func MakeJWTInterceptors(jwksURL string, tls *tls.Config, claims ClaimsFunc, whiteListedMethods ...string) AuthInterceptors
func (AuthInterceptors) Stream ¶
func (f AuthInterceptors) Stream() grpc.ServerOption
func (AuthInterceptors) Unary ¶
func (f AuthInterceptors) Unary() grpc.ServerOption
type Config ¶
type Config struct {
Addr string `envconfig:"ADDRESS" env:"ADDRESS" long:"address" default:"0.0.0.0:9100"`
}
Config holds service's settings.
type Interceptor ¶
func ValidateJWT ¶
func ValidateJWT(jwksURL string, tls *tls.Config, claims ClaimsFunc) Interceptor
type Iterator ¶
type Iterator struct { Err error // contains filtered or unexported fields }
func NewIterator ¶
func NewIterator(stream grpc.ClientStream, err error) *Iterator
type Server ¶
Server handles gRPC requests to the service.
func NewServer ¶
func NewServer(addr string, opts ...grpc.ServerOption) (*Server, error)
NewServer instantiates a gRPC server. When passing addr with an unspecified port or ":", use Addr().
func StubGrpcServer ¶
func StubGrpcServer(opts ...grpc.ServerOption) *Server
func (*Server) AddCloseFunc ¶
func (s *Server) AddCloseFunc(f func())
AddCloseFunc adds a function to be called by the Close method. This eliminates the need for wrapping the Server.
type StubServiceClient ¶
type StubServiceClient interface { TestCall(ctx context.Context, in *TestRequest, opts ...grpc.CallOption) (*TestResponse, error) TestStream(ctx context.Context, opts ...grpc.CallOption) (StubService_TestStreamClient, error) }
StubServiceClient is the client API for StubService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewStubServiceClient ¶
func NewStubServiceClient(cc *grpc.ClientConn) StubServiceClient
func StubGrpcClient ¶
func StubGrpcClient(addr string) StubServiceClient
type StubServiceServer ¶
type StubServiceServer interface { TestCall(context.Context, *TestRequest) (*TestResponse, error) TestStream(StubService_TestStreamServer) error }
StubServiceServer is the server API for StubService service.
type StubService_TestStreamClient ¶
type StubService_TestStreamClient interface { Send(*TestRequest) error Recv() (*TestResponse, error) grpc.ClientStream }
type StubService_TestStreamServer ¶
type StubService_TestStreamServer interface { Send(*TestResponse) error Recv() (*TestRequest, error) grpc.ServerStream }
type TestRequest ¶
type TestRequest struct {
Test string `protobuf:"bytes,1,opt,name=test,proto3" json:"test,omitempty"`
}
func (*TestRequest) Descriptor ¶
func (*TestRequest) Descriptor() ([]byte, []int)
func (*TestRequest) GetTest ¶
func (m *TestRequest) GetTest() string
func (*TestRequest) Marshal ¶
func (m *TestRequest) Marshal() (dAtA []byte, err error)
func (*TestRequest) ProtoMessage ¶
func (*TestRequest) ProtoMessage()
func (*TestRequest) Reset ¶
func (m *TestRequest) Reset()
func (*TestRequest) Size ¶
func (m *TestRequest) Size() (n int)
func (*TestRequest) String ¶
func (m *TestRequest) String() string
func (*TestRequest) Unmarshal ¶
func (m *TestRequest) Unmarshal(dAtA []byte) error
func (*TestRequest) XXX_DiscardUnknown ¶
func (m *TestRequest) XXX_DiscardUnknown()
func (*TestRequest) XXX_Marshal ¶
func (m *TestRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*TestRequest) XXX_Merge ¶
func (m *TestRequest) XXX_Merge(src proto.Message)
func (*TestRequest) XXX_Size ¶
func (m *TestRequest) XXX_Size() int
func (*TestRequest) XXX_Unmarshal ¶
func (m *TestRequest) XXX_Unmarshal(b []byte) error
type TestResponse ¶
type TestResponse struct {
Test string `protobuf:"bytes,1,opt,name=test,proto3" json:"test,omitempty"`
}
func (*TestResponse) Descriptor ¶
func (*TestResponse) Descriptor() ([]byte, []int)
func (*TestResponse) GetTest ¶
func (m *TestResponse) GetTest() string
func (*TestResponse) Marshal ¶
func (m *TestResponse) Marshal() (dAtA []byte, err error)
func (*TestResponse) ProtoMessage ¶
func (*TestResponse) ProtoMessage()
func (*TestResponse) Reset ¶
func (m *TestResponse) Reset()
func (*TestResponse) Size ¶
func (m *TestResponse) Size() (n int)
func (*TestResponse) String ¶
func (m *TestResponse) String() string
func (*TestResponse) Unmarshal ¶
func (m *TestResponse) Unmarshal(dAtA []byte) error
func (*TestResponse) XXX_DiscardUnknown ¶
func (m *TestResponse) XXX_DiscardUnknown()
func (*TestResponse) XXX_Marshal ¶
func (m *TestResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*TestResponse) XXX_Merge ¶
func (m *TestResponse) XXX_Merge(src proto.Message)
func (*TestResponse) XXX_Size ¶
func (m *TestResponse) XXX_Size() int
func (*TestResponse) XXX_Unmarshal ¶
func (m *TestResponse) XXX_Unmarshal(b []byte) error
type UnimplementedStubServiceServer ¶
type UnimplementedStubServiceServer struct { }
UnimplementedStubServiceServer can be embedded to have forward compatible implementations.
func (*UnimplementedStubServiceServer) TestCall ¶
func (*UnimplementedStubServiceServer) TestCall(ctx context.Context, req *TestRequest) (*TestResponse, error)
func (*UnimplementedStubServiceServer) TestStream ¶
func (*UnimplementedStubServiceServer) TestStream(srv StubService_TestStreamServer) error