federated

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivationType

type ActivationType int
const (
	ReLU ActivationType = iota
	Sigmoid
	Tanh
	Softmax
	LeakyReLU
	ELU
	GELU
	Swish
)

type AggregatedUpdate

type AggregatedUpdate struct {
	UpdateID          string
	RoundID           string
	AggregatedWeights []float64
	ParticipantCount  int
	TotalSamples      int64
	QualityScore      float64
	PrivacyBudgetUsed float64
	AggregationMethod AggregationStrategy
	ValidationResults *ValidationResults
	Timestamp         time.Time
}

type AggregationStrategy

type AggregationStrategy int
const (
	FederatedAveraging AggregationStrategy = iota
	SecureAggregation_Strategy
	DifferentialPrivateAggregation
	HomomorphicAggregation
	TrustedExecutionAggregation
	MultiPartyComputation
	ZeroKnowledgeAggregation
	BlockchainBasedAggregation
	ConsensusBasedAggregation
	AdaptiveAggregation
)

type AnonymizationLevel

type AnonymizationLevel int
const (
	NoAnonymization AnonymizationLevel = iota
	BasicAnonymization
	KAnonymity
	LDiversity
	TCloseness
	DifferentialAnonymization
)

type AttackRecord

type AttackRecord struct {
	AttackID        string
	AttackType      string
	TargetModel     string
	Payload         string
	Success         bool
	Confidence      float64
	Timestamp       time.Time
	ContextFeatures map[string]interface{}
	Metadata        map[string]interface{}
}

type CertificateStore

type CertificateStore struct{}

type ComparisonOperator

type ComparisonOperator int
const (
	Equals ComparisonOperator = iota
	NotEquals
	GreaterThan
	LessThan
	GreaterEqual
	LessEqual
	Contains
	StartsWith
	EndsWith
	Matches
)

type CompressionType

type CompressionType int
const (
	NoCompression CompressionType = iota
	GZIPCompression
	LZ4Compression
	ZSTDCompression
	BrotliCompression
	CustomCompression
)

type ComputeCapacity

type ComputeCapacity struct {
	CPUCores  int
	MemoryGB  float64
	GPUCount  int
	StorageGB float64
}

type Condition

type Condition struct {
	ConditionID string
	Type        ConditionType
	Operator    ComparisonOperator
	Value       interface{}
	Weight      float64
}

type ConditionType

type ConditionType int
const (
	ModelCondition ConditionType = iota
	PayloadCondition
	ContextCondition
	TimingCondition
	EnvironmentalCondition
	TechnicalCondition
)

type Connection

type Connection struct {
	FromLayer string
	ToLayer   string
	Weight    float64
	Bias      float64
}

type ConsensusEngine

type ConsensusEngine struct {
	ConsensusType   ConsensusType
	ValidatorNodes  []*FederatedNode
	ConsensusRules  []*ConsensusRule
	VotingMechanism VotingMechanism
	QuorumThreshold float64
	TimeoutDuration time.Duration
}

func NewConsensusEngine

func NewConsensusEngine() *ConsensusEngine

func (*ConsensusEngine) ValidateUpdate

func (ce *ConsensusEngine) ValidateUpdate(ctx context.Context, update *AggregatedUpdate, participants []*FederatedNode) (*ConsensusResult, error)

type ConsensusResult

type ConsensusResult struct {
	ConsensusID      string
	RoundID          string
	DecisionType     DecisionType
	Result           interface{}
	VoteCount        map[string]int
	Confidence       float64
	ParticipantCount int
	QuorumAchieved   bool
	Timestamp        time.Time
}

type ConsensusRule

type ConsensusRule struct {
	RuleID    string
	RuleType  RuleType
	Condition string
	Action    string
	Priority  int
	Enabled   bool
}

type ConsensusType

type ConsensusType int
const (
	ProofOfWork ConsensusType = iota
	ProofOfStake
	ProofOfAuthority
	ByzantineFaultTolerant
	PracticalByzantineFaultTolerant
	DelegatedProofOfStake
	FederatedByzantineAgreement
	TenderminConsensus
)

type ConsentType

type ConsentType int
const (
	ModelTraining ConsentType = iota
	DataAggregation
	PatternSharing
	MetricsSharing
	ResearchUse
	CommercialUse
)

type ContributionRecord

type ContributionRecord struct {
	ContributionID string
	RoundID        string
	Timestamp      time.Time
	QualityScore   float64
	DataSamples    int64
}

type ConvergenceStatus

type ConvergenceStatus int
const (
	NotConverged ConvergenceStatus = iota
	Converging
	Converged
	Diverging
	Oscillating
	Stagnating
)

type CoordinatorNode

type CoordinatorNode struct {
	NodeID string
}

func NewCoordinatorNode

func NewCoordinatorNode() *CoordinatorNode

type CredentialValidationResult

type CredentialValidationResult struct {
	Valid  bool
	Reason string
	Score  float64
}

type CrossValidationResults

type CrossValidationResults struct {
	FoldCount          int
	AverageAccuracy    float64
	StandardDeviation  float64
	MinAccuracy        float64
	MaxAccuracy        float64
	ConfidenceInterval [2]float64
}

type DataSharingLevel

type DataSharingLevel int
const (
	NoSharing DataSharingLevel = iota
	AggregatedOnly
	PrivatizedData
	AnonymizedData
	PseudonymizedData
	FullSharing
)

type DecisionType

type DecisionType int
const (
	ModelAcceptance DecisionType = iota
	ParameterUpdate
	NodeValidation
	RuleModification
	PrivacyPolicy
	SecurityPolicy
)

type DifferentialPrivacyEngine

type DifferentialPrivacyEngine struct{}

func NewDifferentialPrivacyEngine

func NewDifferentialPrivacyEngine() *DifferentialPrivacyEngine

func (*DifferentialPrivacyEngine) AddNoise

func (dp *DifferentialPrivacyEngine) AddNoise(update *LocalUpdate, privacyBudget float64) (*LocalUpdate, error)

type DifferentialPrivacyParameters

type DifferentialPrivacyParameters struct {
	Epsilon         float64
	Delta           float64
	SensitivityL1   float64
	SensitivityL2   float64
	ClippingBound   float64
	NoiseMultiplier float64
}

type DistributedKnowledgeGraph

type DistributedKnowledgeGraph struct{}

func NewDistributedKnowledgeGraph

func NewDistributedKnowledgeGraph() *DistributedKnowledgeGraph

type EncryptionType

type EncryptionType int
const (
	AESEncryption EncryptionType = iota
	RSAEncryption
	ECCEncryption
	ChaCha20Encryption
	TLSEncryption
	E2EEncryption
)

type FailurePattern

type FailurePattern struct {
	PatternID   string
	Conditions  []Condition
	FailureRate float64
}

type FederatedAttackLearningEngine

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

FederatedAttackLearningEngine implements privacy-preserving distributed attack learning Enables collaborative knowledge sharing across multiple attack instances without revealing sensitive data

func NewFederatedAttackLearningEngine

func NewFederatedAttackLearningEngine(logger common.AuditLogger) *FederatedAttackLearningEngine

NewFederatedAttackLearningEngine creates a new federated learning engine

func (*FederatedAttackLearningEngine) JoinFederatedNetwork

func (e *FederatedAttackLearningEngine) JoinFederatedNetwork(ctx context.Context, nodeRequest *NodeJoinRequest) (*FederatedNode, error)

JoinFederatedNetwork allows a new node to join the federated learning network

func (*FederatedAttackLearningEngine) ProcessLocalUpdates

func (e *FederatedAttackLearningEngine) ProcessLocalUpdates(ctx context.Context, roundID string) (*AggregatedUpdate, error)

ProcessLocalUpdates collects and processes local updates from participants

func (*FederatedAttackLearningEngine) StartFederatedLearningRound

func (e *FederatedAttackLearningEngine) StartFederatedLearningRound(ctx context.Context, participants []*FederatedNode, globalModel *GlobalAttackModel) (*FederatedRound, error)

StartFederatedLearningRound initiates a new federated learning round

type FederatedLearningType

type FederatedLearningType int
const (
	HorizontalFederated FederatedLearningType = iota
	VerticalFederated
	FederatedTransferLearning
	PersonalizedFederated
	CrossSiloFederated
	CrossDeviceFederated
	HierarchicalFederated
	AsynchronousFederated
	SecureAggregation
	PrivacyPreservingFederated
)

type FederatedMessage

type FederatedMessage struct {
	MessageID   string
	MessageType MessageType
	Sender      string
	Receiver    string
	Payload     []byte
	Priority    Priority
	Timestamp   time.Time
	Signature   string
	Encrypted   bool
}

type FederatedNode

type FederatedNode struct {
	NodeID              string
	NodeType            NodeType
	PublicKey           *rsa.PublicKey
	PrivateKey          *rsa.PrivateKey
	LocalData           *LocalAttackData
	LocalModel          *LocalAttackModel
	ReputationScore     float64
	PrivacyPreferences  *PrivacyPreferences
	ComputeCapacity     *ComputeCapacity
	NetworkProfile      *NetworkProfile
	TrustLevel          TrustLevel
	LastSeen            time.Time
	ContributionHistory []ContributionRecord
}

type FederatedNodeManager

type FederatedNodeManager struct{}

func NewFederatedNodeManager

func NewFederatedNodeManager() *FederatedNodeManager

func (*FederatedNodeManager) RegisterNode

func (nm *FederatedNodeManager) RegisterNode(ctx context.Context, node *FederatedNode) error

type FederatedRound

type FederatedRound struct {
	RoundID          string
	RoundNumber      int
	StartTime        time.Time
	EndTime          time.Time
	Participants     []*FederatedNode
	GlobalModel      *GlobalAttackModel
	LocalUpdates     map[string]*LocalUpdate
	AggregatedUpdate *AggregatedUpdate
	PrivacyBudget    float64
	ConsensusResult  *ConsensusResult
	RoundMetrics     *RoundMetrics
	Status           RoundStatus
}

type GlobalAttackModel

type GlobalAttackModel struct {
	ModelID           string
	GlobalWeights     []float64
	ModelStructure    *ModelStructure
	AggregationRound  int
	ParticipantCount  int
	GlobalMetrics     *GlobalMetrics
	ConvergenceStatus ConvergenceStatus
	Version           int
	LastUpdated       time.Time
	QualityScore      float64
}

type GlobalMetrics

type GlobalMetrics struct {
	TotalRounds            int
	ActiveParticipants     int
	AveragePerformance     float64
	ConvergenceHistory     []float64
	PrivacyBudgetRemaining float64
	TotalDataSamples       int64
	SystemThroughput       float64
	LatencyMetrics         *LatencyMetrics
}

type HomomorphicCryptographyEngine

type HomomorphicCryptographyEngine struct{}

func NewHomomorphicCryptographyEngine

func NewHomomorphicCryptographyEngine() *HomomorphicCryptographyEngine

type LatencyMetrics

type LatencyMetrics struct {
	AverageLatency  time.Duration
	P50Latency      time.Duration
	P95Latency      time.Duration
	P99Latency      time.Duration
	MaxLatency      time.Duration
	LatencyVariance float64
}

type Layer

type Layer struct {
	LayerID    string
	LayerType  LayerType
	InputSize  int
	OutputSize int
	Activation ActivationType
	Parameters map[string]interface{}
}

type LayerType

type LayerType int
const (
	DenseLayer LayerType = iota
	ConvolutionalLayer
	RecurrentLayer
	AttentionLayer
	EmbeddingLayer
	DropoutLayer
	BatchNormLayer
	ActivationLayer
)

type LocalAttackData

type LocalAttackData struct {
	DataID          string
	AttackHistory   []*AttackRecord
	SuccessPatterns []*SuccessPattern
	FailurePatterns []*FailurePattern
	TargetProfiles  []*TargetProfile
	Techniques      []*TechniqueRecord
	Vulnerabilities []*VulnerabilityRecord
	DataSize        int64
	DataQuality     float64
	PrivacyLevel    PrivacyLevel
	LastUpdated     time.Time
}

type LocalAttackModel

type LocalAttackModel struct {
	ModelID            string
	ModelType          ModelType
	ModelWeights       []float64
	ModelStructure     *ModelStructure
	TrainingHistory    []*TrainingRecord
	PerformanceMetrics *PerformanceMetrics
	Hyperparameters    map[string]interface{}
	Version            int
	LastTrained        time.Time
}

type LocalUpdate

type LocalUpdate struct {
	UpdateID        string
	NodeID          string
	ModelDelta      []float64
	GradientUpdate  []float64
	LossImprovement float64
	SampleCount     int64
	ComputationTime time.Duration
	PrivacyNoise    *PrivacyNoise
	Signature       string
	Timestamp       time.Time
}

type MessageQueue

type MessageQueue struct {
	QueueType     QueueType
	Messages      []*FederatedMessage
	Capacity      int
	PriorityQueue bool
	Persistence   bool
}

type MessageType

type MessageType int
const (
	ModelUpdate MessageType = iota
	AggregationRequest
	ConsensusVote
	ValidationRequest
	HeartbeatMessage
	JoinRequest
	LeaveRequest
	ErrorReport
)

type ModelAggregationEngine

type ModelAggregationEngine struct{}

func NewModelAggregationEngine

func NewModelAggregationEngine() *ModelAggregationEngine

func (*ModelAggregationEngine) AggregateUpdates

func (ae *ModelAggregationEngine) AggregateUpdates(ctx context.Context, updates map[string]*LocalUpdate, globalModel *GlobalAttackModel) (*AggregatedUpdate, error)

type ModelStructure

type ModelStructure struct {
	Layers      []*Layer
	Connections []*Connection
	Parameters  int64
	Complexity  float64
}

type ModelType

type ModelType int
const (
	NeuralNetworkModel ModelType = iota
	EnsembleModel
	RuleBasedModel
	StatisticalModel
	ReinforcementLearningModel
	TransformerModel
	ConvolutionalModel
	RecurrentModel
	AttentionModel
	HybridModel
)

type NetworkProfile

type NetworkProfile struct {
	Bandwidth      float64
	Latency        time.Duration
	Reliability    float64
	ConnectionType string
}

type NetworkTopology

type NetworkTopology struct{}

type NodeCredentials

type NodeCredentials struct {
	Certificate string
	Signature   string
	Timestamp   time.Time
}

type NodeJoinRequest

type NodeJoinRequest struct {
	NodeType           NodeType
	PublicKey          *rsa.PublicKey
	PrivateKey         *rsa.PrivateKey
	LocalData          *LocalAttackData
	PrivacyPreferences *PrivacyPreferences
	ComputeCapacity    *ComputeCapacity
	NetworkProfile     *NetworkProfile
	Credentials        *NodeCredentials
}

type NodeType

type NodeType int
const (
	CoordinatorNodeType NodeType = iota
	ParticipantNode
	ValidatorNode
	AggregatorNode
	BootstrapNode
	EdgeNode
	CloudNode
	MobileNode
	IoTNode
	SpecializedNode
)

type NoiseType

type NoiseType int
const (
	GaussianNoise NoiseType = iota
	LaplacianNoise
	ExponentialNoise
	DiscreteNoise
	CompoundNoise
	AdaptiveNoise
)

type PatternType

type PatternType int
const (
	SequentialPattern PatternType = iota
	ConditionalPattern
	TemporalPattern
	ContextualPattern
	TechnicalPattern
	BehavioralPattern
	StatisticalPattern
	CausalPattern
)

type PerformanceMetrics

type PerformanceMetrics struct {
	Accuracy           float64
	Precision          float64
	Recall             float64
	F1Score            float64
	AUC                float64
	Loss               float64
	TrainingTime       time.Duration
	InferenceTime      time.Duration
	MemoryUsage        int64
	ComputeUtilization float64
}

type Priority

type Priority int
const (
	LowPriority Priority = iota
	NormalPriority
	HighPriority
	CriticalPriority
	EmergencyPriority
)

type PrivacyLevel

type PrivacyLevel int
const (
	PublicData PrivacyLevel = iota
	SensitiveData
	HighlyConfidentialData
	ClassifiedData
	TopSecretData
)

type PrivacyMechanism

type PrivacyMechanism int
const (
	DifferentialPrivacy PrivacyMechanism = iota
	HomomorphicEncryption
	SecureMultipartyComputation
	TrustedExecutionEnvironment
	ZeroKnowledgeProofs
	LocalDifferentialPrivacy
	FunctionalEncryption
	SecretSharing
	GarbledCircuits
	PrivateSetIntersection
)

type PrivacyNoise

type PrivacyNoise struct {
	NoiseType     NoiseType
	NoiseLevel    float64
	Epsilon       float64
	Delta         float64
	Sensitivity   float64
	ClippingNorm  float64
	NoiseVariance float64
}

type PrivacyPreferences

type PrivacyPreferences struct {
	PrivacyBudget      float64
	NoiseLevel         float64
	DataSharing        DataSharingLevel
	AnonymizationLevel AnonymizationLevel
	ConsentTypes       []ConsentType
	RetentionPeriod    time.Duration
}

type PrivacyPreservationEngine

type PrivacyPreservationEngine struct{}

func NewPrivacyPreservationEngine

func NewPrivacyPreservationEngine() *PrivacyPreservationEngine

type QualityCheck

type QualityCheck struct {
	CheckType QualityCheckType
	CheckName string
	Score     float64
	Passed    bool
	Threshold float64
	Details   string
}

type QualityCheckType

type QualityCheckType int
const (
	DataQualityCheck QualityCheckType = iota
	ModelQualityCheck
	PrivacyQualityCheck
	SecurityQualityCheck
	FairnessCheck
	RobustnessCheck
)

type QueueType

type QueueType int
const (
	FIFOQueue QueueType = iota
	LIFOQueue
	PriorityQueue_Type
	DelayQueue
	CircularQueue
)

type ReputationSystem

type ReputationSystem struct{}

func NewReputationSystem

func NewReputationSystem() *ReputationSystem

type RoundMetrics

type RoundMetrics struct {
	ParticipationRate     float64
	ConvergenceRate       float64
	AggregationTime       time.Duration
	CommunicationOverhead int64
	PrivacyBudgetUsed     float64
	ModelQuality          float64
	ConsensusTime         time.Duration
	ValidationAccuracy    float64
}

type RoundStatus

type RoundStatus int
const (
	RoundInitializing RoundStatus = iota
	RoundActive
	RoundAggregating
	RoundCompleted
	RoundFailed
	RoundCancelled
)

type RoutingProtocol

type RoutingProtocol int
const (
	DirectRouting RoutingProtocol = iota
	BroadcastRouting
	MulticastRouting
	GossipProtocol
	DHRouting
	OnionRouting
)

type RuleType

type RuleType int
const (
	ValidationRule RuleType = iota
	QualityRule
	PrivacyRule
	SecurityRule
	PerformanceRule
	FairnessRule
)

type SecureCommunicationLayer

type SecureCommunicationLayer struct {
	EncryptionType   EncryptionType
	CertificateStore *CertificateStore
	MessageQueue     *MessageQueue
	NetworkTopology  *NetworkTopology
	RoutingProtocol  RoutingProtocol
	CompressionType  CompressionType
}

func NewSecureCommunicationLayer

func NewSecureCommunicationLayer() *SecureCommunicationLayer

func (*SecureCommunicationLayer) ReceiveUpdates

func (cl *SecureCommunicationLayer) ReceiveUpdates(roundID string) []*LocalUpdate

func (*SecureCommunicationLayer) SendMessage

func (cl *SecureCommunicationLayer) SendMessage(ctx context.Context, message *FederatedMessage) error

type StatisticalTest

type StatisticalTest struct {
	TestType  StatisticalTestType
	TestName  string
	PValue    float64
	Statistic float64
	Passed    bool
	Threshold float64
}

type StatisticalTestType

type StatisticalTestType int
const (
	TTest StatisticalTestType = iota
	ChiSquareTest
	KSTest
	MannWhitneyTest
	WilcoxonTest
	AndersonDarlingTest
)

type SuccessPattern

type SuccessPattern struct {
	PatternID        string
	PatternType      PatternType
	Conditions       []Condition
	SuccessRate      float64
	Confidence       float64
	Generalizability float64
	Techniques       []string
	Contexts         []string
}

type TargetProfile

type TargetProfile struct {
	ProfileID string
	ModelType string
	Features  map[string]interface{}
}

type TechniqueRecord

type TechniqueRecord struct {
	TechniqueID   string
	TechniqueName string
	SuccessRate   float64
	Contexts      []string
}

type TrainingRecord

type TrainingRecord struct {
	TrainingID string
	Timestamp  time.Time
	Epochs     int
	Loss       float64
	Accuracy   float64
}

type TrainingRequest

type TrainingRequest struct {
	RoundID        string
	TrainingEpochs int
	LearningRate   float64
	BatchSize      int
	PrivacyBudget  float64
}

type TrustLevel

type TrustLevel int
const (
	UntrustedNode TrustLevel = iota
	BasicTrust
	VerifiedTrust
	HighTrust
	CriticalTrust
)

type ValidationResults

type ValidationResults struct {
	ValidationID     string
	ValidationScore  float64
	TestAccuracy     float64
	CrossValidation  *CrossValidationResults
	StatisticalTests []StatisticalTest
	QualityChecks    []QualityCheck
	Passed           bool
}

type VotingMechanism

type VotingMechanism int
const (
	MajorityVoting VotingMechanism = iota
	WeightedVoting
	QuadraticVoting
	ApprovalVoting
	RankedChoiceVoting
	ConsensusVoting
)

type VulnerabilityRecord

type VulnerabilityRecord struct {
	VulnerabilityID string
	VulnType        string
	Severity        float64
	TargetModels    []string
}

Jump to

Keyboard shortcuts

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