Documentation
¶
Index ¶
- Constants
- func GenerateNetworkLoad(sim *NetworkSimulator, source, destination string, duration time.Duration, ...) error
- func MeasureNetworkLatency(source, destination string, count int) (time.Duration, error)
- func MeasureNetworkThroughput(source, destination string, duration time.Duration) (int64, error)
- func RunNetworkTestSuite(t *testing.T)
- func SerializeHeader(header MessageHeader) []byte
- func ValidateNetworkIsolation(t *testing.T, networkManager *NetworkManager, tenant1Net, tenant2Net *Network)
- func WaitForNetworkCondition(t *testing.T, condition func() bool, timeout time.Duration, description string)
- func WriteMessage(w io.Writer, msg *Message) error
- type AIPerformancePredictor
- func (a *AIPerformancePredictor) CleanExpiredCache()
- func (a *AIPerformancePredictor) GetCacheStats() map[string]interface{}
- func (a *AIPerformancePredictor) GetModelPerformance(ctx context.Context) (*ModelPerformance, error)
- func (a *AIPerformancePredictor) InvalidateCache()
- func (a *AIPerformancePredictor) InvalidateCacheByRoute(sourceNode, targetNode string)
- func (a *AIPerformancePredictor) InvalidateCacheByVM(vmID string)
- func (a *AIPerformancePredictor) InvalidateCacheEntry(key string)
- func (a *AIPerformancePredictor) IsHealthy(ctx context.Context) bool
- func (a *AIPerformancePredictor) PredictBandwidth(ctx context.Context, request PredictionRequest) (*BandwidthPrediction, error)
- func (a *AIPerformancePredictor) StoreNetworkMetrics(ctx context.Context, metrics NetworkMetrics) error
- func (a *AIPerformancePredictor) StoreWorkloadCharacteristics(ctx context.Context, workload WorkloadCharacteristics) error
- type ActionType
- type AlternativeRoute
- type BandwidthAlert
- type BandwidthAlertHandler
- type BandwidthMeasurement
- type BandwidthMonitor
- func (bm *BandwidthMonitor) AddQoSHook(hook func(string, float64))
- func (bm *BandwidthMonitor) GetAllCurrentMeasurements() map[string]*BandwidthMeasurement
- func (bm *BandwidthMonitor) GetCurrentMeasurement(ifaceName string) (*BandwidthMeasurement, error)
- func (bm *BandwidthMonitor) GetHistoricalMeasurements(ifaceName string, since time.Time) ([]BandwidthMeasurement, error)
- func (bm *BandwidthMonitor) GetNetworkUtilizationSummary() map[string]float64
- func (bm *BandwidthMonitor) SetThreshold(ifaceName string, threshold BandwidthThreshold) error
- func (bm *BandwidthMonitor) Start() error
- func (bm *BandwidthMonitor) Stop() error
- type BandwidthMonitorConfig
- type BandwidthPrediction
- type BandwidthThreshold
- type ClassificationRule
- type DefaultAlertHandler
- type FaultType
- type HeuristicPerformancePredictor
- func (h *HeuristicPerformancePredictor) GetModelPerformance(ctx context.Context) (*ModelPerformance, error)
- func (h *HeuristicPerformancePredictor) IsHealthy(ctx context.Context) bool
- func (h *HeuristicPerformancePredictor) PredictBandwidth(ctx context.Context, request PredictionRequest) (*BandwidthPrediction, error)
- func (h *HeuristicPerformancePredictor) StoreNetworkMetrics(ctx context.Context, metrics NetworkMetrics) error
- func (h *HeuristicPerformancePredictor) StoreWorkloadCharacteristics(ctx context.Context, workload WorkloadCharacteristics) error
- type IPAMConfig
- type InterfaceMonitor
- type InterfaceShaper
- type InterfaceState
- type LinkState
- type LocalNetworkMetrics
- type Message
- type MessageHeader
- type ModelMetrics
- type ModelPerformance
- type Network
- type NetworkEvent
- type NetworkEventListener
- type NetworkEventType
- type NetworkInfo
- type NetworkManager
- func (m *NetworkManager) AddEventListener(listener NetworkEventListener)
- func (m *NetworkManager) ApplyQoSPolicy(networkID string, policy *QoSPolicy) error
- func (m *NetworkManager) ConnectVM(ctx context.Context, networkID, vmID string) error
- func (m *NetworkManager) CreateNetwork(ctx context.Context, spec NetworkSpec) (*Network, error)
- func (m *NetworkManager) DeleteNetwork(ctx context.Context, networkID string) error
- func (m *NetworkManager) DisconnectVM(ctx context.Context, networkID, vmID string) error
- func (m *NetworkManager) GetBandwidthMetrics(interfaceName string) (*BandwidthMeasurement, error)
- func (m *NetworkManager) GetNetwork(networkID string) (*Network, error)
- func (m *NetworkManager) GetNetworkByName(name string) (*Network, error)
- func (m *NetworkManager) GetNetworkPerformanceMetrics(networkID string) (*LocalNetworkMetrics, error)
- func (m *NetworkManager) GetNetworkQoSStatus(networkID string) (map[string]interface{}, error)
- func (m *NetworkManager) ListNetworks() []*Network
- func (m *NetworkManager) RemoveEventListener(listener NetworkEventListener)
- func (m *NetworkManager) RemoveQoSPolicy(networkID, policyID string) error
- func (m *NetworkManager) Start() error
- func (m *NetworkManager) Stop() error
- type NetworkManagerConfig
- type NetworkMetrics
- type NetworkPerformanceMetrics
- type NetworkRule
- type NetworkSimulator
- func (sim *NetworkSimulator) AddNetworkRule(rule *NetworkRule) error
- func (sim *NetworkSimulator) Cleanup()
- func (sim *NetworkSimulator) CreateInterface(name string, ip net.IP, subnet *net.IPNet) (*SimulatedInterface, error)
- func (sim *NetworkSimulator) CreateLink(source, destination string, bandwidth int64, latency time.Duration) (*SimulatedLink, error)
- func (sim *NetworkSimulator) GetInterfaceStats(name string) (*SimulatedInterface, error)
- func (sim *NetworkSimulator) GetLinkStats(linkID string) (*SimulatedLink, error)
- func (sim *NetworkSimulator) InjectNetworkFault(target string, faultType FaultType, parameters map[string]interface{}) error
- func (sim *NetworkSimulator) SimulateTraffic(source, destination string, packets uint64, bytes uint64) error
- func (sim *NetworkSimulator) ValidateNetworkConnectivity(source, destination string) (bool, error)
- type NetworkSpec
- type NetworkTestSuite
- type NetworkType
- type PerformancePredictor
- type PerformancePredictorManager
- func (m *PerformancePredictorManager) GetModelPerformance(ctx context.Context) (*ModelPerformance, error)
- func (m *PerformancePredictorManager) IsHealthy(ctx context.Context) bool
- func (m *PerformancePredictorManager) PredictBandwidth(ctx context.Context, request PredictionRequest) (*BandwidthPrediction, error)
- func (m *PerformancePredictorManager) StoreNetworkMetrics(ctx context.Context, metrics NetworkMetrics) error
- func (m *PerformancePredictorManager) StoreWorkloadCharacteristics(ctx context.Context, workload WorkloadCharacteristics) error
- type PredictionRequest
- type PredictorFactory
- type QoSAction
- type QoSManager
- func (qm *QoSManager) AddPolicy(policy *QoSPolicy) error
- func (qm *QoSManager) GetInterfacePolicies(interfaceName string) []*QoSPolicy
- func (qm *QoSManager) GetNetworkQoSStatus(networkID string) map[string]interface{}
- func (qm *QoSManager) GetPolicy(policyID string) (*QoSPolicy, error)
- func (qm *QoSManager) ListPolicies() []*QoSPolicy
- func (qm *QoSManager) RemovePolicy(policyID string) error
- func (qm *QoSManager) Start() error
- func (qm *QoSManager) Stop() error
- type QoSManagerConfig
- type QoSPolicy
- type QoSRule
- type QoSStatistics
- type QueueConfig
- type QueueManager
- type RuleAction
- type RuleMatch
- type RuleStats
- type SecurityConfig
- type SecurityContext
- func (s *SecurityContext) AddPeerPublicKey(peerID string, publicKey *ecdsa.PublicKey)
- func (s *SecurityContext) DecodePublicKeyMessage(payload []byte) (*ecdsa.PublicKey, error)
- func (s *SecurityContext) DecryptMessage(msg *Message, peerID string) (*Message, error)
- func (s *SecurityContext) DeriveSharedEncryptionKey(peerID string, peerPublicKey *ecdsa.PublicKey) ([]byte, error)
- func (s *SecurityContext) EncodePublicKeyMessage() ([]byte, error)
- func (s *SecurityContext) EncryptMessage(msg *Message, peerID string) (*Message, error)
- func (s *SecurityContext) ExportPublicKey() (string, error)
- func (s *SecurityContext) GenerateEncryptionKey(peerID string) ([]byte, error)
- func (s *SecurityContext) GetEncryptionKey(peerID string) ([]byte, bool)
- func (s *SecurityContext) GetPeerPublicKey(peerID string) (*ecdsa.PublicKey, bool)
- func (s *SecurityContext) ImportPublicKey(encoded string) (*ecdsa.PublicKey, error)
- func (s *SecurityContext) ProtectMessage(msg *Message, peerID string, encrypt bool, sign bool) (*Message, error)
- func (s *SecurityContext) SetEncryptionKey(peerID string, key []byte)
- func (s *SecurityContext) SetupTLS(config SecurityConfig) error
- func (s *SecurityContext) SignMessage(msg *Message) (*Message, error)
- func (s *SecurityContext) UnprotectMessage(msg *Message, peerID string) (*Message, bool, error)
- func (s *SecurityContext) VerifyMessage(msg *Message, peerID string) (*Message, bool, error)
- type SimulatedInterface
- type SimulatedLink
- type TrafficClass
- type TrafficClassifier
- type TrafficShaper
- type TrafficStats
- type UDPPeer
- type UDPTransport
- type UDPTransportConfig
- type WorkloadCharacteristics
Constants ¶
const ( // Control messages TypeHandshake = 0x01 TypeHandshakeResponse = 0x02 TypePing = 0x03 TypePong = 0x04 TypeDisconnect = 0x05 // Node communication TypeNodeState = 0x10 TypeNodeStateReq = 0x11 TypeNodeStateResp = 0x12 TypeResourceState = 0x13 TypeTaskDistribute = 0x14 // VM operations TypeVMCreate = 0x20 TypeVMCreateResp = 0x21 TypeVMStart = 0x22 TypeVMStartResp = 0x23 TypeVMStop = 0x24 TypeVMStopResp = 0x25 TypeVMDelete = 0x26 TypeVMDeleteResp = 0x27 TypeVMState = 0x28 TypeVMMetrics = 0x29 // Data transfer TypeDataStream = 0x30 TypeDataStreamAck = 0x31 TypeDataStreamClose = 0x32 TypeBulkTransfer = 0x33 TypeBulkTransferAck = 0x34 // Migration TypeMigrationInit = 0x40 TypeMigrationData = 0x41 TypeMigrationFinish = 0x42 TypeMigrationAbort = 0x43 )
Message types
const ( FlagCompressed = 1 << 0 FlagEncrypted = 1 << 1 FlagUrgent = 1 << 2 FlagReliable = 1 << 3 FlagAck = 1 << 4 )
Header flags
const ( // EncryptionKeySize is the size of the AES encryption key EncryptionKeySize = 32 // 256 bits // NonceSize is the size of the AES-GCM nonce NonceSize = 12 // SignatureSize is the size of the ECDSA signature SignatureSize = 64 )
Security constants
const ( // MaxUDPPacketSize is the maximum size of a UDP packet MaxUDPPacketSize = 65507 // Max UDP packet size (65535 - 28 bytes for headers) // DefaultReadBufferSize is the default size of the read buffer DefaultReadBufferSize = 8 * 1024 * 1024 // 8 MB // DefaultWriteBufferSize is the default size of the write buffer DefaultWriteBufferSize = 8 * 1024 * 1024 // 8 MB // DefaultReceiveQueueSize is the default size of the receive queue DefaultReceiveQueueSize = 1000 // DefaultSendQueueSize is the default size of the send queue DefaultSendQueueSize = 1000 // AckTimeout is the timeout for acknowledgments AckTimeout = 500 * time.Millisecond // MaxRetries is the maximum number of retries for reliable messages MaxRetries = 5 // KeepAliveInterval is the interval for keep-alive messages KeepAliveInterval = 15 * time.Second // ConnectionTimeout is the timeout for inactive connections ConnectionTimeout = 30 * time.Second )
Constants for UDP transport
const (
ProtocolVersion = 1
)
Protocol version
Variables ¶
This section is empty.
Functions ¶
func GenerateNetworkLoad ¶
func GenerateNetworkLoad(sim *NetworkSimulator, source, destination string, duration time.Duration, packetsPerSecond uint64) error
GenerateNetworkLoad generates synthetic network load for testing
func MeasureNetworkLatency ¶
MeasureNetworkLatency measures actual network latency between endpoints
func MeasureNetworkThroughput ¶
MeasureNetworkThroughput measures network throughput between endpoints
func RunNetworkTestSuite ¶
RunNetworkTestSuite runs the complete network test suite
func SerializeHeader ¶
func SerializeHeader(header MessageHeader) []byte
SerializeHeader serializes the message header to binary
func ValidateNetworkIsolation ¶
func ValidateNetworkIsolation(t *testing.T, networkManager *NetworkManager, tenant1Net, tenant2Net *Network)
ValidateNetworkIsolation validates that network isolation is working correctly
Types ¶
type AIPerformancePredictor ¶
type AIPerformancePredictor struct {
// contains filtered or unexported fields
}
AIPerformancePredictor implements PerformancePredictor using AI/ML backend
func NewAIPerformancePredictor ¶
func NewAIPerformancePredictor(baseURL string, logger *log.Logger) *AIPerformancePredictor
NewAIPerformancePredictor creates a new AI-powered performance predictor
func (*AIPerformancePredictor) CleanExpiredCache ¶
func (a *AIPerformancePredictor) CleanExpiredCache()
CleanExpiredCache manually cleans up expired cache entries
func (*AIPerformancePredictor) GetCacheStats ¶
func (a *AIPerformancePredictor) GetCacheStats() map[string]interface{}
GetCacheStats returns cache statistics
func (*AIPerformancePredictor) GetModelPerformance ¶
func (a *AIPerformancePredictor) GetModelPerformance(ctx context.Context) (*ModelPerformance, error)
GetModelPerformance retrieves ML model performance metrics
func (*AIPerformancePredictor) InvalidateCache ¶
func (a *AIPerformancePredictor) InvalidateCache()
InvalidateCache invalidates all cached predictions
func (*AIPerformancePredictor) InvalidateCacheByRoute ¶
func (a *AIPerformancePredictor) InvalidateCacheByRoute(sourceNode, targetNode string)
InvalidateCacheByRoute invalidates cache entries for a specific route
func (*AIPerformancePredictor) InvalidateCacheByVM ¶
func (a *AIPerformancePredictor) InvalidateCacheByVM(vmID string)
InvalidateCacheByVM invalidates cache entries for a specific VM
func (*AIPerformancePredictor) InvalidateCacheEntry ¶
func (a *AIPerformancePredictor) InvalidateCacheEntry(key string)
InvalidateCacheEntry invalidates a specific cache entry
func (*AIPerformancePredictor) IsHealthy ¶
func (a *AIPerformancePredictor) IsHealthy(ctx context.Context) bool
IsHealthy checks if the AI prediction service is healthy
func (*AIPerformancePredictor) PredictBandwidth ¶
func (a *AIPerformancePredictor) PredictBandwidth(ctx context.Context, request PredictionRequest) (*BandwidthPrediction, error)
PredictBandwidth predicts bandwidth for a network route and workload
func (*AIPerformancePredictor) StoreNetworkMetrics ¶
func (a *AIPerformancePredictor) StoreNetworkMetrics(ctx context.Context, metrics NetworkMetrics) error
StoreNetworkMetrics stores network performance metrics
func (*AIPerformancePredictor) StoreWorkloadCharacteristics ¶
func (a *AIPerformancePredictor) StoreWorkloadCharacteristics(ctx context.Context, workload WorkloadCharacteristics) error
StoreWorkloadCharacteristics stores VM workload characteristics
type ActionType ¶
type ActionType string
ActionType defines types of actions
const ( ActionAllow ActionType = "allow" ActionDeny ActionType = "deny" ActionDrop ActionType = "drop" ActionRedirect ActionType = "redirect" ActionRateLimit ActionType = "rate_limit" ActionMirror ActionType = "mirror" ActionSetPriority ActionType = "set_priority" )
type AlternativeRoute ¶
type AlternativeRoute struct {
RouteID string `json:"route_id"`
IntermediateNodes []string `json:"intermediate_nodes"`
PredictedBandwidth float64 `json:"predicted_bandwidth"`
EstimatedLatency float64 `json:"estimated_latency"`
ReliabilityScore float64 `json:"reliability_score"`
}
AlternativeRoute represents an alternative network route
type BandwidthAlert ¶
type BandwidthAlert struct {
ID string `json:"id"`
InterfaceName string `json:"interface_name"`
Severity string `json:"severity"`
Message string `json:"message"`
Timestamp time.Time `json:"timestamp"`
CurrentValue float64 `json:"current_value"`
ThresholdValue float64 `json:"threshold_value"`
Metadata map[string]interface{} `json:"metadata"`
}
type BandwidthAlertHandler ¶
type BandwidthAlertHandler interface {
HandleAlert(alert *BandwidthAlert) error
}
type BandwidthMeasurement ¶
type BandwidthMeasurement struct {
InterfaceName string `json:"interface_name"`
Timestamp time.Time `json:"timestamp"`
RXBytes uint64 `json:"rx_bytes"`
TXBytes uint64 `json:"tx_bytes"`
RXPackets uint64 `json:"rx_packets"`
TXPackets uint64 `json:"tx_packets"`
RXErrors uint64 `json:"rx_errors"`
TXErrors uint64 `json:"tx_errors"`
RXDropped uint64 `json:"rx_dropped"`
TXDropped uint64 `json:"tx_dropped"`
RXRate float64 `json:"rx_rate_bps"`
TXRate float64 `json:"tx_rate_bps"`
Utilization float64 `json:"utilization_percent"`
LinkSpeed uint64 `json:"link_speed_bps"`
LinkStatus bool `json:"link_status"`
Metadata map[string]string `json:"metadata"`
}
type BandwidthMonitor ¶
type BandwidthMonitor struct {
// contains filtered or unexported fields
}
func NewBandwidthMonitor ¶
func NewBandwidthMonitor(config *BandwidthMonitorConfig, logger *zap.Logger) *BandwidthMonitor
func (*BandwidthMonitor) AddQoSHook ¶
func (bm *BandwidthMonitor) AddQoSHook(hook func(string, float64))
func (*BandwidthMonitor) GetAllCurrentMeasurements ¶
func (bm *BandwidthMonitor) GetAllCurrentMeasurements() map[string]*BandwidthMeasurement
func (*BandwidthMonitor) GetCurrentMeasurement ¶
func (bm *BandwidthMonitor) GetCurrentMeasurement(ifaceName string) (*BandwidthMeasurement, error)
func (*BandwidthMonitor) GetHistoricalMeasurements ¶
func (bm *BandwidthMonitor) GetHistoricalMeasurements(ifaceName string, since time.Time) ([]BandwidthMeasurement, error)
func (*BandwidthMonitor) GetNetworkUtilizationSummary ¶
func (bm *BandwidthMonitor) GetNetworkUtilizationSummary() map[string]float64
func (*BandwidthMonitor) SetThreshold ¶
func (bm *BandwidthMonitor) SetThreshold(ifaceName string, threshold BandwidthThreshold) error
func (*BandwidthMonitor) Start ¶
func (bm *BandwidthMonitor) Start() error
func (*BandwidthMonitor) Stop ¶
func (bm *BandwidthMonitor) Stop() error
type BandwidthMonitorConfig ¶
type BandwidthMonitorConfig struct {
MonitoringInterval time.Duration `json:"monitoring_interval"`
HistoryRetention time.Duration `json:"history_retention"`
Interfaces []string `json:"interfaces"`
DefaultThresholds []BandwidthThreshold `json:"default_thresholds"`
AlertHandlers []BandwidthAlertHandler
EnableQoSHooks bool `json:"enable_qos_hooks"`
MaxHistoryPoints int `json:"max_history_points"`
SlidingWindowDuration time.Duration `json:"sliding_window_duration"`
}
type BandwidthPrediction ¶
type BandwidthPrediction struct {
PredictedBandwidth float64 `json:"predicted_bandwidth"`
ConfidenceInterval []float64 `json:"confidence_interval"`
PredictionConfidence float64 `json:"prediction_confidence"`
OptimalTimeWindow []time.Time `json:"optimal_time_window"`
AlternativeRoutes []AlternativeRoute `json:"alternative_routes"`
CongestionForecast map[string]float64 `json:"congestion_forecast"`
Recommendation string `json:"recommendation"`
}
BandwidthPrediction represents the result of bandwidth prediction
type BandwidthThreshold ¶
type ClassificationRule ¶
type ClassificationRule struct {
ID string `json:"id"`
Name string `json:"name"`
SourceIP string `json:"source_ip,omitempty"`
DestIP string `json:"dest_ip,omitempty"`
SourcePort int `json:"source_port,omitempty"`
DestPort int `json:"dest_port,omitempty"`
Protocol string `json:"protocol,omitempty"`
DSCPMark int `json:"dscp_mark,omitempty"`
Application string `json:"application,omitempty"`
Match string `json:"match"`
Metadata map[string]string `json:"metadata"`
}
type DefaultAlertHandler ¶
type DefaultAlertHandler struct {
// contains filtered or unexported fields
}
func NewDefaultAlertHandler ¶
func NewDefaultAlertHandler(logger *zap.Logger) *DefaultAlertHandler
func (*DefaultAlertHandler) HandleAlert ¶
func (h *DefaultAlertHandler) HandleAlert(alert *BandwidthAlert) error
type HeuristicPerformancePredictor ¶
type HeuristicPerformancePredictor struct {
// contains filtered or unexported fields
}
HeuristicPerformancePredictor implements PerformancePredictor using heuristic rules
func NewHeuristicPerformancePredictor ¶
func NewHeuristicPerformancePredictor(logger *log.Logger) *HeuristicPerformancePredictor
NewHeuristicPerformancePredictor creates a heuristic-based performance predictor
func (*HeuristicPerformancePredictor) GetModelPerformance ¶
func (h *HeuristicPerformancePredictor) GetModelPerformance(ctx context.Context) (*ModelPerformance, error)
GetModelPerformance returns dummy performance metrics for heuristic predictor
func (*HeuristicPerformancePredictor) IsHealthy ¶
func (h *HeuristicPerformancePredictor) IsHealthy(ctx context.Context) bool
IsHealthy always returns true for heuristic predictor
func (*HeuristicPerformancePredictor) PredictBandwidth ¶
func (h *HeuristicPerformancePredictor) PredictBandwidth(ctx context.Context, request PredictionRequest) (*BandwidthPrediction, error)
PredictBandwidth provides heuristic-based bandwidth prediction
func (*HeuristicPerformancePredictor) StoreNetworkMetrics ¶
func (h *HeuristicPerformancePredictor) StoreNetworkMetrics(ctx context.Context, metrics NetworkMetrics) error
StoreNetworkMetrics is a no-op for heuristic predictor
func (*HeuristicPerformancePredictor) StoreWorkloadCharacteristics ¶
func (h *HeuristicPerformancePredictor) StoreWorkloadCharacteristics(ctx context.Context, workload WorkloadCharacteristics) error
StoreWorkloadCharacteristics is a no-op for heuristic predictor
type IPAMConfig ¶
type IPAMConfig struct {
Subnet string `json:"subnet"`
Gateway string `json:"gateway,omitempty"`
IPRange string `json:"ip_range,omitempty"`
AuxAddresses map[string]string `json:"aux_addresses,omitempty"`
DNSServers []string `json:"dns_servers,omitempty"`
}
IPAMConfig represents IP Address Management configuration
type InterfaceMonitor ¶
type InterfaceMonitor struct {
// contains filtered or unexported fields
}
type InterfaceShaper ¶
type InterfaceShaper struct {
// contains filtered or unexported fields
}
type InterfaceState ¶
type InterfaceState string
InterfaceState represents the state of a network interface
const ( InterfaceStateUp InterfaceState = "up" InterfaceStateDown InterfaceState = "down" InterfaceStateTesting InterfaceState = "testing" InterfaceStateDormant InterfaceState = "dormant" )
type LocalNetworkMetrics ¶
type LocalNetworkMetrics struct {
BandwidthUtilization float64 `json:"bandwidth_utilization"`
PacketLoss float64 `json:"packet_loss"`
Latency float64 `json:"latency_ms"`
Jitter float64 `json:"jitter_ms"`
ThroughputBps uint64 `json:"throughput_bps"`
ErrorRate float64 `json:"error_rate"`
LastMeasured time.Time `json:"last_measured"`
}
LocalNetworkMetrics contains network performance metrics for a single network
type Message ¶
type Message struct {
Header MessageHeader
Payload []byte
}
Message represents a protocol message
func Deserialize ¶
Deserialize deserializes a message from binary
func NewMessage ¶
NewMessage creates a new message
func ReadMessage ¶
ReadMessage reads a message from a reader
type MessageHeader ¶
type MessageHeader struct {
Version uint8 // Protocol version
Type uint8 // Message type
Flags uint16 // Flags for compression, encryption, etc.
SequenceID uint32 // Message sequence ID for reliability
PayloadLength uint32 // Length of the payload
Timestamp int64 // Unix timestamp in milliseconds
}
Message header structure Fixed size: 16 bytes
func DeserializeHeader ¶
func DeserializeHeader(data []byte) (MessageHeader, error)
DeserializeHeader deserializes a message header from binary
func (*MessageHeader) ClearFlag ¶
func (h *MessageHeader) ClearFlag(flag uint16)
ClearFlag clears a flag
func (*MessageHeader) IsFlag ¶
func (h *MessageHeader) IsFlag(flag uint16) bool
IsFlag checks if a flag is set
type ModelMetrics ¶
type ModelMetrics struct {
MAE float64 `json:"mae"`
MSE float64 `json:"mse"`
R2Score float64 `json:"r2_score"`
TrainingSamples int `json:"training_samples"`
}
ModelMetrics represents performance metrics for a specific model
type ModelPerformance ¶
type ModelPerformance struct {
Models map[string]ModelMetrics `json:"models"`
}
ModelPerformance represents ML model performance metrics
type Network ¶
type Network struct {
ID string `json:"id"`
Name string `json:"name"`
Type NetworkType `json:"type"`
IPAM IPAMConfig `json:"ipam"`
Internal bool `json:"internal"`
EnableIPv6 bool `json:"enable_ipv6"`
Labels map[string]string `json:"labels,omitempty"`
Options map[string]string `json:"options,omitempty"`
CreatedAt time.Time `json:"created_at"`
NodeID string `json:"node_id"`
NetworkInfo NetworkInfo `json:"network_info"`
}
Network represents a network in the system
type NetworkEvent ¶
type NetworkEvent struct {
Type NetworkEventType `json:"type"`
Network Network `json:"network"`
Timestamp time.Time `json:"timestamp"`
NodeID string `json:"node_id"`
Message string `json:"message,omitempty"`
BandwidthMetrics *BandwidthMeasurement `json:"bandwidth_metrics,omitempty"`
Severity string `json:"severity,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
NetworkEvent represents an event related to networks
type NetworkEventListener ¶
type NetworkEventListener func(event NetworkEvent)
NetworkEventListener is a callback for network events
type NetworkEventType ¶
type NetworkEventType string
NetworkEventType represents network event types
const ( // NetworkEventCreated is emitted when a network is created NetworkEventCreated NetworkEventType = "created" // NetworkEventDeleted is emitted when a network is deleted NetworkEventDeleted NetworkEventType = "deleted" // NetworkEventUpdated is emitted when a network is updated NetworkEventUpdated NetworkEventType = "updated" // NetworkEventError is emitted on network errors NetworkEventError NetworkEventType = "error" // NetworkEventCongestion is emitted when network congestion is detected NetworkEventCongestion NetworkEventType = "congestion" // NetworkEventBandwidthThreshold is emitted when bandwidth thresholds are exceeded NetworkEventBandwidthThreshold NetworkEventType = "bandwidth_threshold" // NetworkEventQoSViolation is emitted when QoS violations occur NetworkEventQoSViolation NetworkEventType = "qos_violation" )
type NetworkInfo ¶
type NetworkInfo struct {
Active bool `json:"active"`
ConnectedVMs []string `json:"connected_vms"`
LastUpdated time.Time `json:"last_updated"`
Metrics LocalNetworkMetrics `json:"metrics"`
BandwidthUtilization float64 `json:"bandwidth_utilization"`
QoSStatus map[string]interface{} `json:"qos_status"`
}
NetworkInfo contains runtime information about a network
type NetworkManager ¶
type NetworkManager struct {
// contains filtered or unexported fields
}
NetworkManager manages virtual networks
func NewNetworkManager ¶
func NewNetworkManager(config NetworkManagerConfig, nodeID string, logger *zap.Logger) *NetworkManager
NewNetworkManager creates a new network manager
func (*NetworkManager) AddEventListener ¶
func (m *NetworkManager) AddEventListener(listener NetworkEventListener)
AddEventListener adds a listener for network events
func (*NetworkManager) ApplyQoSPolicy ¶
func (m *NetworkManager) ApplyQoSPolicy(networkID string, policy *QoSPolicy) error
ApplyQoSPolicy applies a QoS policy to a specific network
func (*NetworkManager) ConnectVM ¶
func (m *NetworkManager) ConnectVM(ctx context.Context, networkID, vmID string) error
ConnectVM connects a VM to a network
func (*NetworkManager) CreateNetwork ¶
func (m *NetworkManager) CreateNetwork(ctx context.Context, spec NetworkSpec) (*Network, error)
CreateNetwork creates a new network
func (*NetworkManager) DeleteNetwork ¶
func (m *NetworkManager) DeleteNetwork(ctx context.Context, networkID string) error
DeleteNetwork deletes a network
func (*NetworkManager) DisconnectVM ¶
func (m *NetworkManager) DisconnectVM(ctx context.Context, networkID, vmID string) error
DisconnectVM disconnects a VM from a network
func (*NetworkManager) GetBandwidthMetrics ¶
func (m *NetworkManager) GetBandwidthMetrics(interfaceName string) (*BandwidthMeasurement, error)
GetBandwidthMetrics returns current bandwidth metrics for a network interface
func (*NetworkManager) GetNetwork ¶
func (m *NetworkManager) GetNetwork(networkID string) (*Network, error)
GetNetwork returns a network by ID
func (*NetworkManager) GetNetworkByName ¶
func (m *NetworkManager) GetNetworkByName(name string) (*Network, error)
GetNetworkByName returns a network by name
func (*NetworkManager) GetNetworkPerformanceMetrics ¶
func (m *NetworkManager) GetNetworkPerformanceMetrics(networkID string) (*LocalNetworkMetrics, error)
GetNetworkPerformanceMetrics returns comprehensive network performance metrics
func (*NetworkManager) GetNetworkQoSStatus ¶
func (m *NetworkManager) GetNetworkQoSStatus(networkID string) (map[string]interface{}, error)
GetNetworkQoSStatus returns QoS status for a specific network
func (*NetworkManager) ListNetworks ¶
func (m *NetworkManager) ListNetworks() []*Network
ListNetworks returns all networks
func (*NetworkManager) RemoveEventListener ¶
func (m *NetworkManager) RemoveEventListener(listener NetworkEventListener)
RemoveEventListener removes an event listener
func (*NetworkManager) RemoveQoSPolicy ¶
func (m *NetworkManager) RemoveQoSPolicy(networkID, policyID string) error
RemoveQoSPolicy removes a QoS policy from a network
func (*NetworkManager) Start ¶
func (m *NetworkManager) Start() error
Start starts the network manager
type NetworkManagerConfig ¶
type NetworkManagerConfig struct {
DefaultNetworkType NetworkType `json:"default_network_type"`
DefaultSubnet string `json:"default_subnet"`
DefaultIPRange string `json:"default_ip_range"`
DefaultGateway string `json:"default_gateway"`
DNSServers []string `json:"dns_servers"`
UpdateInterval time.Duration `json:"update_interval"`
EnableQoS bool `json:"enable_qos"`
DefaultQoSPolicies []string `json:"default_qos_policies"`
QoSUpdateInterval time.Duration `json:"qos_update_interval"`
BandwidthMonitoringEnabled bool `json:"bandwidth_monitoring_enabled"`
}
NetworkManagerConfig holds configuration for the network manager
func DefaultNetworkManagerConfig ¶
func DefaultNetworkManagerConfig() NetworkManagerConfig
DefaultNetworkManagerConfig returns a default configuration
type NetworkMetrics ¶
type NetworkMetrics struct {
Timestamp time.Time `json:"timestamp"`
SourceNode string `json:"source_node"`
TargetNode string `json:"target_node"`
BandwidthMbps float64 `json:"bandwidth_mbps"`
LatencyMs float64 `json:"latency_ms"`
PacketLoss float64 `json:"packet_loss"`
JitterMs float64 `json:"jitter_ms"`
ThroughputMbps float64 `json:"throughput_mbps"`
ConnectionQuality float64 `json:"connection_quality"`
RouteHops int `json:"route_hops"`
CongestionLevel float64 `json:"congestion_level"`
}
NetworkMetrics represents network performance measurements
type NetworkPerformanceMetrics ¶
type NetworkPerformanceMetrics struct {
TotalPackets uint64
TotalBytes uint64
AverageLatency time.Duration
PacketLoss float64
Throughput int64
ConnectionsActive int
ConnectionsTotal int
NetworkUtilization float64
ErrorRate float64
// contains filtered or unexported fields
}
NetworkPerformanceMetrics tracks network performance metrics
func (*NetworkPerformanceMetrics) GetPerformanceSnapshot ¶
func (metrics *NetworkPerformanceMetrics) GetPerformanceSnapshot() NetworkPerformanceMetrics
GetPerformanceSnapshot returns a snapshot of current performance metrics
func (*NetworkPerformanceMetrics) UpdatePerformanceMetrics ¶
func (metrics *NetworkPerformanceMetrics) UpdatePerformanceMetrics(packets, bytes uint64, latency time.Duration, packetLoss float64)
UpdatePerformanceMetrics updates network performance metrics
type NetworkRule ¶
type NetworkRule struct {
ID string
Priority int
Match RuleMatch
Action RuleAction
Stats RuleStats
}
NetworkRule represents a network policy rule
type NetworkSimulator ¶
type NetworkSimulator struct {
// contains filtered or unexported fields
}
NetworkSimulator simulates various network conditions for testing
func NewNetworkSimulator ¶
func NewNetworkSimulator() *NetworkSimulator
NewNetworkSimulator creates a new network simulator
func (*NetworkSimulator) AddNetworkRule ¶
func (sim *NetworkSimulator) AddNetworkRule(rule *NetworkRule) error
AddNetworkRule adds a network policy rule
func (*NetworkSimulator) Cleanup ¶
func (sim *NetworkSimulator) Cleanup()
Cleanup cleans up simulator resources
func (*NetworkSimulator) CreateInterface ¶
func (sim *NetworkSimulator) CreateInterface(name string, ip net.IP, subnet *net.IPNet) (*SimulatedInterface, error)
CreateInterface creates a simulated network interface
func (*NetworkSimulator) CreateLink ¶
func (sim *NetworkSimulator) CreateLink(source, destination string, bandwidth int64, latency time.Duration) (*SimulatedLink, error)
CreateLink creates a simulated network link
func (*NetworkSimulator) GetInterfaceStats ¶
func (sim *NetworkSimulator) GetInterfaceStats(name string) (*SimulatedInterface, error)
GetInterfaceStats returns statistics for a simulated interface
func (*NetworkSimulator) GetLinkStats ¶
func (sim *NetworkSimulator) GetLinkStats(linkID string) (*SimulatedLink, error)
GetLinkStats returns statistics for a simulated link
func (*NetworkSimulator) InjectNetworkFault ¶
func (sim *NetworkSimulator) InjectNetworkFault(target string, faultType FaultType, parameters map[string]interface{}) error
InjectNetworkFault injects network faults for chaos engineering
func (*NetworkSimulator) SimulateTraffic ¶
func (sim *NetworkSimulator) SimulateTraffic(source, destination string, packets uint64, bytes uint64) error
SimulateTraffic simulates network traffic between interfaces
func (*NetworkSimulator) ValidateNetworkConnectivity ¶
func (sim *NetworkSimulator) ValidateNetworkConnectivity(source, destination string) (bool, error)
ValidateNetworkConnectivity tests basic network connectivity
type NetworkSpec ¶
type NetworkSpec struct {
Name string `json:"name"`
Type NetworkType `json:"type"`
IPAM IPAMConfig `json:"ipam"`
Internal bool `json:"internal"`
EnableIPv6 bool `json:"enable_ipv6"`
Labels map[string]string `json:"labels,omitempty"`
Options map[string]string `json:"options,omitempty"`
}
NetworkSpec defines a network configuration
type NetworkTestSuite ¶
NetworkTestSuite provides comprehensive testing for networking components
func (*NetworkTestSuite) SetupSuite ¶
func (suite *NetworkTestSuite) SetupSuite()
SetupSuite initializes the test suite
func (*NetworkTestSuite) TearDownSuite ¶
func (suite *NetworkTestSuite) TearDownSuite()
TearDownSuite cleans up after all tests
type NetworkType ¶
type NetworkType string
NetworkType defines the type of network
const ( // NetworkTypeBridge is a bridge network (local connectivity) NetworkTypeBridge NetworkType = "bridge" // NetworkTypeOverlay is an overlay network (across nodes) NetworkTypeOverlay NetworkType = "overlay" // NetworkTypeMacvlan is a macvlan network (direct access to physical network) NetworkTypeMacvlan NetworkType = "macvlan" )
type PerformancePredictor ¶
type PerformancePredictor interface {
PredictBandwidth(ctx context.Context, request PredictionRequest) (*BandwidthPrediction, error)
StoreNetworkMetrics(ctx context.Context, metrics NetworkMetrics) error
StoreWorkloadCharacteristics(ctx context.Context, workload WorkloadCharacteristics) error
GetModelPerformance(ctx context.Context) (*ModelPerformance, error)
IsHealthy(ctx context.Context) bool
}
PerformancePredictor interface for network performance prediction
type PerformancePredictorManager ¶
type PerformancePredictorManager struct {
// contains filtered or unexported fields
}
PerformancePredictorManager manages multiple predictors with fallback
func NewPerformancePredictorManager ¶
func NewPerformancePredictorManager(primary, fallback PerformancePredictor, logger *log.Logger) *PerformancePredictorManager
NewPerformancePredictorManager creates a new predictor manager
func (*PerformancePredictorManager) GetModelPerformance ¶
func (m *PerformancePredictorManager) GetModelPerformance(ctx context.Context) (*ModelPerformance, error)
func (*PerformancePredictorManager) IsHealthy ¶
func (m *PerformancePredictorManager) IsHealthy(ctx context.Context) bool
func (*PerformancePredictorManager) PredictBandwidth ¶
func (m *PerformancePredictorManager) PredictBandwidth(ctx context.Context, request PredictionRequest) (*BandwidthPrediction, error)
PredictBandwidth predicts bandwidth with fallback support
func (*PerformancePredictorManager) StoreNetworkMetrics ¶
func (m *PerformancePredictorManager) StoreNetworkMetrics(ctx context.Context, metrics NetworkMetrics) error
Delegate other methods to primary predictor
func (*PerformancePredictorManager) StoreWorkloadCharacteristics ¶
func (m *PerformancePredictorManager) StoreWorkloadCharacteristics(ctx context.Context, workload WorkloadCharacteristics) error
type PredictionRequest ¶
type PredictionRequest struct {
SourceNode string `json:"source_node"`
TargetNode string `json:"target_node"`
WorkloadChars WorkloadCharacteristics `json:"workload"`
TimeHorizonHours int `json:"time_horizon_hours"`
ConfidenceLevel float64 `json:"confidence_level"`
IncludeUncertainty bool `json:"include_uncertainty"`
}
PredictionRequest represents a bandwidth prediction request
type PredictorFactory ¶
type PredictorFactory struct {
// contains filtered or unexported fields
}
PredictorFactory creates performance predictors based on configuration
func NewPredictorFactory ¶
func NewPredictorFactory(logger *log.Logger) *PredictorFactory
NewPredictorFactory creates a new predictor factory
func (*PredictorFactory) CreatePredictor ¶
func (f *PredictorFactory) CreatePredictor(predictorType string, config map[string]interface{}) (PerformancePredictor, error)
CreatePredictor creates a performance predictor based on type
type QoSAction ¶
type QoSAction struct {
Type string `json:"type"`
RateLimit uint64 `json:"rate_limit,omitempty"`
BurstLimit uint64 `json:"burst_limit,omitempty"`
Priority int `json:"priority,omitempty"`
DSCPMark int `json:"dscp_mark,omitempty"`
QueueName string `json:"queue_name,omitempty"`
Parameters map[string]string `json:"parameters,omitempty"`
}
type QoSManager ¶
type QoSManager struct {
// contains filtered or unexported fields
}
func NewQoSManager ¶
func NewQoSManager(config *QoSManagerConfig, bandwidthMonitor *BandwidthMonitor, logger *zap.Logger) *QoSManager
func (*QoSManager) AddPolicy ¶
func (qm *QoSManager) AddPolicy(policy *QoSPolicy) error
func (*QoSManager) GetInterfacePolicies ¶
func (qm *QoSManager) GetInterfacePolicies(interfaceName string) []*QoSPolicy
func (*QoSManager) GetNetworkQoSStatus ¶
func (qm *QoSManager) GetNetworkQoSStatus(networkID string) map[string]interface{}
func (*QoSManager) ListPolicies ¶
func (qm *QoSManager) ListPolicies() []*QoSPolicy
func (*QoSManager) RemovePolicy ¶
func (qm *QoSManager) RemovePolicy(policyID string) error
func (*QoSManager) Start ¶
func (qm *QoSManager) Start() error
func (*QoSManager) Stop ¶
func (qm *QoSManager) Stop() error
type QoSManagerConfig ¶
type QoSManagerConfig struct {
EnableTrafficShaping bool `json:"enable_traffic_shaping"`
EnableDSCPMarking bool `json:"enable_dscp_marking"`
UpdateInterval time.Duration `json:"update_interval"`
DefaultPolicies []*QoSPolicy `json:"default_policies"`
StatisticsRetention time.Duration `json:"statistics_retention"`
MaxPoliciesPerInterface int `json:"max_policies_per_interface"`
DefaultRateBps uint64 `json:"default_rate_bps"` // Default rate for root qdisc
}
type QoSPolicy ¶
type QoSPolicy struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
NetworkID string `json:"network_id"`
InterfaceName string `json:"interface_name"`
Priority int `json:"priority"`
Rules []ClassificationRule `json:"rules"`
Actions []QoSAction `json:"actions"`
Statistics QoSStatistics `json:"statistics"`
Enabled bool `json:"enabled"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Metadata map[string]string `json:"metadata"`
}
type QoSRule ¶
type QoSRule struct {
ID string
Priority int
MatchCriteria RuleMatch
BandwidthMin int64
BandwidthMax int64
LatencyMax time.Duration
DSCP int
Class string
}
QoSRule represents a Quality of Service rule
type QoSStatistics ¶
type QoSStatistics struct {
PacketsMatched uint64 `json:"packets_matched"`
BytesMatched uint64 `json:"bytes_matched"`
PacketsDropped uint64 `json:"packets_dropped"`
BytesDropped uint64 `json:"bytes_dropped"`
QueueLength int `json:"queue_length"`
AverageLatency float64 `json:"average_latency_ms"`
LastUpdated time.Time `json:"last_updated"`
ThroughputBps uint64 `json:"throughput_bps"`
UtilizationPercent float64 `json:"utilization_percent"`
}
type QueueConfig ¶
type QueueConfig struct {
Name string `json:"name"`
Type string `json:"type"`
MinRate uint64 `json:"min_rate"`
MaxRate uint64 `json:"max_rate"`
BurstSize uint64 `json:"burst_size"`
Priority int `json:"priority"`
Weight int `json:"weight"`
QueueLimit int `json:"queue_limit"`
REDMinThresh int `json:"red_min_thresh,omitempty"`
REDMaxThresh int `json:"red_max_thresh,omitempty"`
REDProbability float64 `json:"red_probability,omitempty"`
}
type QueueManager ¶
type QueueManager struct {
// contains filtered or unexported fields
}
func NewQueueManager ¶
func NewQueueManager(logger *zap.Logger) *QueueManager
func (*QueueManager) CreateQueue ¶
func (qm *QueueManager) CreateQueue(config *QueueConfig) error
func (*QueueManager) GetQueueStatistics ¶
func (qm *QueueManager) GetQueueStatistics(queueName string) (*QoSStatistics, error)
func (*QueueManager) UpdateQueueStatistics ¶
func (qm *QueueManager) UpdateQueueStatistics(queueName string, stats *QoSStatistics) error
type RuleAction ¶
type RuleAction struct {
Type ActionType
Target string
Parameters map[string]interface{}
}
RuleAction defines actions to take on matched traffic
type RuleMatch ¶
type RuleMatch struct {
SrcIP *net.IPNet
DstIP *net.IPNet
SrcPort int
DstPort int
Protocol string
Interface string
}
RuleMatch defines matching criteria for network rules
type SecurityConfig ¶
type SecurityConfig struct {
// EnableEncryption enables message encryption
EnableEncryption bool
// EnableSignature enables message signing
EnableSignature bool
// TLSCertFile is the path to the TLS certificate file
TLSCertFile string
// TLSKeyFile is the path to the TLS key file
TLSKeyFile string
// AutoGenerateTLSCert automatically generates a TLS certificate if none is provided
AutoGenerateTLSCert bool
// TLSCertValidDuration is the duration for which the auto-generated TLS certificate is valid
TLSCertValidDuration time.Duration
}
SecurityConfig contains configuration for the security layer
func DefaultSecurityConfig ¶
func DefaultSecurityConfig() SecurityConfig
DefaultSecurityConfig returns a default security configuration
type SecurityContext ¶
type SecurityContext struct {
// PrivateKey is the private key used for signing
PrivateKey *ecdsa.PrivateKey
// PublicKey is the public key used for verification
PublicKey *ecdsa.PublicKey
// PeerPublicKeys maps peer IDs to their public keys
PeerPublicKeys map[string]*ecdsa.PublicKey
// EncryptionKeys maps peer IDs to their encryption keys
EncryptionKeys map[string][]byte
// TLSConfig is the TLS configuration
TLSConfig *tls.Config
// contains filtered or unexported fields
}
SecurityContext contains the security context for a peer
func NewSecurityContext ¶
func NewSecurityContext() (*SecurityContext, error)
NewSecurityContext creates a new security context
func (*SecurityContext) AddPeerPublicKey ¶
func (s *SecurityContext) AddPeerPublicKey(peerID string, publicKey *ecdsa.PublicKey)
AddPeerPublicKey adds a peer's public key
func (*SecurityContext) DecodePublicKeyMessage ¶
func (s *SecurityContext) DecodePublicKeyMessage(payload []byte) (*ecdsa.PublicKey, error)
DecodePublicKeyMessage decodes a public key message
func (*SecurityContext) DecryptMessage ¶
func (s *SecurityContext) DecryptMessage(msg *Message, peerID string) (*Message, error)
DecryptMessage decrypts a message from a peer
func (*SecurityContext) DeriveSharedEncryptionKey ¶
func (s *SecurityContext) DeriveSharedEncryptionKey(peerID string, peerPublicKey *ecdsa.PublicKey) ([]byte, error)
DeriveSharedEncryptionKey derives a shared encryption key using ECDH
func (*SecurityContext) EncodePublicKeyMessage ¶
func (s *SecurityContext) EncodePublicKeyMessage() ([]byte, error)
EncodePublicKeyMessage encodes a public key message
func (*SecurityContext) EncryptMessage ¶
func (s *SecurityContext) EncryptMessage(msg *Message, peerID string) (*Message, error)
EncryptMessage encrypts a message for a peer
func (*SecurityContext) ExportPublicKey ¶
func (s *SecurityContext) ExportPublicKey() (string, error)
ExportPublicKey exports the public key as a base64-encoded string
func (*SecurityContext) GenerateEncryptionKey ¶
func (s *SecurityContext) GenerateEncryptionKey(peerID string) ([]byte, error)
GenerateEncryptionKey generates a new encryption key for a peer
func (*SecurityContext) GetEncryptionKey ¶
func (s *SecurityContext) GetEncryptionKey(peerID string) ([]byte, bool)
GetEncryptionKey gets the encryption key for a peer
func (*SecurityContext) GetPeerPublicKey ¶
func (s *SecurityContext) GetPeerPublicKey(peerID string) (*ecdsa.PublicKey, bool)
GetPeerPublicKey gets a peer's public key
func (*SecurityContext) ImportPublicKey ¶
func (s *SecurityContext) ImportPublicKey(encoded string) (*ecdsa.PublicKey, error)
ImportPublicKey imports a public key from a base64-encoded string
func (*SecurityContext) ProtectMessage ¶
func (s *SecurityContext) ProtectMessage(msg *Message, peerID string, encrypt bool, sign bool) (*Message, error)
ProtectMessage applies encryption and/or signing to a message
func (*SecurityContext) SetEncryptionKey ¶
func (s *SecurityContext) SetEncryptionKey(peerID string, key []byte)
SetEncryptionKey sets the encryption key for a peer
func (*SecurityContext) SetupTLS ¶
func (s *SecurityContext) SetupTLS(config SecurityConfig) error
SetupTLS sets up TLS configuration from a certificate and key file
func (*SecurityContext) SignMessage ¶
func (s *SecurityContext) SignMessage(msg *Message) (*Message, error)
SignMessage signs a message
func (*SecurityContext) UnprotectMessage ¶
UnprotectMessage applies decryption and/or signature verification to a message
func (*SecurityContext) VerifyMessage ¶
VerifyMessage verifies a signed message
type SimulatedInterface ¶
type SimulatedInterface struct {
Name string
IP net.IP
Subnet *net.IPNet
MTU int
State InterfaceState
PacketsRx uint64
PacketsTx uint64
BytesRx uint64
BytesTx uint64
ErrorsRx uint64
ErrorsTx uint64
DroppedRx uint64
DroppedTx uint64
Latency time.Duration
Bandwidth int64 // bits per second
PacketLoss float64
Jitter time.Duration
Created time.Time
}
SimulatedInterface represents a simulated network interface
type SimulatedLink ¶
type SimulatedLink struct {
ID string
Source string
Destination string
Bandwidth int64
Latency time.Duration
PacketLoss float64
Jitter time.Duration
State LinkState
Traffic *TrafficStats
QoSRules []QoSRule
}
SimulatedLink represents a network link between interfaces
type TrafficClass ¶
type TrafficClass struct {
ID string `json:"id"`
Name string `json:"name"`
MinBandwidth uint64 `json:"min_bandwidth"`
MaxBandwidth uint64 `json:"max_bandwidth"`
Priority int `json:"priority"`
QueueType string `json:"queue_type"`
TcClassID string `json:"tc_class_id"` // Store traffic control class ID for consistent retrieval
Statistics QoSStatistics `json:"statistics"`
}
type TrafficClassifier ¶
type TrafficClassifier struct {
// contains filtered or unexported fields
}
func NewTrafficClassifier ¶
func NewTrafficClassifier(logger *zap.Logger) *TrafficClassifier
func (*TrafficClassifier) AddRule ¶
func (tc *TrafficClassifier) AddRule(interfaceName string, rule ClassificationRule) error
func (*TrafficClassifier) ClassifyPacket ¶
func (tc *TrafficClassifier) ClassifyPacket(interfaceName, srcIP, dstIP string, srcPort, dstPort int, protocol string) (*ClassificationRule, error)
type TrafficShaper ¶
type TrafficShaper struct {
// contains filtered or unexported fields
}
func NewTrafficShaper ¶
func NewTrafficShaper(logger *zap.Logger) *TrafficShaper
func (*TrafficShaper) AddTrafficClass ¶
func (ts *TrafficShaper) AddTrafficClass(interfaceName string, class *TrafficClass) error
func (*TrafficShaper) ApplyRateLimit ¶
func (ts *TrafficShaper) ApplyRateLimit(interfaceName, classID string, rate, burst uint64) error
func (*TrafficShaper) SetupInterface ¶
func (ts *TrafficShaper) SetupInterface(interfaceName string) error
type TrafficStats ¶
type TrafficStats struct {
PacketsPerSecond uint64
BytesPerSecond uint64
AverageLatency time.Duration
MaxLatency time.Duration
MinLatency time.Duration
PacketLoss float64
Utilization float64
}
TrafficStats tracks traffic statistics
type UDPPeer ¶
type UDPPeer struct {
// contains filtered or unexported fields
}
UDPPeer represents a remote peer connection over UDP
func (*UDPPeer) SendMessage ¶
SendMessage sends a message to the peer
type UDPTransport ¶
type UDPTransport struct {
// contains filtered or unexported fields
}
UDPTransport implements a UDP-based transport layer
func NewUDPTransport ¶
func NewUDPTransport(config UDPTransportConfig) (*UDPTransport, error)
NewUDPTransport creates a new UDP transport
func (*UDPTransport) Connect ¶
func (t *UDPTransport) Connect(addr string) (*UDPPeer, error)
Connect connects to a remote peer
type UDPTransportConfig ¶
type UDPTransportConfig struct {
ListenAddr string
ReadBufferSize int
WriteBufferSize int
ReceiveQueueSize int
SendQueueSize int
AckTimeout time.Duration
MaxRetries int
KeepAliveInterval time.Duration
ConnectionTimeout time.Duration
EnableFlowControl bool
BatchSendThreshold int // Minimum number of messages to trigger batch sending
BatchSendInterval time.Duration // Maximum time to wait before sending a batch
}
UDPTransportConfig contains configuration for the UDP transport
func DefaultUDPTransportConfig ¶
func DefaultUDPTransportConfig() UDPTransportConfig
DefaultUDPTransportConfig returns a default UDP transport configuration
type WorkloadCharacteristics ¶
type WorkloadCharacteristics struct {
VMID string `json:"vm_id"`
WorkloadType string `json:"workload_type"` // interactive, batch, streaming, compute
CPUCores int `json:"cpu_cores"`
MemoryGB float64 `json:"memory_gb"`
StorageGB float64 `json:"storage_gb"`
NetworkIntensive bool `json:"network_intensive"`
ExpectedConnections int `json:"expected_connections"`
DataTransferPattern string `json:"data_transfer_pattern"` // burst, steady, periodic
PeakHours []int `json:"peak_hours"`
HistoricalBandwidth float64 `json:"historical_bandwidth"`
}
WorkloadCharacteristics represents VM workload characteristics
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package dwcp implements the Distributed WAN Communication Protocol for NovaCron
|
Package dwcp implements the Distributed WAN Communication Protocol for NovaCron |
|
conflict
Package conflict provides advanced conflict detection and resolution for DWCP
|
Package conflict provides advanced conflict detection and resolution for DWCP |
|
health
Package health provides health checking and validation for DWCP components
|
Package health provides health checking and validation for DWCP components |
|
loadbalancing
Package loadbalancing provides global load balancing with geographic awareness for NovaCron's DWCP Phase 3 multi-region deployment.
|
Package loadbalancing provides global load balancing with geographic awareness for NovaCron's DWCP Phase 3 multi-region deployment. |
|
metrics
Package metrics provides metric collection logic for DWCP components
|
Package metrics provides metric collection logic for DWCP components |
|
monitoring
Package monitoring provides comprehensive multi-region monitoring and observability
|
Package monitoring provides comprehensive multi-region monitoring and observability |
|
observability
Package observability provides comprehensive observability for DWCP
|
Package observability provides comprehensive observability for DWCP |
|
partition/training
command
|
|
|
v3
Package v3 provides the v3 implementation of DWCP (Distributed Weighted Consensus Protocol) This package serves as a namespace for v3 consensus protocols including ProBFT, Bullshark, and T-PBFT
|
Package v3 provides the v3 implementation of DWCP (Distributed Weighted Consensus Protocol) This package serves as a namespace for v3 consensus protocols including ProBFT, Bullshark, and T-PBFT |
|
v3/consensus/probft
Package probft implements Probabilistic Byzantine Fault Tolerance consensus
|
Package probft implements Probabilistic Byzantine Fault Tolerance consensus |
|
v3/consensus/tpbft
Package tpbft implements Trust-based PBFT with EigenTrust reputation system
|
Package tpbft implements Trust-based PBFT with EigenTrust reputation system |
|
v3/optimization
Package optimization provides comprehensive benchmarks for DWCP v3.
|
Package optimization provides comprehensive benchmarks for DWCP v3. |