apiv1

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: MIT Imports: 17 Imported by: 1

Documentation

Overview

Package apiv1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_rpc_api_v1_api_proto protoreflect.FileDescriptor
View Source
var PoetService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "rpc.api.v1.PoetService",
	HandlerType: (*PoetServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Start",
			Handler:    _PoetService_Start_Handler,
		},
		{
			MethodName: "UpdateGateway",
			Handler:    _PoetService_UpdateGateway_Handler,
		},
		{
			MethodName: "Submit",
			Handler:    _PoetService_Submit_Handler,
		},
		{
			MethodName: "GetInfo",
			Handler:    _PoetService_GetInfo_Handler,
		},
		{
			MethodName: "GetProof",
			Handler:    _PoetService_GetProof_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "rpc/api/v1/api.proto",
}

PoetService_ServiceDesc is the grpc.ServiceDesc for PoetService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterPoetServiceHandler

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

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

func RegisterPoetServiceHandlerClient

func RegisterPoetServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PoetServiceClient) error

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

func RegisterPoetServiceHandlerFromEndpoint

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

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

func RegisterPoetServiceHandlerServer

func RegisterPoetServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PoetServiceServer) error

RegisterPoetServiceHandlerServer registers the http handlers for service PoetService to "mux". UnaryRPC :call PoetServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterPoetServiceHandlerFromEndpoint instead.

func RegisterPoetServiceServer

func RegisterPoetServiceServer(s grpc.ServiceRegistrar, srv PoetServiceServer)

Types

type GetInfoRequest

type GetInfoRequest struct {
	// contains filtered or unexported fields
}

func (*GetInfoRequest) Descriptor deprecated

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

Deprecated: Use GetInfoRequest.ProtoReflect.Descriptor instead.

func (*GetInfoRequest) ProtoMessage

func (*GetInfoRequest) ProtoMessage()

func (*GetInfoRequest) ProtoReflect

func (x *GetInfoRequest) ProtoReflect() protoreflect.Message

func (*GetInfoRequest) Reset

func (x *GetInfoRequest) Reset()

func (*GetInfoRequest) String

func (x *GetInfoRequest) String() string

type GetInfoResponse

type GetInfoResponse struct {
	OpenRoundId        string   `protobuf:"bytes,1,opt,name=open_round_id,json=openRoundId,proto3" json:"open_round_id,omitempty"`
	ExecutingRoundsIds []string `protobuf:"bytes,2,rep,name=executing_rounds_ids,json=executingRoundsIds,proto3" json:"executing_rounds_ids,omitempty"`
	ServicePubkey      []byte   `protobuf:"bytes,3,opt,name=service_pubkey,json=servicePubkey,proto3" json:"service_pubkey,omitempty"`
	// contains filtered or unexported fields
}

func (*GetInfoResponse) Descriptor deprecated

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

Deprecated: Use GetInfoResponse.ProtoReflect.Descriptor instead.

func (*GetInfoResponse) GetExecutingRoundsIds

func (x *GetInfoResponse) GetExecutingRoundsIds() []string

func (*GetInfoResponse) GetOpenRoundId

func (x *GetInfoResponse) GetOpenRoundId() string

func (*GetInfoResponse) GetServicePubkey

func (x *GetInfoResponse) GetServicePubkey() []byte

func (*GetInfoResponse) ProtoMessage

func (*GetInfoResponse) ProtoMessage()

func (*GetInfoResponse) ProtoReflect

func (x *GetInfoResponse) ProtoReflect() protoreflect.Message

func (*GetInfoResponse) Reset

func (x *GetInfoResponse) Reset()

func (*GetInfoResponse) String

func (x *GetInfoResponse) String() string

type GetProofRequest

type GetProofRequest struct {
	RoundId string `protobuf:"bytes,1,opt,name=round_id,json=roundId,proto3" json:"round_id,omitempty"`
	// contains filtered or unexported fields
}

func (*GetProofRequest) Descriptor deprecated

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

Deprecated: Use GetProofRequest.ProtoReflect.Descriptor instead.

func (*GetProofRequest) GetRoundId

func (x *GetProofRequest) GetRoundId() string

func (*GetProofRequest) ProtoMessage

func (*GetProofRequest) ProtoMessage()

func (*GetProofRequest) ProtoReflect

func (x *GetProofRequest) ProtoReflect() protoreflect.Message

func (*GetProofRequest) Reset

func (x *GetProofRequest) Reset()

func (*GetProofRequest) String

func (x *GetProofRequest) String() string

type GetProofResponse

type GetProofResponse struct {
	Proof  *PoetProof `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"`
	Pubkey []byte     `protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
	// contains filtered or unexported fields
}

func (*GetProofResponse) Descriptor deprecated

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

Deprecated: Use GetProofResponse.ProtoReflect.Descriptor instead.

func (*GetProofResponse) GetProof

func (x *GetProofResponse) GetProof() *PoetProof

func (*GetProofResponse) GetPubkey

func (x *GetProofResponse) GetPubkey() []byte

func (*GetProofResponse) ProtoMessage

func (*GetProofResponse) ProtoMessage()

func (*GetProofResponse) ProtoReflect

func (x *GetProofResponse) ProtoReflect() protoreflect.Message

func (*GetProofResponse) Reset

func (x *GetProofResponse) Reset()

func (*GetProofResponse) String

func (x *GetProofResponse) String() string

type MembershipProof

type MembershipProof struct {
	Index int32    `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
	Root  []byte   `protobuf:"bytes,2,opt,name=root,proto3" json:"root,omitempty"`
	Proof [][]byte `protobuf:"bytes,3,rep,name=proof,proto3" json:"proof,omitempty"`
	// contains filtered or unexported fields
}

func (*MembershipProof) Descriptor deprecated

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

Deprecated: Use MembershipProof.ProtoReflect.Descriptor instead.

func (*MembershipProof) GetIndex

func (x *MembershipProof) GetIndex() int32

func (*MembershipProof) GetProof

func (x *MembershipProof) GetProof() [][]byte

func (*MembershipProof) GetRoot

func (x *MembershipProof) GetRoot() []byte

func (*MembershipProof) ProtoMessage

func (*MembershipProof) ProtoMessage()

func (*MembershipProof) ProtoReflect

func (x *MembershipProof) ProtoReflect() protoreflect.Message

func (*MembershipProof) Reset

func (x *MembershipProof) Reset()

func (*MembershipProof) String

func (x *MembershipProof) String() string

type MerkleProof

type MerkleProof struct {
	Root         []byte   `protobuf:"bytes,1,opt,name=root,proto3" json:"root,omitempty"`
	ProvenLeaves [][]byte `protobuf:"bytes,2,rep,name=proven_leaves,json=provenLeaves,proto3" json:"proven_leaves,omitempty"`
	ProofNodes   [][]byte `protobuf:"bytes,3,rep,name=proof_nodes,json=proofNodes,proto3" json:"proof_nodes,omitempty"`
	// contains filtered or unexported fields
}

func (*MerkleProof) Descriptor deprecated

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

Deprecated: Use MerkleProof.ProtoReflect.Descriptor instead.

func (*MerkleProof) GetProofNodes

func (x *MerkleProof) GetProofNodes() [][]byte

func (*MerkleProof) GetProvenLeaves

func (x *MerkleProof) GetProvenLeaves() [][]byte

func (*MerkleProof) GetRoot

func (x *MerkleProof) GetRoot() []byte

func (*MerkleProof) ProtoMessage

func (*MerkleProof) ProtoMessage()

func (*MerkleProof) ProtoReflect

func (x *MerkleProof) ProtoReflect() protoreflect.Message

func (*MerkleProof) Reset

func (x *MerkleProof) Reset()

func (*MerkleProof) String

func (x *MerkleProof) String() string

type PoetProof

type PoetProof struct {
	Proof   *MerkleProof `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"`
	Members [][]byte     `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty"`
	Leaves  uint64       `protobuf:"varint,3,opt,name=leaves,proto3" json:"leaves,omitempty"`
	// contains filtered or unexported fields
}

func (*PoetProof) Descriptor deprecated

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

Deprecated: Use PoetProof.ProtoReflect.Descriptor instead.

func (*PoetProof) GetLeaves

func (x *PoetProof) GetLeaves() uint64

func (*PoetProof) GetMembers

func (x *PoetProof) GetMembers() [][]byte

func (*PoetProof) GetProof

func (x *PoetProof) GetProof() *MerkleProof

func (*PoetProof) ProtoMessage

func (*PoetProof) ProtoMessage()

func (*PoetProof) ProtoReflect

func (x *PoetProof) ProtoReflect() protoreflect.Message

func (*PoetProof) Reset

func (x *PoetProof) Reset()

func (*PoetProof) String

func (x *PoetProof) String() string

type PoetServiceClient

type PoetServiceClient interface {
	// Start is used to start the service.
	Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error)
	// UpdateGateway allows to update the list of gateway addresses,
	// similar to the Start rpc, but after the service already started.
	UpdateGateway(ctx context.Context, in *UpdateGatewayRequest, opts ...grpc.CallOption) (*UpdateGatewayResponse, error)
	// Submit adds a challenge to the service's current open round,
	// to be included its later generated proof.
	Submit(ctx context.Context, in *SubmitRequest, opts ...grpc.CallOption) (*SubmitResponse, error)
	// GetInfo returns general information concerning the service,
	// including its identity pubkey.
	GetInfo(ctx context.Context, in *GetInfoRequest, opts ...grpc.CallOption) (*GetInfoResponse, error)
	// GetProof returns the generated proof for given round id.
	GetProof(ctx context.Context, in *GetProofRequest, opts ...grpc.CallOption) (*GetProofResponse, error)
}

PoetServiceClient is the client API for PoetService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type PoetServiceServer

type PoetServiceServer interface {
	// Start is used to start the service.
	Start(context.Context, *StartRequest) (*StartResponse, error)
	// UpdateGateway allows to update the list of gateway addresses,
	// similar to the Start rpc, but after the service already started.
	UpdateGateway(context.Context, *UpdateGatewayRequest) (*UpdateGatewayResponse, error)
	// Submit adds a challenge to the service's current open round,
	// to be included its later generated proof.
	Submit(context.Context, *SubmitRequest) (*SubmitResponse, error)
	// GetInfo returns general information concerning the service,
	// including its identity pubkey.
	GetInfo(context.Context, *GetInfoRequest) (*GetInfoResponse, error)
	// GetProof returns the generated proof for given round id.
	GetProof(context.Context, *GetProofRequest) (*GetProofResponse, error)
}

PoetServiceServer is the server API for PoetService service. All implementations should embed UnimplementedPoetServiceServer for forward compatibility

type StartRequest

type StartRequest struct {
	GatewayAddresses  []string `protobuf:"bytes,1,rep,name=gateway_addresses,json=gatewayAddresses,proto3" json:"gateway_addresses,omitempty"`
	ConnAcksThreshold int32    `protobuf:"varint,2,opt,name=conn_acks_threshold,json=connAcksThreshold,proto3" json:"conn_acks_threshold,omitempty"`
	// contains filtered or unexported fields
}

func (*StartRequest) Descriptor deprecated

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

Deprecated: Use StartRequest.ProtoReflect.Descriptor instead.

func (*StartRequest) GetConnAcksThreshold

func (x *StartRequest) GetConnAcksThreshold() int32

func (*StartRequest) GetGatewayAddresses

func (x *StartRequest) GetGatewayAddresses() []string

func (*StartRequest) ProtoMessage

func (*StartRequest) ProtoMessage()

func (*StartRequest) ProtoReflect

func (x *StartRequest) ProtoReflect() protoreflect.Message

func (*StartRequest) Reset

func (x *StartRequest) Reset()

func (*StartRequest) String

func (x *StartRequest) String() string

type StartResponse

type StartResponse struct {
	// contains filtered or unexported fields
}

func (*StartResponse) Descriptor deprecated

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

Deprecated: Use StartResponse.ProtoReflect.Descriptor instead.

func (*StartResponse) ProtoMessage

func (*StartResponse) ProtoMessage()

func (*StartResponse) ProtoReflect

func (x *StartResponse) ProtoReflect() protoreflect.Message

func (*StartResponse) Reset

func (x *StartResponse) Reset()

func (*StartResponse) String

func (x *StartResponse) String() string

type SubmitRequest

type SubmitRequest struct {
	Challenge []byte `protobuf:"bytes,1,opt,name=challenge,proto3" json:"challenge,omitempty"`
	Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
	// contains filtered or unexported fields
}

func (*SubmitRequest) Descriptor deprecated

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

Deprecated: Use SubmitRequest.ProtoReflect.Descriptor instead.

func (*SubmitRequest) GetChallenge

func (x *SubmitRequest) GetChallenge() []byte

func (*SubmitRequest) GetSignature

func (x *SubmitRequest) GetSignature() []byte

func (*SubmitRequest) ProtoMessage

func (*SubmitRequest) ProtoMessage()

func (*SubmitRequest) ProtoReflect

func (x *SubmitRequest) ProtoReflect() protoreflect.Message

func (*SubmitRequest) Reset

func (x *SubmitRequest) Reset()

func (*SubmitRequest) String

func (x *SubmitRequest) String() string

type SubmitResponse

type SubmitResponse struct {
	RoundId  string               `protobuf:"bytes,1,opt,name=round_id,json=roundId,proto3" json:"round_id,omitempty"`
	Hash     []byte               `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
	RoundEnd *durationpb.Duration `protobuf:"bytes,3,opt,name=round_end,json=roundEnd,proto3" json:"round_end,omitempty"`
	// contains filtered or unexported fields
}

func (*SubmitResponse) Descriptor deprecated

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

Deprecated: Use SubmitResponse.ProtoReflect.Descriptor instead.

func (*SubmitResponse) GetHash

func (x *SubmitResponse) GetHash() []byte

func (*SubmitResponse) GetRoundEnd

func (x *SubmitResponse) GetRoundEnd() *durationpb.Duration

func (*SubmitResponse) GetRoundId

func (x *SubmitResponse) GetRoundId() string

func (*SubmitResponse) ProtoMessage

func (*SubmitResponse) ProtoMessage()

func (*SubmitResponse) ProtoReflect

func (x *SubmitResponse) ProtoReflect() protoreflect.Message

func (*SubmitResponse) Reset

func (x *SubmitResponse) Reset()

func (*SubmitResponse) String

func (x *SubmitResponse) String() string

type UnimplementedPoetServiceServer

type UnimplementedPoetServiceServer struct {
}

UnimplementedPoetServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedPoetServiceServer) GetInfo

func (UnimplementedPoetServiceServer) GetProof

func (UnimplementedPoetServiceServer) Start

func (UnimplementedPoetServiceServer) Submit

func (UnimplementedPoetServiceServer) UpdateGateway

type UnsafePoetServiceServer

type UnsafePoetServiceServer interface {
	// contains filtered or unexported methods
}

UnsafePoetServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to PoetServiceServer will result in compilation errors.

type UpdateGatewayRequest

type UpdateGatewayRequest struct {
	GatewayAddresses  []string `protobuf:"bytes,1,rep,name=gateway_addresses,json=gatewayAddresses,proto3" json:"gateway_addresses,omitempty"`
	ConnAcksThreshold int32    `protobuf:"varint,2,opt,name=conn_acks_threshold,json=connAcksThreshold,proto3" json:"conn_acks_threshold,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateGatewayRequest) Descriptor deprecated

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

Deprecated: Use UpdateGatewayRequest.ProtoReflect.Descriptor instead.

func (*UpdateGatewayRequest) GetConnAcksThreshold

func (x *UpdateGatewayRequest) GetConnAcksThreshold() int32

func (*UpdateGatewayRequest) GetGatewayAddresses

func (x *UpdateGatewayRequest) GetGatewayAddresses() []string

func (*UpdateGatewayRequest) ProtoMessage

func (*UpdateGatewayRequest) ProtoMessage()

func (*UpdateGatewayRequest) ProtoReflect

func (x *UpdateGatewayRequest) ProtoReflect() protoreflect.Message

func (*UpdateGatewayRequest) Reset

func (x *UpdateGatewayRequest) Reset()

func (*UpdateGatewayRequest) String

func (x *UpdateGatewayRequest) String() string

type UpdateGatewayResponse

type UpdateGatewayResponse struct {
	// contains filtered or unexported fields
}

func (*UpdateGatewayResponse) Descriptor deprecated

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

Deprecated: Use UpdateGatewayResponse.ProtoReflect.Descriptor instead.

func (*UpdateGatewayResponse) ProtoMessage

func (*UpdateGatewayResponse) ProtoMessage()

func (*UpdateGatewayResponse) ProtoReflect

func (x *UpdateGatewayResponse) ProtoReflect() protoreflect.Message

func (*UpdateGatewayResponse) Reset

func (x *UpdateGatewayResponse) Reset()

func (*UpdateGatewayResponse) String

func (x *UpdateGatewayResponse) String() string

Jump to

Keyboard shortcuts

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