Documentation ¶
Overview ¶
Package v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterApiServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterApiServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ApiServiceClient) error
- func RegisterApiServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterApiServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ApiServiceServer) error
- func RegisterApiServiceServer(s grpc.ServiceRegistrar, srv ApiServiceServer)
- func RegisterApiTestServiceServer(s grpc.ServiceRegistrar, srv ApiTestServiceServer)
- type ApiRequest
- func (*ApiRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ApiRequest) GetEchoKey() bool
- func (x *ApiRequest) GetId() int64
- func (x *ApiRequest) GetRequestKey() string
- func (*ApiRequest) ProtoMessage()
- func (x *ApiRequest) ProtoReflect() protoreflect.Message
- func (x *ApiRequest) Reset()
- func (x *ApiRequest) String() string
- type ApiResponse
- func (*ApiResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ApiResponse) GetId() int64
- func (x *ApiResponse) GetMessage() string
- func (x *ApiResponse) GetStatus() int32
- func (x *ApiResponse) GetTime() *timestamppb.Timestamp
- func (*ApiResponse) ProtoMessage()
- func (x *ApiResponse) ProtoReflect() protoreflect.Message
- func (x *ApiResponse) Reset()
- func (x *ApiResponse) String() string
- type ApiServiceClient
- type ApiServiceServer
- type ApiTestServiceClient
- type ApiTestServiceServer
- type ChainInfoResponse
- func (*ChainInfoResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ChainInfoResponse) GetChainId() uint32
- func (x *ChainInfoResponse) GetHeadBlock() int64
- func (x *ChainInfoResponse) GetHeadBlockHash() string
- func (x *ChainInfoResponse) GetHeadBlockTime() int64
- func (x *ChainInfoResponse) GetLibBlock() int64
- func (x *ChainInfoResponse) GetLibBlockHash() string
- func (x *ChainInfoResponse) GetLibBlockTime() int64
- func (x *ChainInfoResponse) GetLibWitnessList() []string
- func (x *ChainInfoResponse) GetNetName() string
- func (x *ChainInfoResponse) GetPendingWitnessList() []string
- func (x *ChainInfoResponse) GetProtocolVersion() string
- func (x *ChainInfoResponse) GetWitnessList() []string
- func (*ChainInfoResponse) ProtoMessage()
- func (x *ChainInfoResponse) ProtoReflect() protoreflect.Message
- func (x *ChainInfoResponse) Reset()
- func (x *ChainInfoResponse) String() string
- type EmptyRequest
- type NetworkInfo
- func (*NetworkInfo) Descriptor() ([]byte, []int)deprecated
- func (x *NetworkInfo) GetId() string
- func (x *NetworkInfo) GetNetworkName() string
- func (x *NetworkInfo) GetPeerCount() int32
- func (*NetworkInfo) ProtoMessage()
- func (x *NetworkInfo) ProtoReflect() protoreflect.Message
- func (x *NetworkInfo) Reset()
- func (x *NetworkInfo) String() string
- type NodeInfoResponse
- func (*NodeInfoResponse) Descriptor() ([]byte, []int)deprecated
- func (x *NodeInfoResponse) GetBuildTime() string
- func (x *NodeInfoResponse) GetCodeVersion() string
- func (x *NodeInfoResponse) GetGitHash() string
- func (x *NodeInfoResponse) GetMode() string
- func (x *NodeInfoResponse) GetNetwork() *NetworkInfo
- func (x *NodeInfoResponse) GetServerTime() int64
- func (x *NodeInfoResponse) GetTime() *timestamppb.Timestamp
- func (*NodeInfoResponse) ProtoMessage()
- func (x *NodeInfoResponse) ProtoReflect() protoreflect.Message
- func (x *NodeInfoResponse) Reset()
- func (x *NodeInfoResponse) String() string
- type UnimplementedApiServiceServer
- type UnimplementedApiTestServiceServer
- type UnsafeApiServiceServer
- type UnsafeApiTestServiceServer
Constants ¶
This section is empty.
Variables ¶
var ApiService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "v1.ApiService", HandlerType: (*ApiServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetNodeInfo", Handler: _ApiService_GetNodeInfo_Handler, }, { MethodName: "GetChainInfo", Handler: _ApiService_GetChainInfo_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "api/proto/v1/apirpc.proto", }
ApiService_ServiceDesc is the grpc.ServiceDesc for ApiService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var ApiTestService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "v1.ApiTestService", HandlerType: (*ApiTestServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "SendRequest", Handler: _ApiTestService_SendRequest_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "api/proto/v1/apirpc.proto", }
ApiTestService_ServiceDesc is the grpc.ServiceDesc for ApiTestService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_api_proto_v1_apirpc_proto protoreflect.FileDescriptor
Functions ¶
func RegisterApiServiceHandler ¶
func RegisterApiServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterApiServiceHandler registers the http handlers for service ApiService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterApiServiceHandlerClient ¶
func RegisterApiServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ApiServiceClient) error
RegisterApiServiceHandlerClient registers the http handlers for service ApiService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ApiServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ApiServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ApiServiceClient" to call the correct interceptors.
func RegisterApiServiceHandlerFromEndpoint ¶
func RegisterApiServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterApiServiceHandlerFromEndpoint is same as RegisterApiServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterApiServiceHandlerServer ¶
func RegisterApiServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ApiServiceServer) error
RegisterApiServiceHandlerServer registers the http handlers for service ApiService to "mux". UnaryRPC :call ApiServiceServer 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 RegisterApiServiceHandlerFromEndpoint instead.
func RegisterApiServiceServer ¶
func RegisterApiServiceServer(s grpc.ServiceRegistrar, srv ApiServiceServer)
func RegisterApiTestServiceServer ¶
func RegisterApiTestServiceServer(s grpc.ServiceRegistrar, srv ApiTestServiceServer)
Types ¶
type ApiRequest ¶
type ApiRequest struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` RequestKey string `protobuf:"bytes,2,opt,name=requestKey,proto3" json:"requestKey,omitempty"` EchoKey bool `protobuf:"varint,3,opt,name=echoKey,proto3" json:"echoKey,omitempty"` // for testing // contains filtered or unexported fields }
func (*ApiRequest) Descriptor
deprecated
func (*ApiRequest) Descriptor() ([]byte, []int)
Deprecated: Use ApiRequest.ProtoReflect.Descriptor instead.
func (*ApiRequest) GetEchoKey ¶
func (x *ApiRequest) GetEchoKey() bool
func (*ApiRequest) GetId ¶
func (x *ApiRequest) GetId() int64
func (*ApiRequest) GetRequestKey ¶
func (x *ApiRequest) GetRequestKey() string
func (*ApiRequest) ProtoMessage ¶
func (*ApiRequest) ProtoMessage()
func (*ApiRequest) ProtoReflect ¶
func (x *ApiRequest) ProtoReflect() protoreflect.Message
func (*ApiRequest) Reset ¶
func (x *ApiRequest) Reset()
func (*ApiRequest) String ¶
func (x *ApiRequest) String() string
type ApiResponse ¶
type ApiResponse struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Status int32 `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` Time *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=time,proto3" json:"time,omitempty"` // contains filtered or unexported fields }
func (*ApiResponse) Descriptor
deprecated
func (*ApiResponse) Descriptor() ([]byte, []int)
Deprecated: Use ApiResponse.ProtoReflect.Descriptor instead.
func (*ApiResponse) GetId ¶
func (x *ApiResponse) GetId() int64
func (*ApiResponse) GetMessage ¶
func (x *ApiResponse) GetMessage() string
func (*ApiResponse) GetStatus ¶
func (x *ApiResponse) GetStatus() int32
func (*ApiResponse) GetTime ¶
func (x *ApiResponse) GetTime() *timestamppb.Timestamp
func (*ApiResponse) ProtoMessage ¶
func (*ApiResponse) ProtoMessage()
func (*ApiResponse) ProtoReflect ¶
func (x *ApiResponse) ProtoReflect() protoreflect.Message
func (*ApiResponse) Reset ¶
func (x *ApiResponse) Reset()
func (*ApiResponse) String ¶
func (x *ApiResponse) String() string
type ApiServiceClient ¶
type ApiServiceClient interface { GetNodeInfo(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*NodeInfoResponse, error) GetChainInfo(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*ChainInfoResponse, error) }
ApiServiceClient is the client API for ApiService 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.
func NewApiServiceClient ¶
func NewApiServiceClient(cc grpc.ClientConnInterface) ApiServiceClient
type ApiServiceServer ¶
type ApiServiceServer interface { GetNodeInfo(context.Context, *EmptyRequest) (*NodeInfoResponse, error) GetChainInfo(context.Context, *EmptyRequest) (*ChainInfoResponse, error) }
ApiServiceServer is the server API for ApiService service. All implementations should embed UnimplementedApiServiceServer for forward compatibility
type ApiTestServiceClient ¶
type ApiTestServiceClient interface {
SendRequest(ctx context.Context, in *ApiRequest, opts ...grpc.CallOption) (*ApiResponse, error)
}
ApiTestServiceClient is the client API for ApiTestService 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.
func NewApiTestServiceClient ¶
func NewApiTestServiceClient(cc grpc.ClientConnInterface) ApiTestServiceClient
type ApiTestServiceServer ¶
type ApiTestServiceServer interface {
SendRequest(context.Context, *ApiRequest) (*ApiResponse, error)
}
ApiTestServiceServer is the server API for ApiTestService service. All implementations should embed UnimplementedApiTestServiceServer for forward compatibility
type ChainInfoResponse ¶
type ChainInfoResponse struct { // the name of network, such mainnet or testnet NetName string `protobuf:"bytes,1,opt,name=net_name,json=netName,proto3" json:"net_name,omitempty"` // the iost protocol version ProtocolVersion string `protobuf:"bytes,2,opt,name=protocol_version,json=protocolVersion,proto3" json:"protocol_version,omitempty"` // chain id ChainId uint32 `protobuf:"varint,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` // head block height HeadBlock int64 `protobuf:"varint,4,opt,name=head_block,json=headBlock,proto3" json:"head_block,omitempty"` // head block hash HeadBlockHash string `protobuf:"bytes,5,opt,name=head_block_hash,json=headBlockHash,proto3" json:"head_block_hash,omitempty"` // last irreversible block number LibBlock int64 `protobuf:"varint,6,opt,name=lib_block,json=libBlock,proto3" json:"lib_block,omitempty"` // last irreversible block hash LibBlockHash string `protobuf:"bytes,7,opt,name=lib_block_hash,json=libBlockHash,proto3" json:"lib_block_hash,omitempty"` // the current witness list WitnessList []string `protobuf:"bytes,8,rep,name=witness_list,json=witnessList,proto3" json:"witness_list,omitempty"` // the active witness list of lat irreversible block LibWitnessList []string `protobuf:"bytes,9,rep,name=lib_witness_list,json=libWitnessList,proto3" json:"lib_witness_list,omitempty"` // the pending witness list PendingWitnessList []string `protobuf:"bytes,10,rep,name=pending_witness_list,json=pendingWitnessList,proto3" json:"pending_witness_list,omitempty"` // the head block time HeadBlockTime int64 `protobuf:"varint,11,opt,name=head_block_time,json=headBlockTime,proto3" json:"head_block_time,omitempty"` // the last irreversible block time LibBlockTime int64 `protobuf:"varint,12,opt,name=lib_block_time,json=libBlockTime,proto3" json:"lib_block_time,omitempty"` // contains filtered or unexported fields }
The message defines chain information response.
func (*ChainInfoResponse) Descriptor
deprecated
func (*ChainInfoResponse) Descriptor() ([]byte, []int)
Deprecated: Use ChainInfoResponse.ProtoReflect.Descriptor instead.
func (*ChainInfoResponse) GetChainId ¶
func (x *ChainInfoResponse) GetChainId() uint32
func (*ChainInfoResponse) GetHeadBlock ¶
func (x *ChainInfoResponse) GetHeadBlock() int64
func (*ChainInfoResponse) GetHeadBlockHash ¶
func (x *ChainInfoResponse) GetHeadBlockHash() string
func (*ChainInfoResponse) GetHeadBlockTime ¶
func (x *ChainInfoResponse) GetHeadBlockTime() int64
func (*ChainInfoResponse) GetLibBlock ¶
func (x *ChainInfoResponse) GetLibBlock() int64
func (*ChainInfoResponse) GetLibBlockHash ¶
func (x *ChainInfoResponse) GetLibBlockHash() string
func (*ChainInfoResponse) GetLibBlockTime ¶
func (x *ChainInfoResponse) GetLibBlockTime() int64
func (*ChainInfoResponse) GetLibWitnessList ¶
func (x *ChainInfoResponse) GetLibWitnessList() []string
func (*ChainInfoResponse) GetNetName ¶
func (x *ChainInfoResponse) GetNetName() string
func (*ChainInfoResponse) GetPendingWitnessList ¶
func (x *ChainInfoResponse) GetPendingWitnessList() []string
func (*ChainInfoResponse) GetProtocolVersion ¶
func (x *ChainInfoResponse) GetProtocolVersion() string
func (*ChainInfoResponse) GetWitnessList ¶
func (x *ChainInfoResponse) GetWitnessList() []string
func (*ChainInfoResponse) ProtoMessage ¶
func (*ChainInfoResponse) ProtoMessage()
func (*ChainInfoResponse) ProtoReflect ¶
func (x *ChainInfoResponse) ProtoReflect() protoreflect.Message
func (*ChainInfoResponse) Reset ¶
func (x *ChainInfoResponse) Reset()
func (*ChainInfoResponse) String ¶
func (x *ChainInfoResponse) String() string
type EmptyRequest ¶
type EmptyRequest struct {
// contains filtered or unexported fields
}
func (*EmptyRequest) Descriptor
deprecated
func (*EmptyRequest) Descriptor() ([]byte, []int)
Deprecated: Use EmptyRequest.ProtoReflect.Descriptor instead.
func (*EmptyRequest) ProtoMessage ¶
func (*EmptyRequest) ProtoMessage()
func (*EmptyRequest) ProtoReflect ¶
func (x *EmptyRequest) ProtoReflect() protoreflect.Message
func (*EmptyRequest) Reset ¶
func (x *EmptyRequest) Reset()
func (*EmptyRequest) String ¶
func (x *EmptyRequest) String() string
type NetworkInfo ¶
type NetworkInfo struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` PeerCount int32 `protobuf:"varint,2,opt,name=peer_count,json=peerCount,proto3" json:"peer_count,omitempty"` NetworkName string `protobuf:"bytes,3,opt,name=network_name,json=networkName,proto3" json:"network_name,omitempty"` // contains filtered or unexported fields }
func (*NetworkInfo) Descriptor
deprecated
func (*NetworkInfo) Descriptor() ([]byte, []int)
Deprecated: Use NetworkInfo.ProtoReflect.Descriptor instead.
func (*NetworkInfo) GetId ¶
func (x *NetworkInfo) GetId() string
func (*NetworkInfo) GetNetworkName ¶
func (x *NetworkInfo) GetNetworkName() string
func (*NetworkInfo) GetPeerCount ¶
func (x *NetworkInfo) GetPeerCount() int32
func (*NetworkInfo) ProtoMessage ¶
func (*NetworkInfo) ProtoMessage()
func (*NetworkInfo) ProtoReflect ¶
func (x *NetworkInfo) ProtoReflect() protoreflect.Message
func (*NetworkInfo) Reset ¶
func (x *NetworkInfo) Reset()
func (*NetworkInfo) String ¶
func (x *NetworkInfo) String() string
type NodeInfoResponse ¶
type NodeInfoResponse struct { // build time BuildTime string `protobuf:"bytes,1,opt,name=build_time,json=buildTime,proto3" json:"build_time,omitempty"` // git hash GitHash string `protobuf:"bytes,2,opt,name=git_hash,json=gitHash,proto3" json:"git_hash,omitempty"` // node mode Mode string `protobuf:"bytes,3,opt,name=mode,proto3" json:"mode,omitempty"` // network connection information Network *NetworkInfo `protobuf:"bytes,4,opt,name=network,proto3" json:"network,omitempty"` // code version string CodeVersion string `protobuf:"bytes,5,opt,name=code_version,json=codeVersion,proto3" json:"code_version,omitempty"` // server time ServerTime int64 `protobuf:"varint,6,opt,name=server_time,json=serverTime,proto3" json:"server_time,omitempty"` Time *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=time,proto3" json:"time,omitempty"` // contains filtered or unexported fields }
func (*NodeInfoResponse) Descriptor
deprecated
func (*NodeInfoResponse) Descriptor() ([]byte, []int)
Deprecated: Use NodeInfoResponse.ProtoReflect.Descriptor instead.
func (*NodeInfoResponse) GetBuildTime ¶
func (x *NodeInfoResponse) GetBuildTime() string
func (*NodeInfoResponse) GetCodeVersion ¶
func (x *NodeInfoResponse) GetCodeVersion() string
func (*NodeInfoResponse) GetGitHash ¶
func (x *NodeInfoResponse) GetGitHash() string
func (*NodeInfoResponse) GetMode ¶
func (x *NodeInfoResponse) GetMode() string
func (*NodeInfoResponse) GetNetwork ¶
func (x *NodeInfoResponse) GetNetwork() *NetworkInfo
func (*NodeInfoResponse) GetServerTime ¶
func (x *NodeInfoResponse) GetServerTime() int64
func (*NodeInfoResponse) GetTime ¶
func (x *NodeInfoResponse) GetTime() *timestamppb.Timestamp
func (*NodeInfoResponse) ProtoMessage ¶
func (*NodeInfoResponse) ProtoMessage()
func (*NodeInfoResponse) ProtoReflect ¶
func (x *NodeInfoResponse) ProtoReflect() protoreflect.Message
func (*NodeInfoResponse) Reset ¶
func (x *NodeInfoResponse) Reset()
func (*NodeInfoResponse) String ¶
func (x *NodeInfoResponse) String() string
type UnimplementedApiServiceServer ¶
type UnimplementedApiServiceServer struct { }
UnimplementedApiServiceServer should be embedded to have forward compatible implementations.
func (UnimplementedApiServiceServer) GetChainInfo ¶
func (UnimplementedApiServiceServer) GetChainInfo(context.Context, *EmptyRequest) (*ChainInfoResponse, error)
func (UnimplementedApiServiceServer) GetNodeInfo ¶
func (UnimplementedApiServiceServer) GetNodeInfo(context.Context, *EmptyRequest) (*NodeInfoResponse, error)
type UnimplementedApiTestServiceServer ¶
type UnimplementedApiTestServiceServer struct { }
UnimplementedApiTestServiceServer should be embedded to have forward compatible implementations.
func (UnimplementedApiTestServiceServer) SendRequest ¶
func (UnimplementedApiTestServiceServer) SendRequest(context.Context, *ApiRequest) (*ApiResponse, error)
type UnsafeApiServiceServer ¶
type UnsafeApiServiceServer interface {
// contains filtered or unexported methods
}
UnsafeApiServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ApiServiceServer will result in compilation errors.
type UnsafeApiTestServiceServer ¶
type UnsafeApiTestServiceServer interface {
// contains filtered or unexported methods
}
UnsafeApiTestServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ApiTestServiceServer will result in compilation errors.