api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package api is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	PeerConnectionState_name = map[int32]string{
		0: "DISCONNECTED",
		1: "CONNECTING",
		2: "CONNECTED",
		3: "DISCONNECTING",
	}
	PeerConnectionState_value = map[string]int32{
		"DISCONNECTED":  0,
		"CONNECTING":    1,
		"CONNECTED":     2,
		"DISCONNECTING": 3,
	}
)

Enum value maps for PeerConnectionState.

View Source
var ControlPlane_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "obol.v1.charon.ControlPlane",
	HandlerType: (*ControlPlaneServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetSelf",
			Handler:    _ControlPlane_GetSelf_Handler,
		},
		{
			MethodName: "GetPeers",
			Handler:    _ControlPlane_GetPeers_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "api/control_plane.proto",
}

ControlPlane_ServiceDesc is the grpc.ServiceDesc for ControlPlane 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_api_control_plane_proto protoreflect.FileDescriptor

Functions

func RegisterControlPlaneHandler

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

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

func RegisterControlPlaneHandlerClient

func RegisterControlPlaneHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ControlPlaneClient) error

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

func RegisterControlPlaneHandlerFromEndpoint

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

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

func RegisterControlPlaneHandlerServer

func RegisterControlPlaneHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ControlPlaneServer) error

RegisterControlPlaneHandlerServer registers the http handlers for service ControlPlane to "mux". UnaryRPC :call ControlPlaneServer 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 RegisterControlPlaneHandlerFromEndpoint instead.

func RegisterControlPlaneServer

func RegisterControlPlaneServer(s grpc.ServiceRegistrar, srv ControlPlaneServer)

Types

type ControlPlaneClient

type ControlPlaneClient interface {
	GetSelf(ctx context.Context, in *GetSelfRequest, opts ...grpc.CallOption) (*GetSelfResponse, error)
	GetPeers(ctx context.Context, in *GetPeersRequest, opts ...grpc.CallOption) (*GetPeersResponse, error)
}

ControlPlaneClient is the client API for ControlPlane 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 ControlPlaneServer

type ControlPlaneServer interface {
	GetSelf(context.Context, *GetSelfRequest) (*GetSelfResponse, error)
	GetPeers(context.Context, *GetPeersRequest) (*GetPeersResponse, error)
	// contains filtered or unexported methods
}

ControlPlaneServer is the server API for ControlPlane service. All implementations must embed UnimplementedControlPlaneServer for forward compatibility

type GetPeersRequest

type GetPeersRequest struct {
	State *PeerConnectionState `protobuf:"varint,1,opt,name=state,proto3,enum=obol.v1.charon.PeerConnectionState,oneof" json:"state,omitempty"`
	// contains filtered or unexported fields
}

func (*GetPeersRequest) Descriptor deprecated

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

Deprecated: Use GetPeersRequest.ProtoReflect.Descriptor instead.

func (*GetPeersRequest) GetState

func (x *GetPeersRequest) GetState() PeerConnectionState

func (*GetPeersRequest) ProtoMessage

func (*GetPeersRequest) ProtoMessage()

func (*GetPeersRequest) ProtoReflect

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

func (*GetPeersRequest) Reset

func (x *GetPeersRequest) Reset()

func (*GetPeersRequest) String

func (x *GetPeersRequest) String() string

type GetPeersResponse

type GetPeersResponse struct {
	Peers []*PeerConnection `protobuf:"bytes,1,rep,name=peers,proto3" json:"peers,omitempty"`
	// contains filtered or unexported fields
}

func (*GetPeersResponse) Descriptor deprecated

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

Deprecated: Use GetPeersResponse.ProtoReflect.Descriptor instead.

func (*GetPeersResponse) GetPeers

func (x *GetPeersResponse) GetPeers() []*PeerConnection

func (*GetPeersResponse) ProtoMessage

func (*GetPeersResponse) ProtoMessage()

func (*GetPeersResponse) ProtoReflect

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

func (*GetPeersResponse) Reset

func (x *GetPeersResponse) Reset()

func (*GetPeersResponse) String

func (x *GetPeersResponse) String() string

type GetSelfRequest

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

func (*GetSelfRequest) Descriptor deprecated

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

Deprecated: Use GetSelfRequest.ProtoReflect.Descriptor instead.

func (*GetSelfRequest) ProtoMessage

func (*GetSelfRequest) ProtoMessage()

func (*GetSelfRequest) ProtoReflect

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

func (*GetSelfRequest) Reset

func (x *GetSelfRequest) Reset()

func (*GetSelfRequest) String

func (x *GetSelfRequest) String() string

type GetSelfResponse

type GetSelfResponse struct {
	Peer      *Peer                  `protobuf:"bytes,1,opt,name=peer,proto3" json:"peer,omitempty"`
	StartTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"`
	PeerCount uint32                 `protobuf:"varint,3,opt,name=peer_count,json=peerCount,proto3" json:"peer_count,omitempty"`
	// contains filtered or unexported fields
}

func (*GetSelfResponse) Descriptor deprecated

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

Deprecated: Use GetSelfResponse.ProtoReflect.Descriptor instead.

func (*GetSelfResponse) GetPeer

func (x *GetSelfResponse) GetPeer() *Peer

func (*GetSelfResponse) GetPeerCount

func (x *GetSelfResponse) GetPeerCount() uint32

func (*GetSelfResponse) GetStartTime

func (x *GetSelfResponse) GetStartTime() *timestamppb.Timestamp

func (*GetSelfResponse) ProtoMessage

func (*GetSelfResponse) ProtoMessage()

func (*GetSelfResponse) ProtoReflect

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

func (*GetSelfResponse) Reset

func (x *GetSelfResponse) Reset()

func (*GetSelfResponse) String

func (x *GetSelfResponse) String() string

type Peer

type Peer struct {
	PeerId      string                 `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"`
	ConnectTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=connect_time,json=connectTime,proto3,oneof" json:"connect_time,omitempty"`
	Version     string                 `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"`
	Enr         string                 `protobuf:"bytes,4,opt,name=enr,proto3" json:"enr,omitempty"`
	// contains filtered or unexported fields
}

func (*Peer) Descriptor deprecated

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

Deprecated: Use Peer.ProtoReflect.Descriptor instead.

func (*Peer) GetConnectTime

func (x *Peer) GetConnectTime() *timestamppb.Timestamp

func (*Peer) GetEnr

func (x *Peer) GetEnr() string

func (*Peer) GetPeerId

func (x *Peer) GetPeerId() string

func (*Peer) GetVersion

func (x *Peer) GetVersion() string

func (*Peer) ProtoMessage

func (*Peer) ProtoMessage()

func (*Peer) ProtoReflect

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

func (*Peer) Reset

func (x *Peer) Reset()

func (*Peer) String

func (x *Peer) String() string

type PeerConnection

type PeerConnection struct {
	Peer     *Peer               `protobuf:"bytes,1,opt,name=peer,proto3" json:"peer,omitempty"`
	State    PeerConnectionState `protobuf:"varint,2,opt,name=state,proto3,enum=obol.v1.charon.PeerConnectionState" json:"state,omitempty"`
	Endpoint string              `protobuf:"bytes,3,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
	Incoming bool                `protobuf:"varint,4,opt,name=incoming,proto3" json:"incoming,omitempty"`
	// contains filtered or unexported fields
}

func (*PeerConnection) Descriptor deprecated

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

Deprecated: Use PeerConnection.ProtoReflect.Descriptor instead.

func (*PeerConnection) GetEndpoint

func (x *PeerConnection) GetEndpoint() string

func (*PeerConnection) GetIncoming

func (x *PeerConnection) GetIncoming() bool

func (*PeerConnection) GetPeer

func (x *PeerConnection) GetPeer() *Peer

func (*PeerConnection) GetState

func (x *PeerConnection) GetState() PeerConnectionState

func (*PeerConnection) ProtoMessage

func (*PeerConnection) ProtoMessage()

func (*PeerConnection) ProtoReflect

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

func (*PeerConnection) Reset

func (x *PeerConnection) Reset()

func (*PeerConnection) String

func (x *PeerConnection) String() string

type PeerConnectionState

type PeerConnectionState int32
const (
	PeerConnectionState_DISCONNECTED  PeerConnectionState = 0
	PeerConnectionState_CONNECTING    PeerConnectionState = 1
	PeerConnectionState_CONNECTED     PeerConnectionState = 2
	PeerConnectionState_DISCONNECTING PeerConnectionState = 3
)

func (PeerConnectionState) Descriptor

func (PeerConnectionState) Enum

func (PeerConnectionState) EnumDescriptor deprecated

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

Deprecated: Use PeerConnectionState.Descriptor instead.

func (PeerConnectionState) Number

func (PeerConnectionState) String

func (x PeerConnectionState) String() string

func (PeerConnectionState) Type

type UnimplementedControlPlaneServer

type UnimplementedControlPlaneServer struct {
}

UnimplementedControlPlaneServer must be embedded to have forward compatible implementations.

func (UnimplementedControlPlaneServer) GetPeers

func (UnimplementedControlPlaneServer) GetSelf

type UnsafeControlPlaneServer

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

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

Directories

Path Synopsis
Package server implements the internal server.
Package server implements the internal server.

Jump to

Keyboard shortcuts

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