server

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2019 License: Apache-2.0 Imports: 48 Imported by: 0

Documentation

Overview

Package server is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthServer = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowServer   = fmt.Errorf("proto: integer overflow")
)

Functions

func Commands

func Commands() cli.Commands

func RegisterServerHandler

func RegisterServerHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

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) Dump

func (*UnimplementedServerServer) GenerateFakeData

func (*UnimplementedServerServer) GenerateFakeData(ctx context.Context, req *Void) (*Void, error)

func (*UnimplementedServerServer) Info

func (*UnimplementedServerServer) Levels

func (*UnimplementedServerServer) Ping

func (*UnimplementedServerServer) Ping(ctx context.Context, req *Void) (*Void, error)

func (*UnimplementedServerServer) Status

func (*UnimplementedServerServer) Teams

func (*UnimplementedServerServer) UserSession

func (*UnimplementedServerServer) Users

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 (*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 (*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) Descriptor() ([]byte, []int)

func (*Void) Marshal

func (m *Void) Marshal() (dAtA []byte, err error)

func (*Void) MarshalTo

func (m *Void) MarshalTo(dAtA []byte) (int, error)

func (*Void) MarshalToSizedBuffer

func (m *Void) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Void) ProtoMessage

func (*Void) ProtoMessage()

func (*Void) Reset

func (m *Void) Reset()

func (*Void) Size

func (m *Void) Size() (n int)

func (*Void) String

func (m *Void) String() string

func (*Void) Unmarshal

func (m *Void) Unmarshal(dAtA []byte) error

func (*Void) XXX_DiscardUnknown

func (m *Void) XXX_DiscardUnknown()

func (*Void) XXX_Marshal

func (m *Void) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Void) XXX_Merge

func (m *Void) XXX_Merge(src proto.Message)

func (*Void) XXX_Size

func (m *Void) XXX_Size() int

func (*Void) XXX_Unmarshal

func (m *Void) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL