peersrpc

package
v0.18.4-beta.rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package peersrpc is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const Subsystem = "PRPC"

Subsystem defines the logging code for this subsystem.

Variables

View Source
var (
	UpdateAction_name = map[int32]string{
		0: "ADD",
		1: "REMOVE",
	}
	UpdateAction_value = map[string]int32{
		"ADD":    0,
		"REMOVE": 1,
	}
)

Enum value maps for UpdateAction.

View Source
var (
	FeatureSet_name = map[int32]string{
		0: "SET_INIT",
		1: "SET_LEGACY_GLOBAL",
		2: "SET_NODE_ANN",
		3: "SET_INVOICE",
		4: "SET_INVOICE_AMP",
	}
	FeatureSet_value = map[string]int32{
		"SET_INIT":          0,
		"SET_LEGACY_GLOBAL": 1,
		"SET_NODE_ANN":      2,
		"SET_INVOICE":       3,
		"SET_INVOICE_AMP":   4,
	}
)

Enum value maps for FeatureSet.

View Source
var File_peersrpc_peers_proto protoreflect.FileDescriptor
View Source
var Peers_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "peersrpc.Peers",
	HandlerType: (*PeersServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "UpdateNodeAnnouncement",
			Handler:    _Peers_UpdateNodeAnnouncement_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "peersrpc/peers.proto",
}

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

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by by default until UseLogger is called.

func RegisterPeersHandler

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

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

func RegisterPeersHandlerClient

func RegisterPeersHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PeersClient) error

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

func RegisterPeersHandlerFromEndpoint

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

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

func RegisterPeersHandlerServer

func RegisterPeersHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PeersServer) error

RegisterPeersHandlerServer registers the http handlers for service Peers to "mux". UnaryRPC :call PeersServer 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 RegisterPeersHandlerFromEndpoint instead.

func RegisterPeersJSONCallbacks

func RegisterPeersJSONCallbacks(registry map[string]func(ctx context.Context,
	conn *grpc.ClientConn, reqJSON string, callback func(string, error)))

func RegisterPeersServer

func RegisterPeersServer(s grpc.ServiceRegistrar, srv PeersServer)

func UseLogger

func UseLogger(logger btclog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using btclog.

Types

type Config

type Config struct{}

Config is empty for non-peersrpc builds.

type FeatureSet

type FeatureSet int32
const (
	// SET_INIT identifies features that should be sent in an Init message to
	// a remote peer.
	FeatureSet_SET_INIT FeatureSet = 0
	// SET_LEGACY_GLOBAL identifies features that should be set in the legacy
	// GlobalFeatures field of an Init message, which maintains backwards
	// compatibility with nodes that haven't implemented flat features.
	FeatureSet_SET_LEGACY_GLOBAL FeatureSet = 1
	// SET_NODE_ANN identifies features that should be advertised on node
	// announcements.
	FeatureSet_SET_NODE_ANN FeatureSet = 2
	// SET_INVOICE identifies features that should be advertised on invoices
	// generated by the daemon.
	FeatureSet_SET_INVOICE FeatureSet = 3
	// SET_INVOICE_AMP identifies the features that should be advertised on
	// AMP invoices generated by the daemon.
	FeatureSet_SET_INVOICE_AMP FeatureSet = 4
)

func (FeatureSet) Descriptor

func (FeatureSet) Descriptor() protoreflect.EnumDescriptor

func (FeatureSet) Enum

func (x FeatureSet) Enum() *FeatureSet

func (FeatureSet) EnumDescriptor deprecated

func (FeatureSet) EnumDescriptor() ([]byte, []int)

Deprecated: Use FeatureSet.Descriptor instead.

func (FeatureSet) Number

func (x FeatureSet) Number() protoreflect.EnumNumber

func (FeatureSet) String

func (x FeatureSet) String() string

func (FeatureSet) Type

type NodeAnnouncementUpdateRequest

type NodeAnnouncementUpdateRequest struct {

	// Set of changes for the features that the node supports.
	FeatureUpdates []*UpdateFeatureAction `protobuf:"bytes,1,rep,name=feature_updates,json=featureUpdates,proto3" json:"feature_updates,omitempty"`
	// Color is the node's color in hex code format.
	Color string `protobuf:"bytes,2,opt,name=color,proto3" json:"color,omitempty"`
	// Alias or nick name of the node.
	Alias string `protobuf:"bytes,3,opt,name=alias,proto3" json:"alias,omitempty"`
	// Set of changes for the node's known addresses.
	AddressUpdates []*UpdateAddressAction `protobuf:"bytes,4,rep,name=address_updates,json=addressUpdates,proto3" json:"address_updates,omitempty"`
	// contains filtered or unexported fields
}

func (*NodeAnnouncementUpdateRequest) Descriptor deprecated

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

Deprecated: Use NodeAnnouncementUpdateRequest.ProtoReflect.Descriptor instead.

func (*NodeAnnouncementUpdateRequest) GetAddressUpdates

func (x *NodeAnnouncementUpdateRequest) GetAddressUpdates() []*UpdateAddressAction

func (*NodeAnnouncementUpdateRequest) GetAlias

func (x *NodeAnnouncementUpdateRequest) GetAlias() string

func (*NodeAnnouncementUpdateRequest) GetColor

func (x *NodeAnnouncementUpdateRequest) GetColor() string

func (*NodeAnnouncementUpdateRequest) GetFeatureUpdates

func (x *NodeAnnouncementUpdateRequest) GetFeatureUpdates() []*UpdateFeatureAction

func (*NodeAnnouncementUpdateRequest) ProtoMessage

func (*NodeAnnouncementUpdateRequest) ProtoMessage()

func (*NodeAnnouncementUpdateRequest) ProtoReflect

func (*NodeAnnouncementUpdateRequest) Reset

func (x *NodeAnnouncementUpdateRequest) Reset()

func (*NodeAnnouncementUpdateRequest) String

type NodeAnnouncementUpdateResponse

type NodeAnnouncementUpdateResponse struct {
	Ops []*lnrpc.Op `protobuf:"bytes,1,rep,name=ops,proto3" json:"ops,omitempty"`
	// contains filtered or unexported fields
}

func (*NodeAnnouncementUpdateResponse) Descriptor deprecated

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

Deprecated: Use NodeAnnouncementUpdateResponse.ProtoReflect.Descriptor instead.

func (*NodeAnnouncementUpdateResponse) GetOps

func (x *NodeAnnouncementUpdateResponse) GetOps() []*lnrpc.Op

func (*NodeAnnouncementUpdateResponse) ProtoMessage

func (*NodeAnnouncementUpdateResponse) ProtoMessage()

func (*NodeAnnouncementUpdateResponse) ProtoReflect

func (*NodeAnnouncementUpdateResponse) Reset

func (x *NodeAnnouncementUpdateResponse) Reset()

func (*NodeAnnouncementUpdateResponse) String

type PeersClient

type PeersClient interface {
	// lncli: peers updatenodeannouncement
	// UpdateNodeAnnouncement allows the caller to update the node parameters
	// and broadcasts a new version of the node announcement to its peers.
	UpdateNodeAnnouncement(ctx context.Context, in *NodeAnnouncementUpdateRequest, opts ...grpc.CallOption) (*NodeAnnouncementUpdateResponse, error)
}

PeersClient is the client API for Peers 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 NewPeersClient

func NewPeersClient(cc grpc.ClientConnInterface) PeersClient

type PeersServer

type PeersServer interface {
	// lncli: peers updatenodeannouncement
	// UpdateNodeAnnouncement allows the caller to update the node parameters
	// and broadcasts a new version of the node announcement to its peers.
	UpdateNodeAnnouncement(context.Context, *NodeAnnouncementUpdateRequest) (*NodeAnnouncementUpdateResponse, error)
	// contains filtered or unexported methods
}

PeersServer is the server API for Peers service. All implementations must embed UnimplementedPeersServer for forward compatibility

type UnimplementedPeersServer

type UnimplementedPeersServer struct {
}

UnimplementedPeersServer must be embedded to have forward compatible implementations.

type UnsafePeersServer

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

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

type UpdateAction

type UpdateAction int32

UpdateAction is used to determine the kind of action we are referring to.

const (
	// ADD indicates this is an "insertion" kind of action.
	UpdateAction_ADD UpdateAction = 0
	// REMOVE indicates this is a "deletion" kind of action.
	UpdateAction_REMOVE UpdateAction = 1
)

func (UpdateAction) Descriptor

func (UpdateAction) Enum

func (x UpdateAction) Enum() *UpdateAction

func (UpdateAction) EnumDescriptor deprecated

func (UpdateAction) EnumDescriptor() ([]byte, []int)

Deprecated: Use UpdateAction.Descriptor instead.

func (UpdateAction) Number

func (UpdateAction) String

func (x UpdateAction) String() string

func (UpdateAction) Type

type UpdateAddressAction

type UpdateAddressAction struct {

	// Determines the kind of action.
	Action UpdateAction `protobuf:"varint,1,opt,name=action,proto3,enum=peersrpc.UpdateAction" json:"action,omitempty"`
	// The address used to apply the update action.
	Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateAddressAction) Descriptor deprecated

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

Deprecated: Use UpdateAddressAction.ProtoReflect.Descriptor instead.

func (*UpdateAddressAction) GetAction

func (x *UpdateAddressAction) GetAction() UpdateAction

func (*UpdateAddressAction) GetAddress

func (x *UpdateAddressAction) GetAddress() string

func (*UpdateAddressAction) ProtoMessage

func (*UpdateAddressAction) ProtoMessage()

func (*UpdateAddressAction) ProtoReflect

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

func (*UpdateAddressAction) Reset

func (x *UpdateAddressAction) Reset()

func (*UpdateAddressAction) String

func (x *UpdateAddressAction) String() string

type UpdateFeatureAction

type UpdateFeatureAction struct {

	// Determines the kind of action.
	Action UpdateAction `protobuf:"varint,1,opt,name=action,proto3,enum=peersrpc.UpdateAction" json:"action,omitempty"`
	// The feature bit used to apply the update action.
	FeatureBit lnrpc.FeatureBit `protobuf:"varint,2,opt,name=feature_bit,json=featureBit,proto3,enum=lnrpc.FeatureBit" json:"feature_bit,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateFeatureAction) Descriptor deprecated

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

Deprecated: Use UpdateFeatureAction.ProtoReflect.Descriptor instead.

func (*UpdateFeatureAction) GetAction

func (x *UpdateFeatureAction) GetAction() UpdateAction

func (*UpdateFeatureAction) GetFeatureBit

func (x *UpdateFeatureAction) GetFeatureBit() lnrpc.FeatureBit

func (*UpdateFeatureAction) ProtoMessage

func (*UpdateFeatureAction) ProtoMessage()

func (*UpdateFeatureAction) ProtoReflect

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

func (*UpdateFeatureAction) Reset

func (x *UpdateFeatureAction) Reset()

func (*UpdateFeatureAction) String

func (x *UpdateFeatureAction) String() string

Jump to

Keyboard shortcuts

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