Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultMeshPolicy() sctx.ContextPolicy[Metadata]
- func GenerateCertificateRequest(_ string, _ string) ([]byte, error)
- func LoadCABundle(source CertificateSource, fileOrEnvVar string) (*x509.CertPool, error)
- func NewAdmin(privateKey crypto.PrivateKey, trustedCAs *x509.CertPool) (sctx.Admin[Metadata], error)
- func NewAdminFromKeychain(ctx context.Context, keychain Keychain, id string) (sctx.Admin[Metadata], error)
- func ParseCertificateChain(pemData []byte) ([]*x509.Certificate, error)
- func RegisterMeshAuthServer(s grpc.ServiceRegistrar, srv MeshAuthServer)
- func RegisterMeshServiceServer(s grpc.ServiceRegistrar, srv MeshServiceServer)
- func StreamGuardInterceptor(registry *GuardRegistry, admin sctx.Admin[Metadata], ...) grpc.StreamServerInterceptor
- func UnaryGuardInterceptor(registry *GuardRegistry, admin sctx.Admin[Metadata], ...) grpc.UnaryServerInterceptor
- type Auditable
- type Caller
- type CertificateSource
- type FileKeychain
- type FunctionHealthChecker
- type GetTopologyRequest
- func (*GetTopologyRequest) Descriptor() ([]byte, []int)deprecated
- func (x *GetTopologyRequest) GetSenderId() string
- func (*GetTopologyRequest) ProtoMessage()
- func (x *GetTopologyRequest) ProtoReflect() protoreflect.Message
- func (x *GetTopologyRequest) Reset()
- func (x *GetTopologyRequest) String() string
- type GetTopologyResponse
- func (*GetTopologyResponse) Descriptor() ([]byte, []int)deprecated
- func (x *GetTopologyResponse) GetNodes() []*TopologyNode
- func (x *GetTopologyResponse) GetVersion() int64
- func (*GetTopologyResponse) ProtoMessage()
- func (x *GetTopologyResponse) ProtoReflect() protoreflect.Message
- func (x *GetTopologyResponse) Reset()
- func (x *GetTopologyResponse) String() string
- type GuardRegistry
- type HealthChecker
- type HealthInfo
- type HealthRequest
- type HealthResponse
- func (*HealthResponse) Descriptor() ([]byte, []int)deprecated
- func (x *HealthResponse) GetError() string
- func (x *HealthResponse) GetLastChecked() int64
- func (x *HealthResponse) GetMessage() string
- func (x *HealthResponse) GetNodeId() string
- func (x *HealthResponse) GetStatus() string
- func (*HealthResponse) ProtoMessage()
- func (x *HealthResponse) ProtoReflect() protoreflect.Message
- func (x *HealthResponse) Reset()
- func (x *HealthResponse) String() string
- type HealthStatus
- type Keychain
- type MeshAuthClient
- type MeshAuthServer
- type MeshServer
- func (ms *MeshServer) GetHealth(ctx context.Context, req *HealthRequest) (*HealthResponse, error)
- func (ms *MeshServer) GetNodeInfo(ctx context.Context, req *NodeInfoRequest) (*NodeInfoResponse, error)
- func (ms *MeshServer) GetTopology(ctx context.Context, req *GetTopologyRequest) (*GetTopologyResponse, error)
- func (ms *MeshServer) Ping(ctx context.Context, req *PingRequest) (*PingResponse, error)
- func (ms *MeshServer) RegisterService(r ServiceRegistrar)
- func (ms *MeshServer) SetAuth(admin sctx.Admin[Metadata], guards *GuardRegistry, nodeToken sctx.SignedToken)
- func (ms *MeshServer) SetTLSConfig(tlsConfig *TLSConfig)
- func (ms *MeshServer) Start() error
- func (ms *MeshServer) Stop()
- func (ms *MeshServer) SyncTopology(ctx context.Context, req *TopologySyncRequest) (*TopologySyncResponse, error)
- type MeshServiceClient
- type MeshServiceServer
- type Metadata
- type Node
- func (n *Node) AddPeer(info PeerInfo) error
- func (n *Node) CheckHealth(ctx context.Context, checker HealthChecker) error
- func (n *Node) EnableTLS(certDir string) error
- func (n *Node) GetAllPeers() []*Peer
- func (n *Node) GetHealth() (HealthStatus, string)
- func (n *Node) GetMeshNodes() []NodeInfo
- func (n *Node) GetPeer(peerID string) (*Peer, bool)
- func (n *Node) GetPeerHealth(ctx context.Context, peerID string) (*HealthResponse, error)
- func (n *Node) GetPeerNodeInfo(ctx context.Context, peerID string) (*NodeInfoResponse, error)
- func (n *Node) GetTopologyVersion() int64
- func (n *Node) Guard(method string, guard sctx.Guard)
- func (n *Node) IsHealthy() bool
- func (n *Node) MarshalJSON() ([]byte, error)
- func (n *Node) PingPeer(ctx context.Context, peerID string) (*PingResponse, error)
- func (n *Node) RemovePeer(peerID string) error
- func (n *Node) SetHealth(status HealthStatus, message string, err error)
- func (n *Node) Shutdown() error
- func (n *Node) StartServer() error
- func (n *Node) StopServer()
- func (n *Node) String() string
- func (n *Node) SyncTopology(ctx context.Context, peerID string) error
- func (n *Node) SyncTopologyWithAllPeers(ctx context.Context) error
- func (n *Node) UnmarshalJSON(data []byte) error
- func (n *Node) Validate() error
- type NodeBuilder
- func (nb *NodeBuilder) Build() (*Node, error)
- func (nb *NodeBuilder) WithAddress(address string) *NodeBuilder
- func (nb *NodeBuilder) WithAdmin(admin sctx.Admin[Metadata]) *NodeBuilder
- func (nb *NodeBuilder) WithCertDir(certDir string) *NodeBuilder
- func (nb *NodeBuilder) WithGuard(method string, guard sctx.Guard) *NodeBuilder
- func (nb *NodeBuilder) WithID(id string) *NodeBuilder
- func (nb *NodeBuilder) WithKeychain(keychain Keychain) *NodeBuilder
- func (nb *NodeBuilder) WithName(name string) *NodeBuilder
- func (nb *NodeBuilder) WithServiceRegistration(r ServiceRegistrar) *NodeBuilder
- func (nb *NodeBuilder) WithServices(services ...ServiceInfo) *NodeBuilder
- func (nb *NodeBuilder) WithTLSOptions(opts *TLSOptions) *NodeBuilder
- func (nb *NodeBuilder) WithType(nodeType NodeType) *NodeBuilder
- type NodeInfo
- type NodeInfoRequest
- type NodeInfoResponse
- func (*NodeInfoResponse) Descriptor() ([]byte, []int)deprecated
- func (x *NodeInfoResponse) GetAddress() string
- func (x *NodeInfoResponse) GetHealth() *HealthResponse
- func (x *NodeInfoResponse) GetId() string
- func (x *NodeInfoResponse) GetName() string
- func (x *NodeInfoResponse) GetType() string
- func (*NodeInfoResponse) ProtoMessage()
- func (x *NodeInfoResponse) ProtoReflect() protoreflect.Message
- func (x *NodeInfoResponse) Reset()
- func (x *NodeInfoResponse) String() string
- type NodeType
- type Peer
- type PeerInfo
- type PeerManager
- func (pm *PeerManager) AddPeer(info PeerInfo) error
- func (pm *PeerManager) Close() error
- func (pm *PeerManager) Count() int
- func (pm *PeerManager) GetAllPeers() []*Peer
- func (pm *PeerManager) GetPeer(peerID string) (*Peer, bool)
- func (pm *PeerManager) GetPeerHealth(ctx context.Context, peerID string) (*HealthResponse, error)
- func (pm *PeerManager) GetPeerNodeInfo(ctx context.Context, peerID string) (*NodeInfoResponse, error)
- func (pm *PeerManager) GetPeersByType(nodeType NodeType) []*Peer
- func (pm *PeerManager) IsConnected(peerID string) bool
- func (pm *PeerManager) PingPeer(ctx context.Context, peerID string) (*PingResponse, error)
- func (pm *PeerManager) RemovePeer(peerID string) error
- func (pm *PeerManager) SetTLSConfig(tlsConfig *TLSConfig)
- func (pm *PeerManager) SyncTopology(ctx context.Context, peerID string, version int64) (*TopologySyncResponse, error)
- type PingHealthChecker
- type PingRequest
- func (*PingRequest) Descriptor() ([]byte, []int)deprecated
- func (x *PingRequest) GetSenderId() string
- func (x *PingRequest) GetTimestamp() int64
- func (*PingRequest) ProtoMessage()
- func (x *PingRequest) ProtoReflect() protoreflect.Message
- func (x *PingRequest) Reset()
- func (x *PingRequest) String() string
- type PingResponse
- func (*PingResponse) Descriptor() ([]byte, []int)deprecated
- func (x *PingResponse) GetReceiverId() string
- func (x *PingResponse) GetSuccess() bool
- func (x *PingResponse) GetTimestamp() int64
- func (*PingResponse) ProtoMessage()
- func (x *PingResponse) ProtoReflect() protoreflect.Message
- func (x *PingResponse) Reset()
- func (x *PingResponse) String() string
- type RevokeTokenRequest
- func (*RevokeTokenRequest) Descriptor() ([]byte, []int)deprecated
- func (x *RevokeTokenRequest) GetFingerprint() string
- func (*RevokeTokenRequest) ProtoMessage()
- func (x *RevokeTokenRequest) ProtoReflect() protoreflect.Message
- func (x *RevokeTokenRequest) Reset()
- func (x *RevokeTokenRequest) String() string
- type RevokeTokenResponse
- type SecurityContext
- type Service
- type ServiceClient
- type ServiceClientPool
- type ServiceInfo
- type ServiceRegistrar
- type TLSConfig
- type TLSOptions
- type TokenExchangeRequest
- func (*TokenExchangeRequest) Descriptor() ([]byte, []int)deprecated
- func (x *TokenExchangeRequest) GetAssertion() []byte
- func (*TokenExchangeRequest) ProtoMessage()
- func (x *TokenExchangeRequest) ProtoReflect() protoreflect.Message
- func (x *TokenExchangeRequest) Reset()
- func (x *TokenExchangeRequest) String() string
- type TokenExchangeResponse
- func (*TokenExchangeResponse) Descriptor() ([]byte, []int)deprecated
- func (x *TokenExchangeResponse) GetExpiresAt() int64
- func (x *TokenExchangeResponse) GetToken() string
- func (*TokenExchangeResponse) ProtoMessage()
- func (x *TokenExchangeResponse) ProtoReflect() protoreflect.Message
- func (x *TokenExchangeResponse) Reset()
- func (x *TokenExchangeResponse) String() string
- type Topology
- func (t *Topology) AddNode(info NodeInfo) error
- func (t *Topology) Clone() *Topology
- func (t *Topology) GetAllNodes() []NodeInfo
- func (t *Topology) GetNode(nodeID string) (NodeInfo, bool)
- func (t *Topology) GetNodesByService(name string) []NodeInfo
- func (t *Topology) GetServiceProviders(name, version string) []NodeInfo
- func (t *Topology) GetVersion() int64
- func (t *Topology) Merge(other *Topology) bool
- func (t *Topology) NodeCount() int
- func (t *Topology) RemoveNode(nodeID string) error
- func (t *Topology) UpdateNode(info NodeInfo) error
- type TopologyNode
- func (*TopologyNode) Descriptor() ([]byte, []int)deprecated
- func (x *TopologyNode) GetAddress() string
- func (x *TopologyNode) GetId() string
- func (x *TopologyNode) GetJoinedAt() int64
- func (x *TopologyNode) GetName() string
- func (x *TopologyNode) GetServices() []*Service
- func (x *TopologyNode) GetType() string
- func (x *TopologyNode) GetUpdatedAt() int64
- func (*TopologyNode) ProtoMessage()
- func (x *TopologyNode) ProtoReflect() protoreflect.Message
- func (x *TopologyNode) Reset()
- func (x *TopologyNode) String() string
- type TopologySyncRequest
- func (*TopologySyncRequest) Descriptor() ([]byte, []int)deprecated
- func (x *TopologySyncRequest) GetSenderId() string
- func (x *TopologySyncRequest) GetVersion() int64
- func (*TopologySyncRequest) ProtoMessage()
- func (x *TopologySyncRequest) ProtoReflect() protoreflect.Message
- func (x *TopologySyncRequest) Reset()
- func (x *TopologySyncRequest) String() string
- type TopologySyncResponse
- func (*TopologySyncResponse) Descriptor() ([]byte, []int)deprecated
- func (x *TopologySyncResponse) GetNodes() []*TopologyNode
- func (x *TopologySyncResponse) GetUpdatedAt() int64
- func (x *TopologySyncResponse) GetVersion() int64
- func (*TopologySyncResponse) ProtoMessage()
- func (x *TopologySyncResponse) ProtoReflect() protoreflect.Message
- func (x *TopologySyncResponse) Reset()
- func (x *TopologySyncResponse) String() string
- type UnimplementedMeshAuthServer
- type UnimplementedMeshServiceServer
- func (UnimplementedMeshServiceServer) GetHealth(context.Context, *HealthRequest) (*HealthResponse, error)
- func (UnimplementedMeshServiceServer) GetNodeInfo(context.Context, *NodeInfoRequest) (*NodeInfoResponse, error)
- func (UnimplementedMeshServiceServer) GetTopology(context.Context, *GetTopologyRequest) (*GetTopologyResponse, error)
- func (UnimplementedMeshServiceServer) Ping(context.Context, *PingRequest) (*PingResponse, error)
- func (UnimplementedMeshServiceServer) SyncTopology(context.Context, *TopologySyncRequest) (*TopologySyncResponse, error)
- type UnsafeMeshAuthServer
- type UnsafeMeshServiceServer
Constants ¶
const ( MeshAuth_ExchangeToken_FullMethodName = "/aegis.MeshAuth/ExchangeToken" MeshAuth_RevokeToken_FullMethodName = "/aegis.MeshAuth/RevokeToken" )
const ( MeshService_Ping_FullMethodName = "/aegis.MeshService/Ping" MeshService_GetHealth_FullMethodName = "/aegis.MeshService/GetHealth" MeshService_GetNodeInfo_FullMethodName = "/aegis.MeshService/GetNodeInfo" MeshService_SyncTopology_FullMethodName = "/aegis.MeshService/SyncTopology" MeshService_GetTopology_FullMethodName = "/aegis.MeshService/GetTopology" )
Variables ¶
var ( // ErrNoProviders is returned when no providers are found for a service. ErrNoProviders = errors.New("no providers available for service") // ErrNoTLSConfig is returned when the node has no TLS configuration. ErrNoTLSConfig = errors.New("node has no TLS configuration") )
var ( // ErrNoPeerInfo is returned when no peer info is found in context. ErrNoPeerInfo = errors.New("no peer info in context") // ErrNoTLSInfo is returned when the peer has no TLS info. ErrNoTLSInfo = errors.New("no TLS info in peer") // ErrNoCertificate is returned when no client certificate is present. ErrNoCertificate = errors.New("no client certificate") )
var File_mesh_auth_proto protoreflect.FileDescriptor
var File_mesh_proto protoreflect.FileDescriptor
var MeshAuth_ServiceDesc = grpc.ServiceDesc{ ServiceName: "aegis.MeshAuth", HandlerType: (*MeshAuthServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "ExchangeToken", Handler: _MeshAuth_ExchangeToken_Handler, }, { MethodName: "RevokeToken", Handler: _MeshAuth_RevokeToken_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "mesh_auth.proto", }
MeshAuth_ServiceDesc is the grpc.ServiceDesc for MeshAuth service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var MeshService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "aegis.MeshService", HandlerType: (*MeshServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Ping", Handler: _MeshService_Ping_Handler, }, { MethodName: "GetHealth", Handler: _MeshService_GetHealth_Handler, }, { MethodName: "GetNodeInfo", Handler: _MeshService_GetNodeInfo_Handler, }, { MethodName: "SyncTopology", Handler: _MeshService_SyncTopology_Handler, }, { MethodName: "GetTopology", Handler: _MeshService_GetTopology_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "mesh.proto", }
MeshService_ServiceDesc is the grpc.ServiceDesc for MeshService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func DefaultMeshPolicy ¶ added in v0.0.5
func DefaultMeshPolicy() sctx.ContextPolicy[Metadata]
DefaultMeshPolicy returns a ContextPolicy that populates Metadata from certificate fields. CN → NodeID, O (first) → ServiceName.
func GenerateCertificateRequest ¶
GenerateCertificateRequest generates a CSR for external CA signing.
func LoadCABundle ¶
func LoadCABundle(source CertificateSource, fileOrEnvVar string) (*x509.CertPool, error)
LoadCABundle loads a CA bundle from file or environment
func NewAdmin ¶ added in v0.0.5
func NewAdmin(privateKey crypto.PrivateKey, trustedCAs *x509.CertPool) (sctx.Admin[Metadata], error)
NewAdmin creates an sctx.Admin[Metadata] from a private key and trusted CA pool.
func NewAdminFromKeychain ¶ added in v0.0.5
func NewAdminFromKeychain(ctx context.Context, keychain Keychain, id string) (sctx.Admin[Metadata], error)
NewAdminFromKeychain creates an Admin by loading keys from a Keychain.
func ParseCertificateChain ¶
func ParseCertificateChain(pemData []byte) ([]*x509.Certificate, error)
ParseCertificateChain parses a PEM certificate chain
func RegisterMeshAuthServer ¶ added in v0.0.5
func RegisterMeshAuthServer(s grpc.ServiceRegistrar, srv MeshAuthServer)
func RegisterMeshServiceServer ¶
func RegisterMeshServiceServer(s grpc.ServiceRegistrar, srv MeshServiceServer)
func StreamGuardInterceptor ¶ added in v0.0.5
func StreamGuardInterceptor(registry *GuardRegistry, admin sctx.Admin[Metadata], nodeToken sctx.SignedToken) grpc.StreamServerInterceptor
StreamGuardInterceptor returns a gRPC stream interceptor that validates tokens against guards.
func UnaryGuardInterceptor ¶ added in v0.0.5
func UnaryGuardInterceptor(registry *GuardRegistry, admin sctx.Admin[Metadata], nodeToken sctx.SignedToken) grpc.UnaryServerInterceptor
UnaryGuardInterceptor returns a gRPC unary interceptor that validates tokens against guards. Unguarded methods (no guard registered) pass through — protected by mTLS alone.
Types ¶
type Auditable ¶ added in v0.0.10
type Auditable interface {
Action() string
ResourceType() string
ResourceID() string
TenantID() string
ActorID() string
Message() string
Attributes() map[string]string
}
Auditable defines the contract for events that can be recorded as domain events. Source app event types implement this so the herald aegis provider can extract structured envelope fields for indexing.
type Caller ¶
type Caller struct {
NodeID string
Certificate *x509.Certificate
}
Caller represents the identity of a calling node.
func CallerFromContext ¶
CallerFromContext extracts the caller's identity from the gRPC context. The caller's node ID is extracted from the client certificate's Common Name.
func MustCallerFromContext ¶
MustCallerFromContext extracts the caller's identity, panicking on error. Use only when mTLS is guaranteed (e.g., after middleware validation).
type CertificateSource ¶
type CertificateSource string
CertificateSource defines how certificates are loaded
const ( // CertSourceFile loads certificates from files CertSourceFile CertificateSource = "file" // CertSourceEnv loads certificates from environment variables CertSourceEnv CertificateSource = "env" // CertSourceVault loads certificates from HashiCorp Vault (future) CertSourceVault CertificateSource = "vault" )
type FileKeychain ¶ added in v0.0.5
type FileKeychain struct {
// contains filtered or unexported fields
}
FileKeychain loads keys and certificates from PEM files on disk.
func NewFileKeychain ¶ added in v0.0.5
func NewFileKeychain(dir string) *FileKeychain
NewFileKeychain creates a Keychain that loads from the given directory. Keys are expected at {dir}/{id}-key.pem, certificates at {dir}/{id}-cert.pem.
func (*FileKeychain) LoadCertificate ¶ added in v0.0.5
func (fk *FileKeychain) LoadCertificate(_ context.Context, id string) (*x509.Certificate, error)
LoadCertificate loads a PEM-encoded certificate from {dir}/{id}-cert.pem.
func (*FileKeychain) LoadPrivateKey ¶ added in v0.0.5
func (fk *FileKeychain) LoadPrivateKey(_ context.Context, id string) (crypto.PrivateKey, error)
LoadPrivateKey loads a PEM-encoded private key from {dir}/{id}-key.pem.
func (*FileKeychain) LoadTrustedCAs ¶ added in v0.0.5
LoadTrustedCAs loads a PEM-encoded CA certificate pool from {dir}/ca-cert.pem.
type FunctionHealthChecker ¶
type FunctionHealthChecker struct {
// contains filtered or unexported fields
}
FunctionHealthChecker performs health checks using a custom function.
func NewFunctionHealthChecker ¶
func NewFunctionHealthChecker(name string, checkFn func(ctx context.Context) error) *FunctionHealthChecker
NewFunctionHealthChecker creates a new function-based health checker.
func (*FunctionHealthChecker) Check ¶
func (f *FunctionHealthChecker) Check(ctx context.Context) error
func (*FunctionHealthChecker) Name ¶
func (f *FunctionHealthChecker) Name() string
type GetTopologyRequest ¶
type GetTopologyRequest struct {
SenderId string `protobuf:"bytes,1,opt,name=sender_id,json=senderId,proto3" json:"sender_id,omitempty"`
// contains filtered or unexported fields
}
func (*GetTopologyRequest) Descriptor
deprecated
func (*GetTopologyRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetTopologyRequest.ProtoReflect.Descriptor instead.
func (*GetTopologyRequest) GetSenderId ¶
func (x *GetTopologyRequest) GetSenderId() string
func (*GetTopologyRequest) ProtoMessage ¶
func (*GetTopologyRequest) ProtoMessage()
func (*GetTopologyRequest) ProtoReflect ¶
func (x *GetTopologyRequest) ProtoReflect() protoreflect.Message
func (*GetTopologyRequest) Reset ¶
func (x *GetTopologyRequest) Reset()
func (*GetTopologyRequest) String ¶
func (x *GetTopologyRequest) String() string
type GetTopologyResponse ¶
type GetTopologyResponse struct {
Version int64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"`
Nodes []*TopologyNode `protobuf:"bytes,2,rep,name=nodes,proto3" json:"nodes,omitempty"`
// contains filtered or unexported fields
}
func (*GetTopologyResponse) Descriptor
deprecated
func (*GetTopologyResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetTopologyResponse.ProtoReflect.Descriptor instead.
func (*GetTopologyResponse) GetNodes ¶
func (x *GetTopologyResponse) GetNodes() []*TopologyNode
func (*GetTopologyResponse) GetVersion ¶
func (x *GetTopologyResponse) GetVersion() int64
func (*GetTopologyResponse) ProtoMessage ¶
func (*GetTopologyResponse) ProtoMessage()
func (*GetTopologyResponse) ProtoReflect ¶
func (x *GetTopologyResponse) ProtoReflect() protoreflect.Message
func (*GetTopologyResponse) Reset ¶
func (x *GetTopologyResponse) Reset()
func (*GetTopologyResponse) String ¶
func (x *GetTopologyResponse) String() string
type GuardRegistry ¶ added in v0.0.5
type GuardRegistry struct {
// contains filtered or unexported fields
}
GuardRegistry maps gRPC method names to guards.
func NewGuardRegistry ¶ added in v0.0.5
func NewGuardRegistry() *GuardRegistry
NewGuardRegistry creates an empty guard registry.
func (*GuardRegistry) Get ¶ added in v0.0.5
func (gr *GuardRegistry) Get(method string) sctx.Guard
Get returns the guard for a method, or nil if unguarded.
func (*GuardRegistry) Len ¶ added in v0.0.5
func (gr *GuardRegistry) Len() int
Len returns the number of registered guards.
type HealthChecker ¶
HealthChecker defines the interface for health check implementations.
type HealthInfo ¶
type HealthInfo struct {
Status HealthStatus `json:"status"`
LastChecked time.Time `json:"last_checked"`
Message string `json:"message,omitempty"`
Error string `json:"error,omitempty"`
// contains filtered or unexported fields
}
HealthInfo contains health status information for a node.
func NewHealthInfo ¶
func NewHealthInfo() *HealthInfo
NewHealthInfo creates a new health info with unknown status.
func (*HealthInfo) Get ¶
func (h *HealthInfo) Get() (HealthStatus, time.Time, string, string)
func (*HealthInfo) IsHealthy ¶
func (h *HealthInfo) IsHealthy() bool
func (*HealthInfo) String ¶
func (h *HealthInfo) String() string
func (*HealthInfo) Update ¶
func (h *HealthInfo) Update(status HealthStatus, message string, err error)
type HealthRequest ¶
type HealthRequest struct {
SenderId string `protobuf:"bytes,1,opt,name=sender_id,json=senderId,proto3" json:"sender_id,omitempty"`
// contains filtered or unexported fields
}
func (*HealthRequest) Descriptor
deprecated
func (*HealthRequest) Descriptor() ([]byte, []int)
Deprecated: Use HealthRequest.ProtoReflect.Descriptor instead.
func (*HealthRequest) GetSenderId ¶
func (x *HealthRequest) GetSenderId() string
func (*HealthRequest) ProtoMessage ¶
func (*HealthRequest) ProtoMessage()
func (*HealthRequest) ProtoReflect ¶
func (x *HealthRequest) ProtoReflect() protoreflect.Message
func (*HealthRequest) Reset ¶
func (x *HealthRequest) Reset()
func (*HealthRequest) String ¶
func (x *HealthRequest) String() string
type HealthResponse ¶
type HealthResponse struct {
NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"`
Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
LastChecked int64 `protobuf:"varint,3,opt,name=last_checked,json=lastChecked,proto3" json:"last_checked,omitempty"`
Message string `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"`
Error string `protobuf:"bytes,5,opt,name=error,proto3" json:"error,omitempty"`
// contains filtered or unexported fields
}
func (*HealthResponse) Descriptor
deprecated
func (*HealthResponse) Descriptor() ([]byte, []int)
Deprecated: Use HealthResponse.ProtoReflect.Descriptor instead.
func (*HealthResponse) GetError ¶
func (x *HealthResponse) GetError() string
func (*HealthResponse) GetLastChecked ¶
func (x *HealthResponse) GetLastChecked() int64
func (*HealthResponse) GetMessage ¶
func (x *HealthResponse) GetMessage() string
func (*HealthResponse) GetNodeId ¶
func (x *HealthResponse) GetNodeId() string
func (*HealthResponse) GetStatus ¶
func (x *HealthResponse) GetStatus() string
func (*HealthResponse) ProtoMessage ¶
func (*HealthResponse) ProtoMessage()
func (*HealthResponse) ProtoReflect ¶
func (x *HealthResponse) ProtoReflect() protoreflect.Message
func (*HealthResponse) Reset ¶
func (x *HealthResponse) Reset()
func (*HealthResponse) String ¶
func (x *HealthResponse) String() string
type HealthStatus ¶
type HealthStatus string
HealthStatus represents the health state of a node.
const ( HealthStatusHealthy HealthStatus = "healthy" HealthStatusUnhealthy HealthStatus = "unhealthy" HealthStatusUnknown HealthStatus = "unknown" )
type Keychain ¶ added in v0.0.5
type Keychain interface {
LoadPrivateKey(ctx context.Context, id string) (crypto.PrivateKey, error)
LoadCertificate(ctx context.Context, id string) (*x509.Certificate, error)
LoadTrustedCAs(ctx context.Context) (*x509.CertPool, error)
}
Keychain loads cryptographic keys and certificates from infrastructure.
type MeshAuthClient ¶ added in v0.0.5
type MeshAuthClient interface {
// ExchangeToken exchanges a signed assertion for a service token.
// The caller's certificate is extracted from the mTLS context.
ExchangeToken(ctx context.Context, in *TokenExchangeRequest, opts ...grpc.CallOption) (*TokenExchangeResponse, error)
// RevokeToken revokes a token by certificate fingerprint.
RevokeToken(ctx context.Context, in *RevokeTokenRequest, opts ...grpc.CallOption) (*RevokeTokenResponse, error)
}
MeshAuthClient is the client API for MeshAuth 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.
MeshAuth provides service-level authentication on the mesh. Every node runs this service. Callers connect over mTLS, present a SignedAssertion proving private key possession, and receive a short-lived SignedToken for subsequent RPC calls.
func NewMeshAuthClient ¶ added in v0.0.5
func NewMeshAuthClient(cc grpc.ClientConnInterface) MeshAuthClient
type MeshAuthServer ¶ added in v0.0.5
type MeshAuthServer interface {
// ExchangeToken exchanges a signed assertion for a service token.
// The caller's certificate is extracted from the mTLS context.
ExchangeToken(context.Context, *TokenExchangeRequest) (*TokenExchangeResponse, error)
// RevokeToken revokes a token by certificate fingerprint.
RevokeToken(context.Context, *RevokeTokenRequest) (*RevokeTokenResponse, error)
// contains filtered or unexported methods
}
MeshAuthServer is the server API for MeshAuth service. All implementations must embed UnimplementedMeshAuthServer for forward compatibility.
MeshAuth provides service-level authentication on the mesh. Every node runs this service. Callers connect over mTLS, present a SignedAssertion proving private key possession, and receive a short-lived SignedToken for subsequent RPC calls.
func NewMeshAuthService ¶ added in v0.0.5
func NewMeshAuthService(admin sctx.Admin[Metadata]) MeshAuthServer
NewMeshAuthService creates a new MeshAuth service backed by the given Admin.
type MeshServer ¶
type MeshServer struct {
UnimplementedMeshServiceServer
// contains filtered or unexported fields
}
MeshServer handles gRPC mesh service requests.
func NewMeshServer ¶
func NewMeshServer(node *Node) *MeshServer
NewMeshServer creates a new mesh server for the node.
func (*MeshServer) GetHealth ¶
func (ms *MeshServer) GetHealth(ctx context.Context, req *HealthRequest) (*HealthResponse, error)
GetHealth returns the health status of this node.
func (*MeshServer) GetNodeInfo ¶
func (ms *MeshServer) GetNodeInfo(ctx context.Context, req *NodeInfoRequest) (*NodeInfoResponse, error)
GetNodeInfo returns information about this node.
func (*MeshServer) GetTopology ¶
func (ms *MeshServer) GetTopology(ctx context.Context, req *GetTopologyRequest) (*GetTopologyResponse, error)
GetTopology returns the current topology.
func (*MeshServer) Ping ¶
func (ms *MeshServer) Ping(ctx context.Context, req *PingRequest) (*PingResponse, error)
Ping responds to ping requests.
func (*MeshServer) RegisterService ¶
func (ms *MeshServer) RegisterService(r ServiceRegistrar)
RegisterService adds a service registrar to be called when the server starts.
func (*MeshServer) SetAuth ¶ added in v0.0.5
func (ms *MeshServer) SetAuth(admin sctx.Admin[Metadata], guards *GuardRegistry, nodeToken sctx.SignedToken)
SetAuth configures auth for the server, enabling guard interceptors.
func (*MeshServer) SetTLSConfig ¶
func (ms *MeshServer) SetTLSConfig(tlsConfig *TLSConfig)
SetTLSConfig sets the TLS configuration for the server.
func (*MeshServer) SyncTopology ¶
func (ms *MeshServer) SyncTopology(ctx context.Context, req *TopologySyncRequest) (*TopologySyncResponse, error)
SyncTopology handles topology synchronization requests.
type MeshServiceClient ¶
type MeshServiceClient interface {
// Core mesh primitives
Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error)
GetHealth(ctx context.Context, in *HealthRequest, opts ...grpc.CallOption) (*HealthResponse, error)
GetNodeInfo(ctx context.Context, in *NodeInfoRequest, opts ...grpc.CallOption) (*NodeInfoResponse, error)
// Topology operations
SyncTopology(ctx context.Context, in *TopologySyncRequest, opts ...grpc.CallOption) (*TopologySyncResponse, error)
GetTopology(ctx context.Context, in *GetTopologyRequest, opts ...grpc.CallOption) (*GetTopologyResponse, error)
}
MeshServiceClient is the client API for MeshService 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 NewMeshServiceClient ¶
func NewMeshServiceClient(cc grpc.ClientConnInterface) MeshServiceClient
type MeshServiceServer ¶
type MeshServiceServer interface {
// Core mesh primitives
Ping(context.Context, *PingRequest) (*PingResponse, error)
GetHealth(context.Context, *HealthRequest) (*HealthResponse, error)
GetNodeInfo(context.Context, *NodeInfoRequest) (*NodeInfoResponse, error)
// Topology operations
SyncTopology(context.Context, *TopologySyncRequest) (*TopologySyncResponse, error)
GetTopology(context.Context, *GetTopologyRequest) (*GetTopologyResponse, error)
// contains filtered or unexported methods
}
MeshServiceServer is the server API for MeshService service. All implementations must embed UnimplementedMeshServiceServer for forward compatibility.
type Metadata ¶ added in v0.0.5
Metadata carries the calling service's mesh-level identity. This is the M type parameter for sctx.Context[M] across all mesh services.
type Node ¶
type Node struct {
ID string `json:"id"`
Name string `json:"name"`
Type NodeType `json:"type"`
Address string `json:"address"`
Services []ServiceInfo `json:"services,omitempty"`
Health *HealthInfo `json:"health"`
PeerManager *PeerManager `json:"-"`
MeshServer *MeshServer `json:"-"`
Topology *Topology `json:"-"`
TLSConfig *TLSConfig `json:"-"`
Admin sctx.Admin[Metadata] `json:"-"`
Guards *GuardRegistry `json:"-"`
// contains filtered or unexported fields
}
Node represents a node in the mesh network.
func NewSecureNode ¶
NewSecureNode is a convenience function that creates a node with TLS enabled.
func (*Node) CheckHealth ¶
func (n *Node) CheckHealth(ctx context.Context, checker HealthChecker) error
CheckHealth runs a health check using the provided checker.
func (*Node) EnableTLS ¶
EnableTLS enables TLS for the node using the specified certificate directory.
func (*Node) GetAllPeers ¶
GetAllPeers returns all connected peers.
func (*Node) GetHealth ¶
func (n *Node) GetHealth() (HealthStatus, string)
GetHealth returns the node's health status and message.
func (*Node) GetMeshNodes ¶
GetMeshNodes returns all nodes in the topology.
func (*Node) GetPeerHealth ¶
GetPeerHealth retrieves the health status of a peer.
func (*Node) GetPeerNodeInfo ¶
GetPeerNodeInfo retrieves node information from a peer.
func (*Node) GetTopologyVersion ¶
GetTopologyVersion returns the current topology version.
func (*Node) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*Node) RemovePeer ¶
RemovePeer removes a peer connection.
func (*Node) SetHealth ¶
func (n *Node) SetHealth(status HealthStatus, message string, err error)
SetHealth updates the node's health status.
func (*Node) StartServer ¶
StartServer starts the gRPC mesh server.
func (*Node) SyncTopology ¶
SyncTopology synchronizes topology with a specific peer.
func (*Node) SyncTopologyWithAllPeers ¶
SyncTopologyWithAllPeers synchronizes topology with all connected peers.
func (*Node) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type NodeBuilder ¶
type NodeBuilder struct {
// contains filtered or unexported fields
}
NodeBuilder provides a fluent interface for creating nodes with required TLS.
func (*NodeBuilder) Build ¶
func (nb *NodeBuilder) Build() (*Node, error)
Build creates the node with TLS enabled.
func (*NodeBuilder) WithAddress ¶
func (nb *NodeBuilder) WithAddress(address string) *NodeBuilder
WithAddress sets the node address.
func (*NodeBuilder) WithAdmin ¶ added in v0.0.5
func (nb *NodeBuilder) WithAdmin(admin sctx.Admin[Metadata]) *NodeBuilder
WithAdmin sets a pre-built Admin for the node.
func (*NodeBuilder) WithCertDir ¶
func (nb *NodeBuilder) WithCertDir(certDir string) *NodeBuilder
WithCertDir sets the certificate directory.
func (*NodeBuilder) WithGuard ¶ added in v0.0.5
func (nb *NodeBuilder) WithGuard(method string, guard sctx.Guard) *NodeBuilder
WithGuard registers a guard for a gRPC method.
func (*NodeBuilder) WithID ¶
func (nb *NodeBuilder) WithID(id string) *NodeBuilder
WithID sets the node ID.
func (*NodeBuilder) WithKeychain ¶ added in v0.0.5
func (nb *NodeBuilder) WithKeychain(keychain Keychain) *NodeBuilder
WithKeychain sets the keychain for loading signing keys.
func (*NodeBuilder) WithName ¶
func (nb *NodeBuilder) WithName(name string) *NodeBuilder
WithName sets the node name.
func (*NodeBuilder) WithServiceRegistration ¶
func (nb *NodeBuilder) WithServiceRegistration(r ServiceRegistrar) *NodeBuilder
WithServiceRegistration adds a callback to register gRPC services on the server.
func (*NodeBuilder) WithServices ¶
func (nb *NodeBuilder) WithServices(services ...ServiceInfo) *NodeBuilder
WithServices sets the services this node provides.
func (*NodeBuilder) WithTLSOptions ¶
func (nb *NodeBuilder) WithTLSOptions(opts *TLSOptions) *NodeBuilder
WithTLSOptions sets custom TLS options.
func (*NodeBuilder) WithType ¶
func (nb *NodeBuilder) WithType(nodeType NodeType) *NodeBuilder
WithType sets the node type.
type NodeInfo ¶
type NodeInfo struct {
ID string `json:"id"`
Name string `json:"name"`
Type NodeType `json:"type"`
Address string `json:"address"`
Services []ServiceInfo `json:"services,omitempty"`
JoinedAt time.Time `json:"joined_at"`
UpdatedAt time.Time `json:"updated_at"`
}
NodeInfo contains information about a node in the mesh topology.
type NodeInfoRequest ¶
type NodeInfoRequest struct {
SenderId string `protobuf:"bytes,1,opt,name=sender_id,json=senderId,proto3" json:"sender_id,omitempty"`
// contains filtered or unexported fields
}
func (*NodeInfoRequest) Descriptor
deprecated
func (*NodeInfoRequest) Descriptor() ([]byte, []int)
Deprecated: Use NodeInfoRequest.ProtoReflect.Descriptor instead.
func (*NodeInfoRequest) GetSenderId ¶
func (x *NodeInfoRequest) GetSenderId() string
func (*NodeInfoRequest) ProtoMessage ¶
func (*NodeInfoRequest) ProtoMessage()
func (*NodeInfoRequest) ProtoReflect ¶
func (x *NodeInfoRequest) ProtoReflect() protoreflect.Message
func (*NodeInfoRequest) Reset ¶
func (x *NodeInfoRequest) Reset()
func (*NodeInfoRequest) String ¶
func (x *NodeInfoRequest) String() string
type NodeInfoResponse ¶
type NodeInfoResponse struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
Address string `protobuf:"bytes,4,opt,name=address,proto3" json:"address,omitempty"`
Health *HealthResponse `protobuf:"bytes,5,opt,name=health,proto3" json:"health,omitempty"`
// contains filtered or unexported fields
}
func (*NodeInfoResponse) Descriptor
deprecated
func (*NodeInfoResponse) Descriptor() ([]byte, []int)
Deprecated: Use NodeInfoResponse.ProtoReflect.Descriptor instead.
func (*NodeInfoResponse) GetAddress ¶
func (x *NodeInfoResponse) GetAddress() string
func (*NodeInfoResponse) GetHealth ¶
func (x *NodeInfoResponse) GetHealth() *HealthResponse
func (*NodeInfoResponse) GetId ¶
func (x *NodeInfoResponse) GetId() string
func (*NodeInfoResponse) GetName ¶
func (x *NodeInfoResponse) GetName() string
func (*NodeInfoResponse) GetType ¶
func (x *NodeInfoResponse) GetType() string
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 NodeType ¶
type NodeType string
NodeType represents the type of node in the mesh.
const ( // NodeTypeGeneric is the default node type. NodeTypeGeneric NodeType = "generic" )
type Peer ¶
type Peer struct {
Info PeerInfo
Client MeshServiceClient
Conn *grpc.ClientConn
}
Peer represents a connected peer node.
type PeerInfo ¶
type PeerInfo struct {
ID string `json:"id"`
Address string `json:"address"`
Type NodeType `json:"type"`
}
PeerInfo contains information about a peer node.
type PeerManager ¶
type PeerManager struct {
// contains filtered or unexported fields
}
PeerManager manages connections to peer nodes.
func NewPeerManager ¶
func NewPeerManager(nodeID string) *PeerManager
NewPeerManager creates a new peer manager.
func (*PeerManager) AddPeer ¶
func (pm *PeerManager) AddPeer(info PeerInfo) error
AddPeer adds a new peer connection.
func (*PeerManager) Count ¶
func (pm *PeerManager) Count() int
Count returns the number of connected peers.
func (*PeerManager) GetAllPeers ¶
func (pm *PeerManager) GetAllPeers() []*Peer
GetAllPeers returns all connected peers.
func (*PeerManager) GetPeer ¶
func (pm *PeerManager) GetPeer(peerID string) (*Peer, bool)
GetPeer returns a peer by ID.
func (*PeerManager) GetPeerHealth ¶
func (pm *PeerManager) GetPeerHealth(ctx context.Context, peerID string) (*HealthResponse, error)
GetPeerHealth retrieves the health status of a peer.
func (*PeerManager) GetPeerNodeInfo ¶
func (pm *PeerManager) GetPeerNodeInfo(ctx context.Context, peerID string) (*NodeInfoResponse, error)
GetPeerNodeInfo retrieves node information from a peer.
func (*PeerManager) GetPeersByType ¶
func (pm *PeerManager) GetPeersByType(nodeType NodeType) []*Peer
GetPeersByType returns peers of a specific type.
func (*PeerManager) IsConnected ¶
func (pm *PeerManager) IsConnected(peerID string) bool
IsConnected checks if a peer connection is in READY state.
func (*PeerManager) PingPeer ¶
func (pm *PeerManager) PingPeer(ctx context.Context, peerID string) (*PingResponse, error)
PingPeer sends a ping request to a peer.
func (*PeerManager) RemovePeer ¶
func (pm *PeerManager) RemovePeer(peerID string) error
RemovePeer removes a peer connection.
func (*PeerManager) SetTLSConfig ¶
func (pm *PeerManager) SetTLSConfig(tlsConfig *TLSConfig)
SetTLSConfig sets the TLS configuration for peer connections.
func (*PeerManager) SyncTopology ¶
func (pm *PeerManager) SyncTopology(ctx context.Context, peerID string, version int64) (*TopologySyncResponse, error)
SyncTopology requests topology synchronization from a peer.
type PingHealthChecker ¶
type PingHealthChecker struct {
// contains filtered or unexported fields
}
PingHealthChecker performs simple ping-based health checks.
func NewPingHealthChecker ¶
func NewPingHealthChecker(name string) *PingHealthChecker
NewPingHealthChecker creates a new ping-based health checker.
func (*PingHealthChecker) Name ¶
func (p *PingHealthChecker) Name() string
type PingRequest ¶
type PingRequest struct {
SenderId string `protobuf:"bytes,1,opt,name=sender_id,json=senderId,proto3" json:"sender_id,omitempty"`
Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
// contains filtered or unexported fields
}
func (*PingRequest) Descriptor
deprecated
func (*PingRequest) Descriptor() ([]byte, []int)
Deprecated: Use PingRequest.ProtoReflect.Descriptor instead.
func (*PingRequest) GetSenderId ¶
func (x *PingRequest) GetSenderId() string
func (*PingRequest) GetTimestamp ¶
func (x *PingRequest) GetTimestamp() int64
func (*PingRequest) ProtoMessage ¶
func (*PingRequest) ProtoMessage()
func (*PingRequest) ProtoReflect ¶
func (x *PingRequest) ProtoReflect() protoreflect.Message
func (*PingRequest) Reset ¶
func (x *PingRequest) Reset()
func (*PingRequest) String ¶
func (x *PingRequest) String() string
type PingResponse ¶
type PingResponse struct {
ReceiverId string `protobuf:"bytes,1,opt,name=receiver_id,json=receiverId,proto3" json:"receiver_id,omitempty"`
Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
Success bool `protobuf:"varint,3,opt,name=success,proto3" json:"success,omitempty"`
// contains filtered or unexported fields
}
func (*PingResponse) Descriptor
deprecated
func (*PingResponse) Descriptor() ([]byte, []int)
Deprecated: Use PingResponse.ProtoReflect.Descriptor instead.
func (*PingResponse) GetReceiverId ¶
func (x *PingResponse) GetReceiverId() string
func (*PingResponse) GetSuccess ¶
func (x *PingResponse) GetSuccess() bool
func (*PingResponse) GetTimestamp ¶
func (x *PingResponse) GetTimestamp() int64
func (*PingResponse) ProtoMessage ¶
func (*PingResponse) ProtoMessage()
func (*PingResponse) ProtoReflect ¶
func (x *PingResponse) ProtoReflect() protoreflect.Message
func (*PingResponse) Reset ¶
func (x *PingResponse) Reset()
func (*PingResponse) String ¶
func (x *PingResponse) String() string
type RevokeTokenRequest ¶ added in v0.0.5
type RevokeTokenRequest struct {
Fingerprint string `protobuf:"bytes,1,opt,name=fingerprint,proto3" json:"fingerprint,omitempty"`
// contains filtered or unexported fields
}
RevokeTokenRequest identifies the token to revoke by certificate fingerprint.
func (*RevokeTokenRequest) Descriptor
deprecated
added in
v0.0.5
func (*RevokeTokenRequest) Descriptor() ([]byte, []int)
Deprecated: Use RevokeTokenRequest.ProtoReflect.Descriptor instead.
func (*RevokeTokenRequest) GetFingerprint ¶ added in v0.0.5
func (x *RevokeTokenRequest) GetFingerprint() string
func (*RevokeTokenRequest) ProtoMessage ¶ added in v0.0.5
func (*RevokeTokenRequest) ProtoMessage()
func (*RevokeTokenRequest) ProtoReflect ¶ added in v0.0.5
func (x *RevokeTokenRequest) ProtoReflect() protoreflect.Message
func (*RevokeTokenRequest) Reset ¶ added in v0.0.5
func (x *RevokeTokenRequest) Reset()
func (*RevokeTokenRequest) String ¶ added in v0.0.5
func (x *RevokeTokenRequest) String() string
type RevokeTokenResponse ¶ added in v0.0.5
type RevokeTokenResponse struct {
// contains filtered or unexported fields
}
RevokeTokenResponse is empty on success; errors use gRPC status.
func (*RevokeTokenResponse) Descriptor
deprecated
added in
v0.0.5
func (*RevokeTokenResponse) Descriptor() ([]byte, []int)
Deprecated: Use RevokeTokenResponse.ProtoReflect.Descriptor instead.
func (*RevokeTokenResponse) ProtoMessage ¶ added in v0.0.5
func (*RevokeTokenResponse) ProtoMessage()
func (*RevokeTokenResponse) ProtoReflect ¶ added in v0.0.5
func (x *RevokeTokenResponse) ProtoReflect() protoreflect.Message
func (*RevokeTokenResponse) Reset ¶ added in v0.0.5
func (x *RevokeTokenResponse) Reset()
func (*RevokeTokenResponse) String ¶ added in v0.0.5
func (x *RevokeTokenResponse) String() string
type SecurityContext ¶ added in v0.0.5
SecurityContext is the typed security context shared across all mesh services.
func SecurityContextFromContext ¶ added in v0.0.5
func SecurityContextFromContext(ctx context.Context) (*SecurityContext, bool)
SecurityContextFromContext extracts the SecurityContext from a context.
type Service ¶
type Service struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
// contains filtered or unexported fields
}
func (*Service) Descriptor
deprecated
func (*Service) GetVersion ¶
func (*Service) ProtoMessage ¶
func (*Service) ProtoMessage()
func (*Service) ProtoReflect ¶
func (x *Service) ProtoReflect() protoreflect.Message
type ServiceClient ¶
type ServiceClient[T any] struct { // contains filtered or unexported fields }
ServiceClient provides a typed client for a specific service.
func NewServiceClient ¶
func NewServiceClient[T any](pool *ServiceClientPool, name, version string, newClient func(grpc.ClientConnInterface) T) *ServiceClient[T]
NewServiceClient creates a typed service client.
type ServiceClientPool ¶
type ServiceClientPool struct {
// contains filtered or unexported fields
}
ServiceClientPool manages gRPC connections to service providers.
func NewServiceClientPool ¶
func NewServiceClientPool(node *Node) *ServiceClientPool
NewServiceClientPool creates a connection pool for service clients.
func (*ServiceClientPool) Close ¶
func (p *ServiceClientPool) Close() error
Close closes all connections in the pool.
func (*ServiceClientPool) GetConn ¶
func (p *ServiceClientPool) GetConn(ctx context.Context, name, version string) (*grpc.ClientConn, error)
GetConn returns a connection to a provider of the specified service. Uses round-robin to distribute calls across providers.
type ServiceInfo ¶
ServiceInfo represents a service that a node provides. This is the internal representation; Service from mesh.pb.go is used for wire format.
type ServiceRegistrar ¶
ServiceRegistrar is called to register additional gRPC services.
func MeshAuthRegistrar ¶ added in v0.0.5
func MeshAuthRegistrar(admin sctx.Admin[Metadata]) ServiceRegistrar
MeshAuthRegistrar returns a ServiceRegistrar that registers the MeshAuth service.
type TLSConfig ¶
type TLSConfig struct {
Certificate tls.Certificate
CertPool *x509.CertPool
ServerName string
}
TLSConfig holds the TLS configuration for a node
func LoadOrGenerateTLS ¶
LoadOrGenerateTLS loads existing certificates or generates new ones
func LoadTLSConfig ¶
func LoadTLSConfig(opts *TLSOptions) (*TLSConfig, error)
LoadTLSConfig loads TLS configuration based on options
func (*TLSConfig) GetClientTLSConfig ¶
GetClientTLSConfig returns TLS configuration for the client
func (*TLSConfig) GetServerTLSConfig ¶
GetServerTLSConfig returns TLS configuration for the server
type TLSOptions ¶
type TLSOptions struct {
// Source determines where certificates come from
Source CertificateSource
// For file-based certificates
CertFile string
KeyFile string
CAFile string
// For environment-based certificates
CertEnvVar string
KeyEnvVar string
CAEnvVar string
// For Vault-based certificates (future)
VaultPath string
VaultRole string
// Validation options
VerifyChain bool
AllowExpired bool
RequiredSANs []string
}
TLSOptions configures how TLS certificates are loaded
func DefaultTLSOptions ¶
func DefaultTLSOptions(nodeID string, certDir string) *TLSOptions
DefaultTLSOptions returns secure default options
type TokenExchangeRequest ¶ added in v0.0.5
type TokenExchangeRequest struct {
Assertion []byte `protobuf:"bytes,1,opt,name=assertion,proto3" json:"assertion,omitempty"` // JSON-encoded sctx.SignedAssertion
// contains filtered or unexported fields
}
TokenExchangeRequest contains the serialized signed assertion.
func (*TokenExchangeRequest) Descriptor
deprecated
added in
v0.0.5
func (*TokenExchangeRequest) Descriptor() ([]byte, []int)
Deprecated: Use TokenExchangeRequest.ProtoReflect.Descriptor instead.
func (*TokenExchangeRequest) GetAssertion ¶ added in v0.0.5
func (x *TokenExchangeRequest) GetAssertion() []byte
func (*TokenExchangeRequest) ProtoMessage ¶ added in v0.0.5
func (*TokenExchangeRequest) ProtoMessage()
func (*TokenExchangeRequest) ProtoReflect ¶ added in v0.0.5
func (x *TokenExchangeRequest) ProtoReflect() protoreflect.Message
func (*TokenExchangeRequest) Reset ¶ added in v0.0.5
func (x *TokenExchangeRequest) Reset()
func (*TokenExchangeRequest) String ¶ added in v0.0.5
func (x *TokenExchangeRequest) String() string
type TokenExchangeResponse ¶ added in v0.0.5
type TokenExchangeResponse struct {
Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` // sctx.SignedToken
ExpiresAt int64 `protobuf:"varint,2,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"` // Unix timestamp
// contains filtered or unexported fields
}
TokenExchangeResponse contains the issued token and expiration.
func (*TokenExchangeResponse) Descriptor
deprecated
added in
v0.0.5
func (*TokenExchangeResponse) Descriptor() ([]byte, []int)
Deprecated: Use TokenExchangeResponse.ProtoReflect.Descriptor instead.
func (*TokenExchangeResponse) GetExpiresAt ¶ added in v0.0.5
func (x *TokenExchangeResponse) GetExpiresAt() int64
func (*TokenExchangeResponse) GetToken ¶ added in v0.0.5
func (x *TokenExchangeResponse) GetToken() string
func (*TokenExchangeResponse) ProtoMessage ¶ added in v0.0.5
func (*TokenExchangeResponse) ProtoMessage()
func (*TokenExchangeResponse) ProtoReflect ¶ added in v0.0.5
func (x *TokenExchangeResponse) ProtoReflect() protoreflect.Message
func (*TokenExchangeResponse) Reset ¶ added in v0.0.5
func (x *TokenExchangeResponse) Reset()
func (*TokenExchangeResponse) String ¶ added in v0.0.5
func (x *TokenExchangeResponse) String() string
type Topology ¶
type Topology struct {
Nodes map[string]NodeInfo `json:"nodes"`
Version int64 `json:"version"`
UpdatedAt time.Time `json:"updated_at"`
// contains filtered or unexported fields
}
Topology maintains the mesh network topology.
func (*Topology) GetAllNodes ¶
GetAllNodes returns all nodes in the topology.
func (*Topology) GetNodesByService ¶
GetNodesByService returns all nodes that provide any version of the specified service.
func (*Topology) GetServiceProviders ¶
GetServiceProviders returns all nodes that provide the specified service.
func (*Topology) GetVersion ¶
GetVersion returns the topology version.
func (*Topology) RemoveNode ¶
RemoveNode removes a node from the topology.
func (*Topology) UpdateNode ¶
UpdateNode updates a node in the topology.
type TopologyNode ¶
type TopologyNode struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
Address string `protobuf:"bytes,4,opt,name=address,proto3" json:"address,omitempty"`
JoinedAt int64 `protobuf:"varint,5,opt,name=joined_at,json=joinedAt,proto3" json:"joined_at,omitempty"`
UpdatedAt int64 `protobuf:"varint,6,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
Services []*Service `protobuf:"bytes,7,rep,name=services,proto3" json:"services,omitempty"`
// contains filtered or unexported fields
}
func (*TopologyNode) Descriptor
deprecated
func (*TopologyNode) Descriptor() ([]byte, []int)
Deprecated: Use TopologyNode.ProtoReflect.Descriptor instead.
func (*TopologyNode) GetAddress ¶
func (x *TopologyNode) GetAddress() string
func (*TopologyNode) GetId ¶
func (x *TopologyNode) GetId() string
func (*TopologyNode) GetJoinedAt ¶
func (x *TopologyNode) GetJoinedAt() int64
func (*TopologyNode) GetName ¶
func (x *TopologyNode) GetName() string
func (*TopologyNode) GetServices ¶
func (x *TopologyNode) GetServices() []*Service
func (*TopologyNode) GetType ¶
func (x *TopologyNode) GetType() string
func (*TopologyNode) GetUpdatedAt ¶
func (x *TopologyNode) GetUpdatedAt() int64
func (*TopologyNode) ProtoMessage ¶
func (*TopologyNode) ProtoMessage()
func (*TopologyNode) ProtoReflect ¶
func (x *TopologyNode) ProtoReflect() protoreflect.Message
func (*TopologyNode) Reset ¶
func (x *TopologyNode) Reset()
func (*TopologyNode) String ¶
func (x *TopologyNode) String() string
type TopologySyncRequest ¶
type TopologySyncRequest struct {
SenderId string `protobuf:"bytes,1,opt,name=sender_id,json=senderId,proto3" json:"sender_id,omitempty"`
Version int64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"`
// contains filtered or unexported fields
}
Topology messages
func (*TopologySyncRequest) Descriptor
deprecated
func (*TopologySyncRequest) Descriptor() ([]byte, []int)
Deprecated: Use TopologySyncRequest.ProtoReflect.Descriptor instead.
func (*TopologySyncRequest) GetSenderId ¶
func (x *TopologySyncRequest) GetSenderId() string
func (*TopologySyncRequest) GetVersion ¶
func (x *TopologySyncRequest) GetVersion() int64
func (*TopologySyncRequest) ProtoMessage ¶
func (*TopologySyncRequest) ProtoMessage()
func (*TopologySyncRequest) ProtoReflect ¶
func (x *TopologySyncRequest) ProtoReflect() protoreflect.Message
func (*TopologySyncRequest) Reset ¶
func (x *TopologySyncRequest) Reset()
func (*TopologySyncRequest) String ¶
func (x *TopologySyncRequest) String() string
type TopologySyncResponse ¶
type TopologySyncResponse struct {
Version int64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"`
Nodes []*TopologyNode `protobuf:"bytes,2,rep,name=nodes,proto3" json:"nodes,omitempty"`
UpdatedAt int64 `protobuf:"varint,3,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
// contains filtered or unexported fields
}
func (*TopologySyncResponse) Descriptor
deprecated
func (*TopologySyncResponse) Descriptor() ([]byte, []int)
Deprecated: Use TopologySyncResponse.ProtoReflect.Descriptor instead.
func (*TopologySyncResponse) GetNodes ¶
func (x *TopologySyncResponse) GetNodes() []*TopologyNode
func (*TopologySyncResponse) GetUpdatedAt ¶
func (x *TopologySyncResponse) GetUpdatedAt() int64
func (*TopologySyncResponse) GetVersion ¶
func (x *TopologySyncResponse) GetVersion() int64
func (*TopologySyncResponse) ProtoMessage ¶
func (*TopologySyncResponse) ProtoMessage()
func (*TopologySyncResponse) ProtoReflect ¶
func (x *TopologySyncResponse) ProtoReflect() protoreflect.Message
func (*TopologySyncResponse) Reset ¶
func (x *TopologySyncResponse) Reset()
func (*TopologySyncResponse) String ¶
func (x *TopologySyncResponse) String() string
type UnimplementedMeshAuthServer ¶ added in v0.0.5
type UnimplementedMeshAuthServer struct{}
UnimplementedMeshAuthServer must be embedded to have forward compatible implementations.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedMeshAuthServer) ExchangeToken ¶ added in v0.0.5
func (UnimplementedMeshAuthServer) ExchangeToken(context.Context, *TokenExchangeRequest) (*TokenExchangeResponse, error)
func (UnimplementedMeshAuthServer) RevokeToken ¶ added in v0.0.5
func (UnimplementedMeshAuthServer) RevokeToken(context.Context, *RevokeTokenRequest) (*RevokeTokenResponse, error)
type UnimplementedMeshServiceServer ¶
type UnimplementedMeshServiceServer struct{}
UnimplementedMeshServiceServer must be embedded to have forward compatible implementations.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedMeshServiceServer) GetHealth ¶
func (UnimplementedMeshServiceServer) GetHealth(context.Context, *HealthRequest) (*HealthResponse, error)
func (UnimplementedMeshServiceServer) GetNodeInfo ¶
func (UnimplementedMeshServiceServer) GetNodeInfo(context.Context, *NodeInfoRequest) (*NodeInfoResponse, error)
func (UnimplementedMeshServiceServer) GetTopology ¶
func (UnimplementedMeshServiceServer) GetTopology(context.Context, *GetTopologyRequest) (*GetTopologyResponse, error)
func (UnimplementedMeshServiceServer) Ping ¶
func (UnimplementedMeshServiceServer) Ping(context.Context, *PingRequest) (*PingResponse, error)
func (UnimplementedMeshServiceServer) SyncTopology ¶
func (UnimplementedMeshServiceServer) SyncTopology(context.Context, *TopologySyncRequest) (*TopologySyncResponse, error)
type UnsafeMeshAuthServer ¶ added in v0.0.5
type UnsafeMeshAuthServer interface {
// contains filtered or unexported methods
}
UnsafeMeshAuthServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to MeshAuthServer will result in compilation errors.
type UnsafeMeshServiceServer ¶
type UnsafeMeshServiceServer interface {
// contains filtered or unexported methods
}
UnsafeMeshServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to MeshServiceServer will result in compilation errors.