challenge

package
v0.0.0-...-15f6f3f Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2020 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package challenge is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterChallengeHandler

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

RegisterChallengeHandler registers the http handlers for service Challenge to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterChallengeHandlerClient

func RegisterChallengeHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ChallengeClient) error

RegisterChallengeHandlerClient registers the http handlers for service Challenge to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ChallengeClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ChallengeClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ChallengeClient" to call the correct interceptors.

func RegisterChallengeHandlerFromEndpoint

func RegisterChallengeHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterChallengeHandlerFromEndpoint is same as RegisterChallengeHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterChallengeHandlerServer

func RegisterChallengeHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ChallengeServer) error

RegisterChallengeHandlerServer registers the http handlers for service Challenge to "mux". UnaryRPC :call ChallengeServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.

func RegisterChallengeServer

func RegisterChallengeServer(s *grpc.Server, srv ChallengeServer)

Types

type ChallengeClient

type ChallengeClient interface {
	// Get an image challenge
	//
	// Returns a list of images and a prompt that lets the client know which images we are asking for.
	GetImagesChallenge(ctx context.Context, in *GetImagesRequest, opts ...grpc.CallOption) (*GetImagesResponse, error)
	// Get an alphanumeric challenge
	//
	// Returns an image with alphanumeric characters to be found, and a prompt if applicable
	GetAlphanumericChallenge(ctx context.Context, in *GetAlphanumericRequest, opts ...grpc.CallOption) (*GetAlphanumericResponse, error)
	// Get a questions list challenge
	//
	// Returns a list of questions that are to be answered by the client.
	GetQuestionsChallenge(ctx context.Context, in *GetQuestionsRequest, opts ...grpc.CallOption) (*GetQuestionsResponse, error)
	// Solve the session
	//
	// Returns an error on failure.
	SolveSession(ctx context.Context, in *SessionSolution, opts ...grpc.CallOption) (*SolutionResponse, error)
}

ChallengeClient is the client API for Challenge service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewChallengeClient

func NewChallengeClient(cc grpc.ClientConnInterface) ChallengeClient

type ChallengeServer

type ChallengeServer interface {
	// Get an image challenge
	//
	// Returns a list of images and a prompt that lets the client know which images we are asking for.
	GetImagesChallenge(context.Context, *GetImagesRequest) (*GetImagesResponse, error)
	// Get an alphanumeric challenge
	//
	// Returns an image with alphanumeric characters to be found, and a prompt if applicable
	GetAlphanumericChallenge(context.Context, *GetAlphanumericRequest) (*GetAlphanumericResponse, error)
	// Get a questions list challenge
	//
	// Returns a list of questions that are to be answered by the client.
	GetQuestionsChallenge(context.Context, *GetQuestionsRequest) (*GetQuestionsResponse, error)
	// Solve the session
	//
	// Returns an error on failure.
	SolveSession(context.Context, *SessionSolution) (*SolutionResponse, error)
}

ChallengeServer is the server API for Challenge service.

type GetAlphanumericRequest

type GetAlphanumericRequest struct {
	Length               uint32   `protobuf:"varint,1,opt,name=length,proto3" json:"length,omitempty"`
	Size                 uint32   `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GetAlphanumericRequest) Descriptor

func (*GetAlphanumericRequest) Descriptor() ([]byte, []int)

func (*GetAlphanumericRequest) GetLength

func (m *GetAlphanumericRequest) GetLength() uint32

func (*GetAlphanumericRequest) GetSize

func (m *GetAlphanumericRequest) GetSize() uint32

func (*GetAlphanumericRequest) ProtoMessage

func (*GetAlphanumericRequest) ProtoMessage()

func (*GetAlphanumericRequest) Reset

func (m *GetAlphanumericRequest) Reset()

func (*GetAlphanumericRequest) String

func (m *GetAlphanumericRequest) String() string

func (*GetAlphanumericRequest) XXX_DiscardUnknown

func (m *GetAlphanumericRequest) XXX_DiscardUnknown()

func (*GetAlphanumericRequest) XXX_Marshal

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

func (*GetAlphanumericRequest) XXX_Merge

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

func (*GetAlphanumericRequest) XXX_Size

func (m *GetAlphanumericRequest) XXX_Size() int

func (*GetAlphanumericRequest) XXX_Unmarshal

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

type GetAlphanumericResponse

type GetAlphanumericResponse struct {
	SessionId            string   `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
	Prompt               string   `protobuf:"bytes,2,opt,name=prompt,proto3" json:"prompt,omitempty"`
	Image                []byte   `protobuf:"bytes,3,opt,name=image,proto3" json:"image,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GetAlphanumericResponse) Descriptor

func (*GetAlphanumericResponse) Descriptor() ([]byte, []int)

func (*GetAlphanumericResponse) GetImage

func (m *GetAlphanumericResponse) GetImage() []byte

func (*GetAlphanumericResponse) GetPrompt

func (m *GetAlphanumericResponse) GetPrompt() string

func (*GetAlphanumericResponse) GetSessionId

func (m *GetAlphanumericResponse) GetSessionId() string

func (*GetAlphanumericResponse) ProtoMessage

func (*GetAlphanumericResponse) ProtoMessage()

func (*GetAlphanumericResponse) Reset

func (m *GetAlphanumericResponse) Reset()

func (*GetAlphanumericResponse) String

func (m *GetAlphanumericResponse) String() string

func (*GetAlphanumericResponse) XXX_DiscardUnknown

func (m *GetAlphanumericResponse) XXX_DiscardUnknown()

func (*GetAlphanumericResponse) XXX_Marshal

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

func (*GetAlphanumericResponse) XXX_Merge

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

func (*GetAlphanumericResponse) XXX_Size

func (m *GetAlphanumericResponse) XXX_Size() int

func (*GetAlphanumericResponse) XXX_Unmarshal

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

type GetImagesRequest

type GetImagesRequest struct {
	Number               uint32   `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"`
	Label                string   `protobuf:"bytes,2,opt,name=label,proto3" json:"label,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GetImagesRequest) Descriptor

func (*GetImagesRequest) Descriptor() ([]byte, []int)

func (*GetImagesRequest) GetLabel

func (m *GetImagesRequest) GetLabel() string

func (*GetImagesRequest) GetNumber

func (m *GetImagesRequest) GetNumber() uint32

func (*GetImagesRequest) ProtoMessage

func (*GetImagesRequest) ProtoMessage()

func (*GetImagesRequest) Reset

func (m *GetImagesRequest) Reset()

func (*GetImagesRequest) String

func (m *GetImagesRequest) String() string

func (*GetImagesRequest) XXX_DiscardUnknown

func (m *GetImagesRequest) XXX_DiscardUnknown()

func (*GetImagesRequest) XXX_Marshal

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

func (*GetImagesRequest) XXX_Merge

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

func (*GetImagesRequest) XXX_Size

func (m *GetImagesRequest) XXX_Size() int

func (*GetImagesRequest) XXX_Unmarshal

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

type GetImagesResponse

type GetImagesResponse struct {
	SessionId            string   `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
	Prompt               string   `protobuf:"bytes,2,opt,name=prompt,proto3" json:"prompt,omitempty"`
	Images               [][]byte `protobuf:"bytes,3,rep,name=images,proto3" json:"images,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GetImagesResponse) Descriptor

func (*GetImagesResponse) Descriptor() ([]byte, []int)

func (*GetImagesResponse) GetImages

func (m *GetImagesResponse) GetImages() [][]byte

func (*GetImagesResponse) GetPrompt

func (m *GetImagesResponse) GetPrompt() string

func (*GetImagesResponse) GetSessionId

func (m *GetImagesResponse) GetSessionId() string

func (*GetImagesResponse) ProtoMessage

func (*GetImagesResponse) ProtoMessage()

func (*GetImagesResponse) Reset

func (m *GetImagesResponse) Reset()

func (*GetImagesResponse) String

func (m *GetImagesResponse) String() string

func (*GetImagesResponse) XXX_DiscardUnknown

func (m *GetImagesResponse) XXX_DiscardUnknown()

func (*GetImagesResponse) XXX_Marshal

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

func (*GetImagesResponse) XXX_Merge

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

func (*GetImagesResponse) XXX_Size

func (m *GetImagesResponse) XXX_Size() int

func (*GetImagesResponse) XXX_Unmarshal

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

type GetQuestionsRequest

type GetQuestionsRequest struct {
	Number               uint32   `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"`
	Label                string   `protobuf:"bytes,2,opt,name=label,proto3" json:"label,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GetQuestionsRequest) Descriptor

func (*GetQuestionsRequest) Descriptor() ([]byte, []int)

func (*GetQuestionsRequest) GetLabel

func (m *GetQuestionsRequest) GetLabel() string

func (*GetQuestionsRequest) GetNumber

func (m *GetQuestionsRequest) GetNumber() uint32

func (*GetQuestionsRequest) ProtoMessage

func (*GetQuestionsRequest) ProtoMessage()

func (*GetQuestionsRequest) Reset

func (m *GetQuestionsRequest) Reset()

func (*GetQuestionsRequest) String

func (m *GetQuestionsRequest) String() string

func (*GetQuestionsRequest) XXX_DiscardUnknown

func (m *GetQuestionsRequest) XXX_DiscardUnknown()

func (*GetQuestionsRequest) XXX_Marshal

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

func (*GetQuestionsRequest) XXX_Merge

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

func (*GetQuestionsRequest) XXX_Size

func (m *GetQuestionsRequest) XXX_Size() int

func (*GetQuestionsRequest) XXX_Unmarshal

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

type GetQuestionsResponse

type GetQuestionsResponse struct {
	SessionId            string   `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
	Questions            []string `protobuf:"bytes,2,rep,name=questions,proto3" json:"questions,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GetQuestionsResponse) Descriptor

func (*GetQuestionsResponse) Descriptor() ([]byte, []int)

func (*GetQuestionsResponse) GetQuestions

func (m *GetQuestionsResponse) GetQuestions() []string

func (*GetQuestionsResponse) GetSessionId

func (m *GetQuestionsResponse) GetSessionId() string

func (*GetQuestionsResponse) ProtoMessage

func (*GetQuestionsResponse) ProtoMessage()

func (*GetQuestionsResponse) Reset

func (m *GetQuestionsResponse) Reset()

func (*GetQuestionsResponse) String

func (m *GetQuestionsResponse) String() string

func (*GetQuestionsResponse) XXX_DiscardUnknown

func (m *GetQuestionsResponse) XXX_DiscardUnknown()

func (*GetQuestionsResponse) XXX_Marshal

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

func (*GetQuestionsResponse) XXX_Merge

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

func (*GetQuestionsResponse) XXX_Size

func (m *GetQuestionsResponse) XXX_Size() int

func (*GetQuestionsResponse) XXX_Unmarshal

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

type SessionSolution

type SessionSolution struct {
	Uuid                 string   `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"`
	Answer               []string `protobuf:"bytes,2,rep,name=answer,proto3" json:"answer,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*SessionSolution) Descriptor

func (*SessionSolution) Descriptor() ([]byte, []int)

func (*SessionSolution) GetAnswer

func (m *SessionSolution) GetAnswer() []string

func (*SessionSolution) GetUuid

func (m *SessionSolution) GetUuid() string

func (*SessionSolution) ProtoMessage

func (*SessionSolution) ProtoMessage()

func (*SessionSolution) Reset

func (m *SessionSolution) Reset()

func (*SessionSolution) String

func (m *SessionSolution) String() string

func (*SessionSolution) XXX_DiscardUnknown

func (m *SessionSolution) XXX_DiscardUnknown()

func (*SessionSolution) XXX_Marshal

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

func (*SessionSolution) XXX_Merge

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

func (*SessionSolution) XXX_Size

func (m *SessionSolution) XXX_Size() int

func (*SessionSolution) XXX_Unmarshal

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

type SolutionResponse

type SolutionResponse struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*SolutionResponse) Descriptor

func (*SolutionResponse) Descriptor() ([]byte, []int)

func (*SolutionResponse) ProtoMessage

func (*SolutionResponse) ProtoMessage()

func (*SolutionResponse) Reset

func (m *SolutionResponse) Reset()

func (*SolutionResponse) String

func (m *SolutionResponse) String() string

func (*SolutionResponse) XXX_DiscardUnknown

func (m *SolutionResponse) XXX_DiscardUnknown()

func (*SolutionResponse) XXX_Marshal

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

func (*SolutionResponse) XXX_Merge

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

func (*SolutionResponse) XXX_Size

func (m *SolutionResponse) XXX_Size() int

func (*SolutionResponse) XXX_Unmarshal

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

type UnimplementedChallengeServer

type UnimplementedChallengeServer struct {
}

UnimplementedChallengeServer can be embedded to have forward compatible implementations.

func (*UnimplementedChallengeServer) GetAlphanumericChallenge

func (*UnimplementedChallengeServer) GetImagesChallenge

func (*UnimplementedChallengeServer) GetQuestionsChallenge

func (*UnimplementedChallengeServer) SolveSession

Jump to

Keyboard shortcuts

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