Documentation
¶
Index ¶
- Constants
- func CreateLibp2pHost(port int) (host.Host, error)
- type Factory
- type MDNSDiscovery
- type MdnsNotifee
- type PeerInfo
- type SyncResult
- type SyncService
- func (s *SyncService) AddTrustedPeer(ctx context.Context, peerID peer.ID) error
- func (s *SyncService) GetPeerFingerprint(peerID peer.ID) (string, error)
- func (s *SyncService) HasPeer(id peer.ID) bool
- func (s *SyncService) RegisterProtocols(ctx context.Context)
- func (s *SyncService) SetTrustAllPeers(trustAll bool)
- func (s *SyncService) StoreChunk(hash string, data []byte, encryptedHash string) error
- func (s *SyncService) SyncWithPeer(ctx context.Context, peerID peer.ID) (*SyncResult, error)
- func (s *SyncService) VerifyAndExchangeKeys(ctx context.Context, peerID peer.ID) (bool, error)
Constants ¶
const ( // Protocol IDs for different sync operations ManifestProtocolID = "/sietch/manifest/1.0.0" ManifestProtocolIDv0 = "/sietch/manifest/0.9.0" // Fallback version ChunkProtocolID = "/sietch/chunk/1.0.0" KeyExchangeProtocol = "/sietch/key-exchange/1.0.0" AuthProtocol = "/sietch/auth/1.0.0" // RSA encryption chunk size (must be smaller than key size to account for padding) RSAChunkSize = 256 // For 2048-bit keys )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Factory ¶
type Factory struct{}
type MDNSDiscovery ¶
type MDNSDiscovery struct {
// contains filtered or unexported fields
}
MDNSDiscovery implements the config.Discovery interface using mDNS
func NewMDNSDiscovery ¶
func NewMDNSDiscovery(h host.Host) (*MDNSDiscovery, error)
NewMDNSDiscovery creates a new mDNS discovery service
func (*MDNSDiscovery) DiscoveredPeers ¶
func (m *MDNSDiscovery) DiscoveredPeers() <-chan peer.AddrInfo
DiscoveredPeers returns channel of found peers
func (*MDNSDiscovery) GetPeerChan ¶
func (m *MDNSDiscovery) GetPeerChan() chan peer.AddrInfo
GetPeerChan returns the peer channel for notifee configuration
func (*MDNSDiscovery) SetService ¶
func (m *MDNSDiscovery) SetService(service mdns.Service)
SetService sets the mDNS service
type MdnsNotifee ¶
type MdnsNotifee struct {
// contains filtered or unexported fields
}
mdnsNotifee gets notified when new peers are discovered via mDNS
func (*MdnsNotifee) HandlePeerFound ¶
func (n *MdnsNotifee) HandlePeerFound(pi peer.AddrInfo)
HandlePeerFound implements the mdns.Notifee interface
type PeerInfo ¶
type PeerInfo struct {
ID peer.ID
PublicKey *rsa.PublicKey
Fingerprint string
Name string
TrustedSince time.Time
}
PeerInfo contains information about a trusted peer
type SyncResult ¶
type SyncResult struct {
FileCount int
ChunksTransferred int
ChunksDeduplicated int
BytesTransferred int64
Duration time.Duration
}
SyncResult contains statistics about a sync operation
type SyncService ¶
type SyncService struct {
Verbose bool // Enable verbose debug output
// contains filtered or unexported fields
}
SyncService handles vault synchronization
func NewSecureSyncService ¶
func NewSecureSyncService( h host.Host, vm *config.Manager, privateKey *rsa.PrivateKey, publicKey *rsa.PublicKey, rsaConfig *config.RSAConfig, ) (*SyncService, error)
NewSecureSyncService creates a new secure sync service with RSA key support
func NewSyncService ¶
NewSyncService creates a new sync service
func (*SyncService) AddTrustedPeer ¶
AddTrustedPeer adds a peer to the trusted peers list and saves to config
func (*SyncService) GetPeerFingerprint ¶
func (s *SyncService) GetPeerFingerprint(peerID peer.ID) (string, error)
GetPeerFingerprint returns the fingerprint of a peer's public key
func (*SyncService) HasPeer ¶
func (s *SyncService) HasPeer(id peer.ID) bool
HasPeer returns true if peer is already in trustedPeers map
func (*SyncService) RegisterProtocols ¶
func (s *SyncService) RegisterProtocols(ctx context.Context)
RegisterProtocols sets up all protocol handlers
func (*SyncService) SetTrustAllPeers ¶
func (s *SyncService) SetTrustAllPeers(trustAll bool)
SetTrustAllPeers sets whether to automatically trust all peers
func (*SyncService) StoreChunk ¶
func (s *SyncService) StoreChunk(hash string, data []byte, encryptedHash string) error
StoreChunk stores a chunk and handles the relationship between regular and encrypted hashes
func (*SyncService) SyncWithPeer ¶
func (s *SyncService) SyncWithPeer(ctx context.Context, peerID peer.ID) (*SyncResult, error)
SyncWithPeer performs a sync operation with a specific peer
func (*SyncService) VerifyAndExchangeKeys ¶
VerifyAndExchangeKeys performs key exchange with a peer