Documentation
¶
Overview ¶
Package common provides shared utilities for ADCNet CLI commands.
Index ¶
- func FetchADCConfig(registryURL string) (*protocol.ADCNetConfig, error)
- func LoadOrGenerateExchangeKey(hexKey string) (*ecdh.PrivateKey, error)
- func LoadOrGenerateSigningKey(hexKey string) (crypto.PrivateKey, error)
- func NewAttestationProvider(cfg AttestationConfig) services.TEEProvider
- func NewMeasurementSource(measurementsURL string) services.MeasurementSource
- func ToServicesType(s string) (services.ServiceType, error)
- type AttestationConfig
- type Config
- type KeysConfig
- type ProtocolConfig
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FetchADCConfig ¶
func FetchADCConfig(registryURL string) (*protocol.ADCNetConfig, error)
FetchADCConfig retrieves protocol configuration from a registry.
func LoadOrGenerateExchangeKey ¶
func LoadOrGenerateExchangeKey(hexKey string) (*ecdh.PrivateKey, error)
LoadOrGenerateExchangeKey loads an ECDH P-256 private key from hex or generates one.
func LoadOrGenerateSigningKey ¶
func LoadOrGenerateSigningKey(hexKey string) (crypto.PrivateKey, error)
LoadOrGenerateSigningKey loads an Ed25519 private key from hex or generates one.
func NewAttestationProvider ¶
func NewAttestationProvider(cfg AttestationConfig) services.TEEProvider
NewAttestationProvider creates a TEE provider based on configuration.
func NewMeasurementSource ¶
func NewMeasurementSource(measurementsURL string) services.MeasurementSource
NewMeasurementSource creates a measurement source from configuration.
func ToServicesType ¶
func ToServicesType(s string) (services.ServiceType, error)
ToServicesType converts a string service type to services.ServiceType.
Types ¶
type AttestationConfig ¶
type AttestationConfig struct {
// UseTDX enables real TDX attestation.
UseTDX bool `yaml:"use_tdx"`
// TDXRemoteURL is the remote TDX attestation service URL.
TDXRemoteURL string `yaml:"tdx_remote_url"`
// MeasurementsURL is the URL for allowed measurements.
MeasurementsURL string `yaml:"measurements_url"`
}
AttestationConfig contains TEE attestation settings.
type Config ¶
type Config struct {
// ServiceType specifies which service to run: client, server, or aggregator.
ServiceType string `yaml:"service_type"`
// HTTPAddr is the address to listen on.
HTTPAddr string `yaml:"http_addr"`
// RegistryURL is the central registry for service discovery.
RegistryURL string `yaml:"registry_url"`
// AdminToken for authenticating with registry admin endpoints (user:pass).
AdminToken string `yaml:"admin_token"`
// Keys configuration.
Keys KeysConfig `yaml:"keys"`
// Attestation configuration.
Attestation AttestationConfig `yaml:"attestation"`
// Server-specific configuration.
Server ServerConfig `yaml:"server"`
// Protocol configuration (registry only).
Protocol ProtocolConfig `yaml:"protocol"`
}
Config contains configuration for ADCNet services.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns configuration with default values.
func LoadConfig ¶
LoadConfig reads configuration from a YAML file.
type KeysConfig ¶
type KeysConfig struct {
// SigningKey is hex-encoded Ed25519 private key. Generated if empty.
SigningKey string `yaml:"signing_key"`
// ExchangeKey is hex-encoded ECDH P-256 private key. Generated if empty.
ExchangeKey string `yaml:"exchange_key"`
}
KeysConfig contains cryptographic key settings.
type ProtocolConfig ¶
type ProtocolConfig struct {
// RoundDuration is the time duration of each protocol round.
RoundDuration time.Duration `yaml:"round_duration"`
// MessageLength is the byte length of the message vector.
MessageLength int `yaml:"message_length"`
// AuctionSlots is the number of slots in the IBLT for auction data.
AuctionSlots uint32 `yaml:"auction_slots"`
// MinClients is the minimum number of clients for anonymity.
MinClients uint32 `yaml:"min_clients"`
// RoundsPerWindow defines rounds per participation window.
RoundsPerWindow uint32 `yaml:"rounds_per_window"`
}
ProtocolConfig contains ADCNet protocol parameters.
func (*ProtocolConfig) ToADCNetConfig ¶
func (p *ProtocolConfig) ToADCNetConfig() *protocol.ADCNetConfig
ToADCNetConfig converts ProtocolConfig to protocol.ADCNetConfig.
type ServerConfig ¶
type ServerConfig struct {
// IsLeader designates this server as the round leader.
IsLeader bool `yaml:"is_leader"`
}
ServerConfig contains server-specific settings.