Documentation
¶
Overview ¶
Package server is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func Commands() cli.Commands
- func RegisterServerHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterServerHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ServerClient) error
- func RegisterServerHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterServerHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ServerServer) error
- func RegisterServerServer(s *grpc.Server, srv ServerServer)
- type ServerClient
- type ServerServer
- type UnimplementedServerServer
- func (*UnimplementedServerServer) Dump(ctx context.Context, req *Void) (*entity.Dump, error)
- func (*UnimplementedServerServer) GenerateFakeData(ctx context.Context, req *Void) (*Void, error)
- func (*UnimplementedServerServer) Info(ctx context.Context, req *Void) (*entity.Info, error)
- func (*UnimplementedServerServer) Levels(ctx context.Context, req *Void) (*entity.LevelList, error)
- func (*UnimplementedServerServer) Ping(ctx context.Context, req *Void) (*Void, error)
- func (*UnimplementedServerServer) Status(ctx context.Context, req *Void) (*entity.Status, error)
- func (*UnimplementedServerServer) Teams(ctx context.Context, req *Void) (*entity.TeamList, error)
- func (*UnimplementedServerServer) UserSession(ctx context.Context, req *Void) (*UserSessionOutput, error)
- func (*UnimplementedServerServer) Users(ctx context.Context, req *Void) (*entity.UserList, error)
- type UserSessionOutput
- func (*UserSessionOutput) Descriptor() ([]byte, []int)
- func (m *UserSessionOutput) GetClaims() *client.Claims
- func (m *UserSessionOutput) GetIsNewUser() bool
- func (m *UserSessionOutput) GetNotifications() int32
- func (m *UserSessionOutput) GetTournaments() []*UserSessionOutput_Tournament
- func (m *UserSessionOutput) GetUser() *entity.User
- func (m *UserSessionOutput) Marshal() (dAtA []byte, err error)
- func (m *UserSessionOutput) MarshalTo(dAtA []byte) (int, error)
- func (m *UserSessionOutput) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*UserSessionOutput) ProtoMessage()
- func (m *UserSessionOutput) Reset()
- func (m *UserSessionOutput) Size() (n int)
- func (m *UserSessionOutput) String() string
- func (m *UserSessionOutput) Unmarshal(dAtA []byte) error
- func (m *UserSessionOutput) XXX_DiscardUnknown()
- func (m *UserSessionOutput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *UserSessionOutput) XXX_Merge(src proto.Message)
- func (m *UserSessionOutput) XXX_Size() int
- func (m *UserSessionOutput) XXX_Unmarshal(b []byte) error
- type UserSessionOutput_Tournament
- func (*UserSessionOutput_Tournament) Descriptor() ([]byte, []int)
- func (m *UserSessionOutput_Tournament) GetTeam() *entity.TournamentTeam
- func (m *UserSessionOutput_Tournament) GetTournament() *entity.Tournament
- func (m *UserSessionOutput_Tournament) Marshal() (dAtA []byte, err error)
- func (m *UserSessionOutput_Tournament) MarshalTo(dAtA []byte) (int, error)
- func (m *UserSessionOutput_Tournament) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*UserSessionOutput_Tournament) ProtoMessage()
- func (m *UserSessionOutput_Tournament) Reset()
- func (m *UserSessionOutput_Tournament) Size() (n int)
- func (m *UserSessionOutput_Tournament) String() string
- func (m *UserSessionOutput_Tournament) Unmarshal(dAtA []byte) error
- func (m *UserSessionOutput_Tournament) XXX_DiscardUnknown()
- func (m *UserSessionOutput_Tournament) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *UserSessionOutput_Tournament) XXX_Merge(src proto.Message)
- func (m *UserSessionOutput_Tournament) XXX_Size() int
- func (m *UserSessionOutput_Tournament) XXX_Unmarshal(b []byte) error
- type Void
- func (*Void) Descriptor() ([]byte, []int)
- func (m *Void) Marshal() (dAtA []byte, err error)
- func (m *Void) MarshalTo(dAtA []byte) (int, error)
- func (m *Void) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Void) ProtoMessage()
- func (m *Void) Reset()
- func (m *Void) Size() (n int)
- func (m *Void) String() string
- func (m *Void) Unmarshal(dAtA []byte) error
- func (m *Void) XXX_DiscardUnknown()
- func (m *Void) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Void) XXX_Merge(src proto.Message)
- func (m *Void) XXX_Size() int
- func (m *Void) XXX_Unmarshal(b []byte) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidLengthServer = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowServer = fmt.Errorf("proto: integer overflow") )
Functions ¶
func RegisterServerHandler ¶
RegisterServerHandler registers the http handlers for service Server to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterServerHandlerClient ¶
func RegisterServerHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ServerClient) error
RegisterServerHandlerClient registers the http handlers for service Server to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ServerClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ServerClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ServerClient" to call the correct interceptors.
func RegisterServerHandlerFromEndpoint ¶
func RegisterServerHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterServerHandlerFromEndpoint is same as RegisterServerHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterServerHandlerServer ¶
func RegisterServerHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ServerServer) error
RegisterServerHandlerServer registers the http handlers for service Server to "mux". UnaryRPC :call ServerServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
func RegisterServerServer ¶
func RegisterServerServer(s *grpc.Server, srv ServerServer)
Types ¶
type ServerClient ¶
type ServerClient interface { // Verify the service is up and running Ping(ctx context.Context, in *Void, opts ...grpc.CallOption) (*Void, error) // Get current user session, based on JWT token UserSession(ctx context.Context, in *Void, opts ...grpc.CallOption) (*UserSessionOutput, error) // List users Users(ctx context.Context, in *Void, opts ...grpc.CallOption) (*entity.UserList, error) // List levels Levels(ctx context.Context, in *Void, opts ...grpc.CallOption) (*entity.LevelList, error) // List teams Teams(ctx context.Context, in *Void, opts ...grpc.CallOption) (*entity.TeamList, error) Status(ctx context.Context, in *Void, opts ...grpc.CallOption) (*entity.Status, error) Info(ctx context.Context, in *Void, opts ...grpc.CallOption) (*entity.Info, error) GenerateFakeData(ctx context.Context, in *Void, opts ...grpc.CallOption) (*Void, error) Dump(ctx context.Context, in *Void, opts ...grpc.CallOption) (*entity.Dump, error) }
ServerClient is the client API for Server service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewServerClient ¶
func NewServerClient(cc *grpc.ClientConn) ServerClient
type ServerServer ¶
type ServerServer interface { // Verify the service is up and running Ping(context.Context, *Void) (*Void, error) // Get current user session, based on JWT token UserSession(context.Context, *Void) (*UserSessionOutput, error) // List users Users(context.Context, *Void) (*entity.UserList, error) // List levels Levels(context.Context, *Void) (*entity.LevelList, error) // List teams Teams(context.Context, *Void) (*entity.TeamList, error) Status(context.Context, *Void) (*entity.Status, error) Info(context.Context, *Void) (*entity.Info, error) GenerateFakeData(context.Context, *Void) (*Void, error) Dump(context.Context, *Void) (*entity.Dump, error) }
ServerServer is the server API for Server service.
type UnimplementedServerServer ¶
type UnimplementedServerServer struct { }
UnimplementedServerServer can be embedded to have forward compatible implementations.
func (*UnimplementedServerServer) GenerateFakeData ¶
func (*UnimplementedServerServer) UserSession ¶
func (*UnimplementedServerServer) UserSession(ctx context.Context, req *Void) (*UserSessionOutput, error)
type UserSessionOutput ¶
type UserSessionOutput struct { User *entity.User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` IsNewUser bool `protobuf:"varint,2,opt,name=is_new_user,json=isNewUser,proto3" json:"is_new_user,omitempty"` Claims *client.Claims `protobuf:"bytes,3,opt,name=claims,proto3" json:"claims,omitempty"` Notifications int32 `protobuf:"varint,4,opt,name=notifications,proto3" json:"notifications,omitempty"` Tournaments []*UserSessionOutput_Tournament `protobuf:"bytes,5,rep,name=tournaments,proto3" json:"tournaments,omitempty"` }
func (*UserSessionOutput) Descriptor ¶
func (*UserSessionOutput) Descriptor() ([]byte, []int)
func (*UserSessionOutput) GetClaims ¶
func (m *UserSessionOutput) GetClaims() *client.Claims
func (*UserSessionOutput) GetIsNewUser ¶
func (m *UserSessionOutput) GetIsNewUser() bool
func (*UserSessionOutput) GetNotifications ¶
func (m *UserSessionOutput) GetNotifications() int32
func (*UserSessionOutput) GetTournaments ¶
func (m *UserSessionOutput) GetTournaments() []*UserSessionOutput_Tournament
func (*UserSessionOutput) GetUser ¶
func (m *UserSessionOutput) GetUser() *entity.User
func (*UserSessionOutput) Marshal ¶
func (m *UserSessionOutput) Marshal() (dAtA []byte, err error)
func (*UserSessionOutput) MarshalTo ¶
func (m *UserSessionOutput) MarshalTo(dAtA []byte) (int, error)
func (*UserSessionOutput) MarshalToSizedBuffer ¶
func (m *UserSessionOutput) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*UserSessionOutput) ProtoMessage ¶
func (*UserSessionOutput) ProtoMessage()
func (*UserSessionOutput) Reset ¶
func (m *UserSessionOutput) Reset()
func (*UserSessionOutput) Size ¶
func (m *UserSessionOutput) Size() (n int)
func (*UserSessionOutput) String ¶
func (m *UserSessionOutput) String() string
func (*UserSessionOutput) Unmarshal ¶
func (m *UserSessionOutput) Unmarshal(dAtA []byte) error
func (*UserSessionOutput) XXX_DiscardUnknown ¶
func (m *UserSessionOutput) XXX_DiscardUnknown()
func (*UserSessionOutput) XXX_Marshal ¶
func (m *UserSessionOutput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*UserSessionOutput) XXX_Merge ¶
func (m *UserSessionOutput) XXX_Merge(src proto.Message)
func (*UserSessionOutput) XXX_Size ¶
func (m *UserSessionOutput) XXX_Size() int
func (*UserSessionOutput) XXX_Unmarshal ¶
func (m *UserSessionOutput) XXX_Unmarshal(b []byte) error
type UserSessionOutput_Tournament ¶
type UserSessionOutput_Tournament struct { Tournament *entity.Tournament `protobuf:"bytes,1,opt,name=tournament,proto3" json:"tournament,omitempty"` Team *entity.TournamentTeam `protobuf:"bytes,2,opt,name=team,proto3" json:"team,omitempty"` }
func (*UserSessionOutput_Tournament) Descriptor ¶
func (*UserSessionOutput_Tournament) Descriptor() ([]byte, []int)
func (*UserSessionOutput_Tournament) GetTeam ¶
func (m *UserSessionOutput_Tournament) GetTeam() *entity.TournamentTeam
func (*UserSessionOutput_Tournament) GetTournament ¶
func (m *UserSessionOutput_Tournament) GetTournament() *entity.Tournament
func (*UserSessionOutput_Tournament) Marshal ¶
func (m *UserSessionOutput_Tournament) Marshal() (dAtA []byte, err error)
func (*UserSessionOutput_Tournament) MarshalTo ¶
func (m *UserSessionOutput_Tournament) MarshalTo(dAtA []byte) (int, error)
func (*UserSessionOutput_Tournament) MarshalToSizedBuffer ¶
func (m *UserSessionOutput_Tournament) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*UserSessionOutput_Tournament) ProtoMessage ¶
func (*UserSessionOutput_Tournament) ProtoMessage()
func (*UserSessionOutput_Tournament) Reset ¶
func (m *UserSessionOutput_Tournament) Reset()
func (*UserSessionOutput_Tournament) Size ¶
func (m *UserSessionOutput_Tournament) Size() (n int)
func (*UserSessionOutput_Tournament) String ¶
func (m *UserSessionOutput_Tournament) String() string
func (*UserSessionOutput_Tournament) Unmarshal ¶
func (m *UserSessionOutput_Tournament) Unmarshal(dAtA []byte) error
func (*UserSessionOutput_Tournament) XXX_DiscardUnknown ¶
func (m *UserSessionOutput_Tournament) XXX_DiscardUnknown()
func (*UserSessionOutput_Tournament) XXX_Marshal ¶
func (m *UserSessionOutput_Tournament) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*UserSessionOutput_Tournament) XXX_Merge ¶
func (m *UserSessionOutput_Tournament) XXX_Merge(src proto.Message)
func (*UserSessionOutput_Tournament) XXX_Size ¶
func (m *UserSessionOutput_Tournament) XXX_Size() int
func (*UserSessionOutput_Tournament) XXX_Unmarshal ¶
func (m *UserSessionOutput_Tournament) XXX_Unmarshal(b []byte) error
type Void ¶
type Void struct { }
Void is an empty message
func (*Void) Descriptor ¶
func (*Void) ProtoMessage ¶
func (*Void) ProtoMessage()
func (*Void) XXX_DiscardUnknown ¶
func (m *Void) XXX_DiscardUnknown()