Documentation
¶
Index ¶
- Constants
- Variables
- func LoadOrCreateSigner(path string) (*pqcrypto.HybridSigner, error)
- func RandomChallenge() ([]byte, error)
- func ValidateServerTransport(listenAddress string, tlsEnabled, allowPrivateHTTP bool) error
- type Config
- type DiskStore
- func (s *DiskStore) BindIdentity(signer *pqcrypto.HybridSigner) error
- func (s *DiskStore) BoundIdentity() (protocol.NodePublicIdentity, bool)
- func (s *DiskStore) Close() error
- func (s *DiskStore) FetchLimited(routeTags []string, maxItems int, maxBytes int64) ([]protocol.StoredItem, bool)
- func (s *DiskStore) Get(itemID string) (protocol.StoredItem, error)
- func (s *DiskStore) IdentityInitializationAllowed() bool
- func (s *DiskStore) Put(item protocol.StoredItem) error
- func (s *DiskStore) Sweep(now time.Time) error
- func (s *DiskStore) SweepContext(ctx context.Context, now time.Time) error
- func (s *DiskStore) Used() int64
- type NodeSignerLease
- type Server
Constants ¶
const ( MaxStoredItems = 1_000_000 MaxItemsPerRoute = 1024 PerItemAccountingOverhead = 4 * 1024 MaxStoredItemEncodingBytes = protocol.DefaultMaxItemBytes*2 + 64*1024 MaxDeleteTombstoneBytes = 16 * 1024 )
Variables ¶
var ( ErrNotFound = errors.New("item not found") ErrMailboxQuota = errors.New("route-tag quota exceeded") ErrStorageFull = errors.New("node storage capacity exceeded") ErrStoreClosed = errors.New("node store is closed") ErrInvalidItemID = errors.New("invalid item id") ErrInvalidLimits = errors.New("invalid store limits") ErrItemDeleted = errors.New("item is covered by a delete tombstone") ErrCorruptStore = errors.New("node store contains an invalid or unmanaged record") ErrStoreIdentity = errors.New("node store identity does not match the signing key") ErrUnboundStore = errors.New("non-empty node store has no identity binding") )
var (
ErrNodeSigningKeyMissing = errors.New("node signing key is missing")
)
Functions ¶
func LoadOrCreateSigner ¶
func LoadOrCreateSigner(path string) (*pqcrypto.HybridSigner, error)
LoadOrCreateSigner is a one-shot provisioning helper. A running node must use AcquireNodeSigner so the identity cannot be active in two processes.
func RandomChallenge ¶
func ValidateServerTransport ¶
ValidateServerTransport prevents accidental public cleartext operation. Plain HTTP is permitted by default only on loopback and, with an explicit development switch, on literal private addresses. Unspecified/wildcard and public listeners always require TLS.
Types ¶
type Config ¶
type Config struct {
ListenAddress string
DataDir string
KeyFile string
BaseDifficulty uint8
EpochSeconds int64
MaxItemBytes int
StorageCapacity int64
MailboxQuota int64
MaxFetchItems int
MaxFetchBytes int64
SweepInterval time.Duration
MaxConcurrentRequests int
}
func DefaultConfig ¶
func DefaultConfig() Config
func (Config) EffectiveDifficulty ¶
type DiskStore ¶
type DiskStore struct {
// contains filtered or unexported fields
}
func (*DiskStore) BindIdentity ¶
func (s *DiskStore) BindIdentity(signer *pqcrypto.HybridSigner) error
BindIdentity permanently ties this store directory to the node's hybrid signing identity. Existing pre-binding stores must be empty so accidentally replacing a lost key can never make old retained data appear under a new node identity.
func (*DiskStore) BoundIdentity ¶
func (s *DiskStore) BoundIdentity() (protocol.NodePublicIdentity, bool)
BoundIdentity returns the authenticated identity persisted in this store.
func (*DiskStore) FetchLimited ¶
func (*DiskStore) IdentityInitializationAllowed ¶
IdentityInitializationAllowed reports whether a fresh identity binding can be created without orphaning retained items or tombstones.
func (*DiskStore) SweepContext ¶
SweepContext removes expired records in bounded batches. The store mutex is released between batches so shutdown never waits behind up to MaxStoredItems filesystem mutations.
type NodeSignerLease ¶
type NodeSignerLease struct {
Signer *pqcrypto.HybridSigner
Created bool
// contains filtered or unexported fields
}
NodeSignerLease keeps exclusive ownership of a node identity for the whole server lifetime. Closing it allows a later process to acquire the identity.
func AcquireNodeSigner ¶
func AcquireNodeSigner(path string, allowCreate bool) (*NodeSignerLease, error)
AcquireNodeSigner loads a node signer under a nonblocking lifetime lease. When allowCreate is false, a missing key fails closed instead of silently changing an identity already bound to retained node data.
func (*NodeSignerLease) Close ¶
func (lease *NodeSignerLease) Close() error