Documentation ¶
Overview ¶
Package peersv1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterPeerDiscoveryServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterPeerDiscoveryServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PeerDiscoveryServiceClient) error
- func RegisterPeerDiscoveryServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterPeerDiscoveryServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PeerDiscoveryServiceServer) error
- func RegisterPeerDiscoveryServiceServer(s grpc.ServiceRegistrar, srv PeerDiscoveryServiceServer)
- type Peer
- func (*Peer) Descriptor() ([]byte, []int)deprecated
- func (x *Peer) GetAddress() string
- func (x *Peer) GetHostname() string
- func (x *Peer) GetServices() map[string]string
- func (msg *Peer) MarshalJSON() ([]byte, error)
- func (m *Peer) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Peer) MarshalToVT(dAtA []byte) (int, error)
- func (m *Peer) MarshalVT() (dAtA []byte, err error)
- func (*Peer) ProtoMessage()
- func (x *Peer) ProtoReflect() protoreflect.Message
- func (x *Peer) Reset()
- func (m *Peer) SizeVT() (n int)
- func (x *Peer) String() string
- func (msg *Peer) UnmarshalJSON(b []byte) error
- func (m *Peer) UnmarshalVT(dAtA []byte) error
- func (m *Peer) Validate() error
- func (m *Peer) ValidateAll() error
- type PeerDiscoveryServiceClient
- type PeerDiscoveryServiceServer
- type PeerMultiError
- type PeerRequest
- func (*PeerRequest) Descriptor() ([]byte, []int)deprecated
- func (x *PeerRequest) GetAddress() string
- func (msg *PeerRequest) MarshalJSON() ([]byte, error)
- func (m *PeerRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *PeerRequest) MarshalToVT(dAtA []byte) (int, error)
- func (m *PeerRequest) MarshalVT() (dAtA []byte, err error)
- func (*PeerRequest) ProtoMessage()
- func (x *PeerRequest) ProtoReflect() protoreflect.Message
- func (x *PeerRequest) Reset()
- func (m *PeerRequest) SizeVT() (n int)
- func (x *PeerRequest) String() string
- func (msg *PeerRequest) UnmarshalJSON(b []byte) error
- func (m *PeerRequest) UnmarshalVT(dAtA []byte) error
- func (m *PeerRequest) Validate() error
- func (m *PeerRequest) ValidateAll() error
- type PeerRequestMultiError
- type PeerRequestValidationError
- func (e PeerRequestValidationError) Cause() error
- func (e PeerRequestValidationError) Error() string
- func (e PeerRequestValidationError) ErrorName() string
- func (e PeerRequestValidationError) Field() string
- func (e PeerRequestValidationError) Key() bool
- func (e PeerRequestValidationError) Reason() string
- type PeerValidationError
- type Peers
- func (*Peers) Descriptor() ([]byte, []int)deprecated
- func (x *Peers) GetPeers() map[string]*Peer
- func (x *Peers) GetSelfPeer() *Peer
- func (msg *Peers) MarshalJSON() ([]byte, error)
- func (m *Peers) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Peers) MarshalToVT(dAtA []byte) (int, error)
- func (m *Peers) MarshalVT() (dAtA []byte, err error)
- func (*Peers) ProtoMessage()
- func (x *Peers) ProtoReflect() protoreflect.Message
- func (x *Peers) Reset()
- func (m *Peers) SizeVT() (n int)
- func (x *Peers) String() string
- func (msg *Peers) UnmarshalJSON(b []byte) error
- func (m *Peers) UnmarshalVT(dAtA []byte) error
- func (m *Peers) Validate() error
- func (m *Peers) ValidateAll() error
- type PeersMultiError
- type PeersValidationError
- type UnimplementedPeerDiscoveryServiceServer
- type UnsafePeerDiscoveryServiceServer
Constants ¶
const ( PeerDiscoveryService_GetPeers_FullMethodName = "/aperture.peers.v1.PeerDiscoveryService/GetPeers" PeerDiscoveryService_GetPeer_FullMethodName = "/aperture.peers.v1.PeerDiscoveryService/GetPeer" )
Variables ¶
var ( ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflow = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") )
var File_aperture_peers_v1_peers_proto protoreflect.FileDescriptor
var PeerDiscoveryService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "aperture.peers.v1.PeerDiscoveryService", HandlerType: (*PeerDiscoveryServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetPeers", Handler: _PeerDiscoveryService_GetPeers_Handler, }, { MethodName: "GetPeer", Handler: _PeerDiscoveryService_GetPeer_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "aperture/peers/v1/peers.proto", }
PeerDiscoveryService_ServiceDesc is the grpc.ServiceDesc for PeerDiscoveryService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterPeerDiscoveryServiceHandler ¶
func RegisterPeerDiscoveryServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterPeerDiscoveryServiceHandler registers the http handlers for service PeerDiscoveryService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterPeerDiscoveryServiceHandlerClient ¶
func RegisterPeerDiscoveryServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PeerDiscoveryServiceClient) error
RegisterPeerDiscoveryServiceHandlerClient registers the http handlers for service PeerDiscoveryService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "PeerDiscoveryServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "PeerDiscoveryServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "PeerDiscoveryServiceClient" to call the correct interceptors.
func RegisterPeerDiscoveryServiceHandlerFromEndpoint ¶
func RegisterPeerDiscoveryServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterPeerDiscoveryServiceHandlerFromEndpoint is same as RegisterPeerDiscoveryServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterPeerDiscoveryServiceHandlerServer ¶
func RegisterPeerDiscoveryServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PeerDiscoveryServiceServer) error
RegisterPeerDiscoveryServiceHandlerServer registers the http handlers for service PeerDiscoveryService to "mux". UnaryRPC :call PeerDiscoveryServiceServer 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 RegisterPeerDiscoveryServiceHandlerFromEndpoint instead.
func RegisterPeerDiscoveryServiceServer ¶
func RegisterPeerDiscoveryServiceServer(s grpc.ServiceRegistrar, srv PeerDiscoveryServiceServer)
Types ¶
type Peer ¶
type Peer struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` Hostname string `protobuf:"bytes,2,opt,name=hostname,proto3" json:"hostname,omitempty"` Services map[string]string `` /* 157-byte string literal not displayed */ // contains filtered or unexported fields }
Peer holds peer info and services.
func (*Peer) Descriptor
deprecated
func (*Peer) GetAddress ¶
func (*Peer) GetHostname ¶
func (*Peer) GetServices ¶
func (*Peer) MarshalJSON ¶
MarshalJSON implements json.Marshaler
func (*Peer) MarshalToSizedBufferVT ¶ added in v2.7.0
func (*Peer) ProtoMessage ¶
func (*Peer) ProtoMessage()
func (*Peer) ProtoReflect ¶
func (x *Peer) ProtoReflect() protoreflect.Message
func (*Peer) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler
func (*Peer) UnmarshalVT ¶ added in v2.7.0
func (*Peer) Validate ¶
Validate checks the field values on Peer with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*Peer) ValidateAll ¶
ValidateAll checks the field values on Peer with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in PeerMultiError, or nil if none found.
type PeerDiscoveryServiceClient ¶
type PeerDiscoveryServiceClient interface { GetPeers(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*Peers, error) GetPeer(ctx context.Context, in *PeerRequest, opts ...grpc.CallOption) (*Peer, error) }
PeerDiscoveryServiceClient is the client API for PeerDiscoveryService 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 NewPeerDiscoveryServiceClient ¶
func NewPeerDiscoveryServiceClient(cc grpc.ClientConnInterface) PeerDiscoveryServiceClient
type PeerDiscoveryServiceServer ¶
type PeerDiscoveryServiceServer interface { GetPeers(context.Context, *emptypb.Empty) (*Peers, error) GetPeer(context.Context, *PeerRequest) (*Peer, error) }
PeerDiscoveryServiceServer is the server API for PeerDiscoveryService service. All implementations should embed UnimplementedPeerDiscoveryServiceServer for forward compatibility
type PeerMultiError ¶
type PeerMultiError []error
PeerMultiError is an error wrapping multiple validation errors returned by Peer.ValidateAll() if the designated constraints aren't met.
func (PeerMultiError) AllErrors ¶
func (m PeerMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (PeerMultiError) Error ¶
func (m PeerMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type PeerRequest ¶
type PeerRequest struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // contains filtered or unexported fields }
func (*PeerRequest) Descriptor
deprecated
func (*PeerRequest) Descriptor() ([]byte, []int)
Deprecated: Use PeerRequest.ProtoReflect.Descriptor instead.
func (*PeerRequest) GetAddress ¶
func (x *PeerRequest) GetAddress() string
func (*PeerRequest) MarshalJSON ¶
func (msg *PeerRequest) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler
func (*PeerRequest) MarshalToSizedBufferVT ¶ added in v2.7.0
func (m *PeerRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*PeerRequest) MarshalToVT ¶ added in v2.7.0
func (m *PeerRequest) MarshalToVT(dAtA []byte) (int, error)
func (*PeerRequest) MarshalVT ¶ added in v2.7.0
func (m *PeerRequest) MarshalVT() (dAtA []byte, err error)
func (*PeerRequest) ProtoMessage ¶
func (*PeerRequest) ProtoMessage()
func (*PeerRequest) ProtoReflect ¶
func (x *PeerRequest) ProtoReflect() protoreflect.Message
func (*PeerRequest) Reset ¶
func (x *PeerRequest) Reset()
func (*PeerRequest) SizeVT ¶ added in v2.7.0
func (m *PeerRequest) SizeVT() (n int)
func (*PeerRequest) String ¶
func (x *PeerRequest) String() string
func (*PeerRequest) UnmarshalJSON ¶
func (msg *PeerRequest) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler
func (*PeerRequest) UnmarshalVT ¶ added in v2.7.0
func (m *PeerRequest) UnmarshalVT(dAtA []byte) error
func (*PeerRequest) Validate ¶
func (m *PeerRequest) Validate() error
Validate checks the field values on PeerRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*PeerRequest) ValidateAll ¶
func (m *PeerRequest) ValidateAll() error
ValidateAll checks the field values on PeerRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in PeerRequestMultiError, or nil if none found.
type PeerRequestMultiError ¶
type PeerRequestMultiError []error
PeerRequestMultiError is an error wrapping multiple validation errors returned by PeerRequest.ValidateAll() if the designated constraints aren't met.
func (PeerRequestMultiError) AllErrors ¶
func (m PeerRequestMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (PeerRequestMultiError) Error ¶
func (m PeerRequestMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type PeerRequestValidationError ¶
type PeerRequestValidationError struct {
// contains filtered or unexported fields
}
PeerRequestValidationError is the validation error returned by PeerRequest.Validate if the designated constraints aren't met.
func (PeerRequestValidationError) Cause ¶
func (e PeerRequestValidationError) Cause() error
Cause function returns cause value.
func (PeerRequestValidationError) Error ¶
func (e PeerRequestValidationError) Error() string
Error satisfies the builtin error interface
func (PeerRequestValidationError) ErrorName ¶
func (e PeerRequestValidationError) ErrorName() string
ErrorName returns error name.
func (PeerRequestValidationError) Field ¶
func (e PeerRequestValidationError) Field() string
Field function returns field value.
func (PeerRequestValidationError) Key ¶
func (e PeerRequestValidationError) Key() bool
Key function returns key value.
func (PeerRequestValidationError) Reason ¶
func (e PeerRequestValidationError) Reason() string
Reason function returns reason value.
type PeerValidationError ¶
type PeerValidationError struct {
// contains filtered or unexported fields
}
PeerValidationError is the validation error returned by Peer.Validate if the designated constraints aren't met.
func (PeerValidationError) Cause ¶
func (e PeerValidationError) Cause() error
Cause function returns cause value.
func (PeerValidationError) Error ¶
func (e PeerValidationError) Error() string
Error satisfies the builtin error interface
func (PeerValidationError) ErrorName ¶
func (e PeerValidationError) ErrorName() string
ErrorName returns error name.
func (PeerValidationError) Field ¶
func (e PeerValidationError) Field() string
Field function returns field value.
func (PeerValidationError) Key ¶
func (e PeerValidationError) Key() bool
Key function returns key value.
func (PeerValidationError) Reason ¶
func (e PeerValidationError) Reason() string
Reason function returns reason value.
type Peers ¶
type Peers struct { SelfPeer *Peer `protobuf:"bytes,1,opt,name=self_peer,json=selfPeer,proto3" json:"self_peer,omitempty"` Peers map[string]*Peer `` /* 151-byte string literal not displayed */ // contains filtered or unexported fields }
Peers holds the peer info of this peer and a mapping of address to other peers.
func (*Peers) Descriptor
deprecated
func (*Peers) GetSelfPeer ¶
func (*Peers) MarshalJSON ¶
MarshalJSON implements json.Marshaler
func (*Peers) MarshalToSizedBufferVT ¶ added in v2.7.0
func (*Peers) ProtoMessage ¶
func (*Peers) ProtoMessage()
func (*Peers) ProtoReflect ¶
func (x *Peers) ProtoReflect() protoreflect.Message
func (*Peers) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler
func (*Peers) UnmarshalVT ¶ added in v2.7.0
func (*Peers) Validate ¶
Validate checks the field values on Peers with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*Peers) ValidateAll ¶
ValidateAll checks the field values on Peers with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in PeersMultiError, or nil if none found.
type PeersMultiError ¶
type PeersMultiError []error
PeersMultiError is an error wrapping multiple validation errors returned by Peers.ValidateAll() if the designated constraints aren't met.
func (PeersMultiError) AllErrors ¶
func (m PeersMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (PeersMultiError) Error ¶
func (m PeersMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type PeersValidationError ¶
type PeersValidationError struct {
// contains filtered or unexported fields
}
PeersValidationError is the validation error returned by Peers.Validate if the designated constraints aren't met.
func (PeersValidationError) Cause ¶
func (e PeersValidationError) Cause() error
Cause function returns cause value.
func (PeersValidationError) Error ¶
func (e PeersValidationError) Error() string
Error satisfies the builtin error interface
func (PeersValidationError) ErrorName ¶
func (e PeersValidationError) ErrorName() string
ErrorName returns error name.
func (PeersValidationError) Field ¶
func (e PeersValidationError) Field() string
Field function returns field value.
func (PeersValidationError) Key ¶
func (e PeersValidationError) Key() bool
Key function returns key value.
func (PeersValidationError) Reason ¶
func (e PeersValidationError) Reason() string
Reason function returns reason value.
type UnimplementedPeerDiscoveryServiceServer ¶
type UnimplementedPeerDiscoveryServiceServer struct { }
UnimplementedPeerDiscoveryServiceServer should be embedded to have forward compatible implementations.
func (UnimplementedPeerDiscoveryServiceServer) GetPeer ¶
func (UnimplementedPeerDiscoveryServiceServer) GetPeer(context.Context, *PeerRequest) (*Peer, error)
type UnsafePeerDiscoveryServiceServer ¶
type UnsafePeerDiscoveryServiceServer interface {
// contains filtered or unexported methods
}
UnsafePeerDiscoveryServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to PeerDiscoveryServiceServer will result in compilation errors.