apiv1

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 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: "PowParams",
			Handler:    _PoetService_PowParams_Handler,
		},
		{
			MethodName: "Submit",
			Handler:    _PoetService_Submit_Handler,
		},
		{
			MethodName: "Info",
			Handler:    _PoetService_Info_Handler,
		},
		{
			MethodName: "Proof",
			Handler:    _PoetService_Proof_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 InfoRequest added in v0.6.6

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

func (*InfoRequest) Descriptor deprecated added in v0.6.6

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

Deprecated: Use InfoRequest.ProtoReflect.Descriptor instead.

func (*InfoRequest) ProtoMessage added in v0.6.6

func (*InfoRequest) ProtoMessage()

func (*InfoRequest) ProtoReflect added in v0.6.6

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

func (*InfoRequest) Reset added in v0.6.6

func (x *InfoRequest) Reset()

func (*InfoRequest) String added in v0.6.6

func (x *InfoRequest) String() string

type InfoResponse added in v0.6.6

type InfoResponse struct {
	OpenRoundId      string               `protobuf:"bytes,1,opt,name=open_round_id,json=openRoundId,proto3" json:"open_round_id,omitempty"`
	ExecutingRoundId string               `protobuf:"bytes,2,opt,name=executing_round_id,json=executingRoundId,proto3" json:"executing_round_id,omitempty"`
	ServicePubkey    []byte               `protobuf:"bytes,3,opt,name=service_pubkey,json=servicePubkey,proto3" json:"service_pubkey,omitempty"`
	PhaseShift       *durationpb.Duration `protobuf:"bytes,4,opt,name=phase_shift,json=phaseShift,proto3" json:"phase_shift,omitempty"`
	CycleGap         *durationpb.Duration `protobuf:"bytes,5,opt,name=cycle_gap,json=cycleGap,proto3" json:"cycle_gap,omitempty"`
	// contains filtered or unexported fields
}

func (*InfoResponse) Descriptor deprecated added in v0.6.6

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

Deprecated: Use InfoResponse.ProtoReflect.Descriptor instead.

func (*InfoResponse) GetCycleGap added in v0.8.4

func (x *InfoResponse) GetCycleGap() *durationpb.Duration

func (*InfoResponse) GetExecutingRoundId added in v0.8.5

func (x *InfoResponse) GetExecutingRoundId() string

func (*InfoResponse) GetOpenRoundId added in v0.6.6

func (x *InfoResponse) GetOpenRoundId() string

func (*InfoResponse) GetPhaseShift added in v0.8.4

func (x *InfoResponse) GetPhaseShift() *durationpb.Duration

func (*InfoResponse) GetServicePubkey added in v0.6.6

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

func (*InfoResponse) ProtoMessage added in v0.6.6

func (*InfoResponse) ProtoMessage()

func (*InfoResponse) ProtoReflect added in v0.6.6

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

func (*InfoResponse) Reset added in v0.6.6

func (x *InfoResponse) Reset()

func (*InfoResponse) String added in v0.6.6

func (x *InfoResponse) 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 {
	PowParams(ctx context.Context, in *PowParamsRequest, opts ...grpc.CallOption) (*PowParamsResponse, error)
	// Submit registers data 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)
	// Info returns general information concerning the service,
	// including its identity pubkey.
	Info(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*InfoResponse, error)
	// roof returns the generated proof for given round id.
	Proof(ctx context.Context, in *ProofRequest, opts ...grpc.CallOption) (*ProofResponse, 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 {
	PowParams(context.Context, *PowParamsRequest) (*PowParamsResponse, error)
	// Submit registers data to the service's current open round,
	// to be included its later generated proof.
	Submit(context.Context, *SubmitRequest) (*SubmitResponse, error)
	// Info returns general information concerning the service,
	// including its identity pubkey.
	Info(context.Context, *InfoRequest) (*InfoResponse, error)
	// roof returns the generated proof for given round id.
	Proof(context.Context, *ProofRequest) (*ProofResponse, error)
}

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

type PowParams added in v0.7.0

type PowParams struct {

	// Difficulty of the PoW challenge (in terms of leading zero bits in the hash)
	Difficulty uint32 `protobuf:"varint,1,opt,name=difficulty,proto3" json:"difficulty,omitempty"`
	// The challenge to be used for the PoW
	Challenge []byte `protobuf:"bytes,2,opt,name=challenge,proto3" json:"challenge,omitempty"`
	// contains filtered or unexported fields
}

func (*PowParams) Descriptor deprecated added in v0.7.0

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

Deprecated: Use PowParams.ProtoReflect.Descriptor instead.

func (*PowParams) GetChallenge added in v0.7.0

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

func (*PowParams) GetDifficulty added in v0.7.0

func (x *PowParams) GetDifficulty() uint32

func (*PowParams) ProtoMessage added in v0.7.0

func (*PowParams) ProtoMessage()

func (*PowParams) ProtoReflect added in v0.7.0

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

func (*PowParams) Reset added in v0.7.0

func (x *PowParams) Reset()

func (*PowParams) String added in v0.7.0

func (x *PowParams) String() string

type PowParamsRequest added in v0.7.0

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

func (*PowParamsRequest) Descriptor deprecated added in v0.7.0

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

Deprecated: Use PowParamsRequest.ProtoReflect.Descriptor instead.

func (*PowParamsRequest) ProtoMessage added in v0.7.0

func (*PowParamsRequest) ProtoMessage()

func (*PowParamsRequest) ProtoReflect added in v0.7.0

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

func (*PowParamsRequest) Reset added in v0.7.0

func (x *PowParamsRequest) Reset()

func (*PowParamsRequest) String added in v0.7.0

func (x *PowParamsRequest) String() string

type PowParamsResponse added in v0.7.0

type PowParamsResponse struct {
	PowParams *PowParams `protobuf:"bytes,1,opt,name=pow_params,json=powParams,proto3" json:"pow_params,omitempty"`
	// contains filtered or unexported fields
}

func (*PowParamsResponse) Descriptor deprecated added in v0.7.0

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

Deprecated: Use PowParamsResponse.ProtoReflect.Descriptor instead.

func (*PowParamsResponse) GetPowParams added in v0.7.0

func (x *PowParamsResponse) GetPowParams() *PowParams

func (*PowParamsResponse) ProtoMessage added in v0.7.0

func (*PowParamsResponse) ProtoMessage()

func (*PowParamsResponse) ProtoReflect added in v0.7.0

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

func (*PowParamsResponse) Reset added in v0.7.0

func (x *PowParamsResponse) Reset()

func (*PowParamsResponse) String added in v0.7.0

func (x *PowParamsResponse) String() string

type ProofRequest added in v0.6.6

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

func (*ProofRequest) Descriptor deprecated added in v0.6.6

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

Deprecated: Use ProofRequest.ProtoReflect.Descriptor instead.

func (*ProofRequest) GetRoundId added in v0.6.6

func (x *ProofRequest) GetRoundId() string

func (*ProofRequest) ProtoMessage added in v0.6.6

func (*ProofRequest) ProtoMessage()

func (*ProofRequest) ProtoReflect added in v0.6.6

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

func (*ProofRequest) Reset added in v0.6.6

func (x *ProofRequest) Reset()

func (*ProofRequest) String added in v0.6.6

func (x *ProofRequest) String() string

type ProofResponse added in v0.6.6

type ProofResponse 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 (*ProofResponse) Descriptor deprecated added in v0.6.6

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

Deprecated: Use ProofResponse.ProtoReflect.Descriptor instead.

func (*ProofResponse) GetProof added in v0.6.6

func (x *ProofResponse) GetProof() *PoetProof

func (*ProofResponse) GetPubkey added in v0.6.6

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

func (*ProofResponse) ProtoMessage added in v0.6.6

func (*ProofResponse) ProtoMessage()

func (*ProofResponse) ProtoReflect added in v0.6.6

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

func (*ProofResponse) Reset added in v0.6.6

func (x *ProofResponse) Reset()

func (*ProofResponse) String added in v0.6.6

func (x *ProofResponse) String() string

type SubmitRequest

type SubmitRequest struct {

	// Proof of Work nonce
	Nonce uint64 `protobuf:"varint,1,opt,name=nonce,proto3" json:"nonce,omitempty"`
	// Proof of Work parameters that were used to generate the nonce
	PowParams *PowParams `protobuf:"bytes,2,opt,name=pow_params,json=powParams,proto3" json:"pow_params,omitempty"`
	// Prefix to be added to challenge for signature verification
	Prefix []byte `protobuf:"bytes,3,opt,name=prefix,proto3" json:"prefix,omitempty"`
	// The PoET challenge to be registered for the open round
	Challenge []byte `protobuf:"bytes,4,opt,name=challenge,proto3" json:"challenge,omitempty"`
	// The user's public key (node ID)
	Pubkey []byte `protobuf:"bytes,5,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
	// The user's signature over the challenge
	Signature []byte `protobuf:"bytes,6,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) GetNonce added in v0.7.0

func (x *SubmitRequest) GetNonce() uint64

func (*SubmitRequest) GetPowParams added in v0.7.0

func (x *SubmitRequest) GetPowParams() *PowParams

func (*SubmitRequest) GetPrefix added in v0.7.0

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

func (*SubmitRequest) GetPubkey added in v0.7.0

func (x *SubmitRequest) GetPubkey() []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"`
	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) 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) Info added in v0.6.6

func (UnimplementedPoetServiceServer) PowParams added in v0.7.0

func (UnimplementedPoetServiceServer) Proof added in v0.6.6

func (UnimplementedPoetServiceServer) Submit

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.

Jump to

Keyboard shortcuts

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