faucet

package
v0.0.0-...-6e5a1dd Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package faucet is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	Faucet_Status_FullMethodName = "/faucet.Faucet/Status"
	Faucet_Credit_FullMethodName = "/faucet.Faucet/Credit"
)

Variables

View Source
var Faucet_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "faucet.Faucet",
	HandlerType: (*FaucetServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Status",
			Handler:    _Faucet_Status_Handler,
		},
		{
			MethodName: "Credit",
			Handler:    _Faucet_Credit_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "faucet/service.proto",
}

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

View Source
var File_faucet_service_proto protoreflect.FileDescriptor
View Source
var File_faucet_status_proto protoreflect.FileDescriptor

Functions

func RegisterFaucetHandler

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

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

func RegisterFaucetHandlerClient

func RegisterFaucetHandlerClient(ctx context.Context, mux *runtime.ServeMux, client FaucetClient) error

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

func RegisterFaucetHandlerFromEndpoint

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

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

func RegisterFaucetHandlerServer

func RegisterFaucetHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FaucetServer) error

RegisterFaucetHandlerServer registers the http handlers for service Faucet to "mux". UnaryRPC :call FaucetServer 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 RegisterFaucetHandlerFromEndpoint instead.

func RegisterFaucetServer

func RegisterFaucetServer(s grpc.ServiceRegistrar, srv FaucetServer)

Types

type AddressBalance

type AddressBalance struct {
	Address string  `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	Balance []*Coin `protobuf:"bytes,2,rep,name=balance,proto3" json:"balance,omitempty"`
	// contains filtered or unexported fields
}

func (*AddressBalance) Descriptor deprecated

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

Deprecated: Use AddressBalance.ProtoReflect.Descriptor instead.

func (*AddressBalance) GetAddress

func (x *AddressBalance) GetAddress() string

func (*AddressBalance) GetBalance

func (x *AddressBalance) GetBalance() []*Coin

func (*AddressBalance) ProtoMessage

func (*AddressBalance) ProtoMessage()

func (*AddressBalance) ProtoReflect

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

func (*AddressBalance) Reset

func (x *AddressBalance) Reset()

func (*AddressBalance) String

func (x *AddressBalance) String() string

type Coin

type Coin struct {
	Denom  string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"`
	Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"`
	// contains filtered or unexported fields
}

func (*Coin) Descriptor deprecated

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

Deprecated: Use Coin.ProtoReflect.Descriptor instead.

func (*Coin) GetAmount

func (x *Coin) GetAmount() string

func (*Coin) GetDenom

func (x *Coin) GetDenom() string

func (*Coin) ProtoMessage

func (*Coin) ProtoMessage()

func (*Coin) ProtoReflect

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

func (*Coin) Reset

func (x *Coin) Reset()

func (*Coin) String

func (x *Coin) String() string

type FaucetClient

type FaucetClient interface {
	// Status endpoint
	Status(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*State, error)
	// Credit endpoint
	Credit(ctx context.Context, in *RequestCredit, opts ...grpc.CallOption) (*ResponseCredit, error)
}

FaucetClient is the client API for Faucet 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 NewFaucetClient

func NewFaucetClient(cc grpc.ClientConnInterface) FaucetClient

type FaucetServer

type FaucetServer interface {
	// Status endpoint
	Status(context.Context, *emptypb.Empty) (*State, error)
	// Credit endpoint
	Credit(context.Context, *RequestCredit) (*ResponseCredit, error)
	// contains filtered or unexported methods
}

FaucetServer is the server API for Faucet service. All implementations must embed UnimplementedFaucetServer for forward compatibility

type RequestCredit

type RequestCredit struct {
	Denom   string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"`
	Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
	// contains filtered or unexported fields
}

func (*RequestCredit) Descriptor deprecated

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

Deprecated: Use RequestCredit.ProtoReflect.Descriptor instead.

func (*RequestCredit) GetAddress

func (x *RequestCredit) GetAddress() string

func (*RequestCredit) GetDenom

func (x *RequestCredit) GetDenom() string

func (*RequestCredit) ProtoMessage

func (*RequestCredit) ProtoMessage()

func (*RequestCredit) ProtoReflect

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

func (*RequestCredit) Reset

func (x *RequestCredit) Reset()

func (*RequestCredit) String

func (x *RequestCredit) String() string

type ResponseCredit

type ResponseCredit struct {
	Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*ResponseCredit) Descriptor deprecated

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

Deprecated: Use ResponseCredit.ProtoReflect.Descriptor instead.

func (*ResponseCredit) GetStatus

func (x *ResponseCredit) GetStatus() string

func (*ResponseCredit) ProtoMessage

func (*ResponseCredit) ProtoMessage()

func (*ResponseCredit) ProtoReflect

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

func (*ResponseCredit) Reset

func (x *ResponseCredit) Reset()

func (*ResponseCredit) String

func (x *ResponseCredit) String() string

type State

type State struct {
	Status          string            `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
	NodeUrl         string            `protobuf:"bytes,2,opt,name=node_url,json=nodeUrl,proto3" json:"node_url,omitempty"`
	ChainId         string            `protobuf:"bytes,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
	ChainTokens     []string          `protobuf:"bytes,4,rep,name=chain_tokens,json=chainTokens,proto3" json:"chain_tokens,omitempty"`
	AvailableTokens []string          `protobuf:"bytes,5,rep,name=available_tokens,json=availableTokens,proto3" json:"available_tokens,omitempty"`
	Holder          *AddressBalance   `protobuf:"bytes,6,opt,name=holder,proto3" json:"holder,omitempty"`
	Distributors    []*AddressBalance `protobuf:"bytes,7,rep,name=distributors,proto3" json:"distributors,omitempty"`
	// contains filtered or unexported fields
}

func (*State) Descriptor deprecated

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

Deprecated: Use State.ProtoReflect.Descriptor instead.

func (*State) GetAvailableTokens

func (x *State) GetAvailableTokens() []string

func (*State) GetChainId

func (x *State) GetChainId() string

func (*State) GetChainTokens

func (x *State) GetChainTokens() []string

func (*State) GetDistributors

func (x *State) GetDistributors() []*AddressBalance

func (*State) GetHolder

func (x *State) GetHolder() *AddressBalance

func (*State) GetNodeUrl

func (x *State) GetNodeUrl() string

func (*State) GetStatus

func (x *State) GetStatus() string

func (*State) ProtoMessage

func (*State) ProtoMessage()

func (*State) ProtoReflect

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

func (*State) Reset

func (x *State) Reset()

func (*State) String

func (x *State) String() string

type UnimplementedFaucetServer

type UnimplementedFaucetServer struct {
}

UnimplementedFaucetServer must be embedded to have forward compatible implementations.

func (UnimplementedFaucetServer) Credit

func (UnimplementedFaucetServer) Status

type UnsafeFaucetServer

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

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

Jump to

Keyboard shortcuts

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