types

package
v0.0.0-...-9146c5d Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Analytics and statistics types

User authentication and management types

Configuration and settings types

Moderation and content blocking types

Network communication and streaming types

Bitcoin wallet and transaction types

Index

Constants

View Source
const (
	MinMonthlyLimitBytes = 1048576       // 1 MB minimum
	MaxMonthlyLimitBytes = 1099511627776 // 1 TB maximum
)

Validation constants for subscription tier limits

Variables

This section is empty.

Functions

This section is empty.

Types

type APNSConfig

type APNSConfig struct {
	Enabled    bool   `mapstructure:"enabled"`
	KeyID      string `mapstructure:"key_id"`
	TeamID     string `mapstructure:"team_id"`
	BundleID   string `mapstructure:"bundle_id"`
	KeyPath    string `mapstructure:"key_path"`
	Production bool   `mapstructure:"production"`
}

APNSConfig holds Apple Push Notification Service configuration

type ActiveToken

type ActiveToken struct {
	ID        uint   `gorm:"primaryKey;type:INTEGER AUTO_INCREMENT"`
	UserID    uint   `gorm:"uniqueIndex"`
	Token     string `gorm:"size:512;uniqueIndex"` // Maximum allowed size for indexed columns
	ExpiresAt string `gorm:"type:VARCHAR[64]"`     // Changed to string to store formatted time
}

ActiveToken represents an active authentication token

type ActivityData

type ActivityData struct {
	Month   string  `json:"month"`
	TotalGB float64 `json:"total_gb"`
}

ActivityData represents activity analytics data

type AdditionalDataEntry

type AdditionalDataEntry struct {
	Hash  HashBytes
	Key   string
	Value string
}

AdditionalDataEntry represents additional metadata for DAG entries NOTE: Indexes removed - lookups use composite key "root:pubkey:leafhash:key"

type Address

type Address struct {
	IndexHornets string     `json:"index,string"` // Use string tag to handle string-encoded integers
	Address      string     `json:"address"`
	WalletName   string     `json:"wallet_name"`
	Status       string     `json:"status" badgerhold:"index"`
	AllocatedAt  *time.Time `json:"allocated_at,omitempty"`
	Npub         string     `json:"npub,omitempty"`
}

Address represents an address structure to be stored in Graviton

type AddressResponse

type AddressResponse struct {
	IndexHornets string `json:"index"`
	Address      string `json:"address"`
}

AddressResponse represents a response containing address information

type AdminUser

type AdminUser struct {
	ID        uint      `gorm:"primaryKey"`
	Pass      string    // Store hashed passwords
	Npub      string    `gorm:"size:128"`
	CreatedAt time.Time `gorm:"autoCreateTime"`
	UpdatedAt time.Time `gorm:"autoUpdateTime"`
}

AdminUser represents an admin user

type AdvancedQueryMessage

type AdvancedQueryMessage struct {
	Filter QueryFilter
}

AdvancedQueryMessage represents an advanced query with structured filter

type AggregatedKindData

type AggregatedKindData struct {
	KindNumber int     `json:"kindNumber"`
	KindCount  int     `json:"kindCount"`
	TotalSize  float64 `json:"totalSize"`
}

AggregatedKindData represents aggregated data by event kind

type AllowedUser

type AllowedUser struct {
	Npub      string    `gorm:"primaryKey;size:128" json:"npub"`
	Tier      string    `gorm:"size:64" json:"tier"`
	CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
	CreatedBy string    `gorm:"size:128" json:"created_by"`
}

type AllowedUsersSettings

type AllowedUsersSettings struct {
	Mode        string             `json:"mode" mapstructure:"mode"`   // only-me, invite-only, public, subscription
	Read        string             `json:"read" mapstructure:"read"`   // all_users, paid_users, allowed_users, only-me
	Write       string             `json:"write" mapstructure:"write"` // all_users, paid_users, allowed_users, only-me
	Tiers       []SubscriptionTier `json:"tiers" mapstructure:"tiers"`
	LastUpdated int64              `json:"last_updated" mapstructure:"last_updated"`
}

AllowedUsersSettings represents the unified access control configuration

type BarChartData

type BarChartData struct {
	Month   string  `json:"month"`
	NotesGB float64 `json:"notes_gb"`
	MediaGB float64 `json:"media_gb"`
}

BarChartData represents bar chart data for analytics

type BitcoinRate

type BitcoinRate struct {
	ID               uint      `gorm:"primaryKey"`
	Rate             string    `gorm:"not null"`
	TimestampHornets time.Time `gorm:"autoUpdateTime"` // This will be updated each time the rate changes
}

BitcoinRate represents the current Bitcoin exchange rate

type BlobContent

type BlobContent struct {
	Hash    string
	PubKey  string
	Content []byte
}

BlobContent represents blob content with metadata

type BlobDescriptor

type BlobDescriptor struct {
	URL      string `json:"url"`
	SHA256   string `json:"sha256"`
	Size     int64  `json:"size"`
	Type     string `json:"type,omitempty"`
	Uploaded int64  `json:"uploaded"`
}

BlobDescriptor represents metadata for a blob

type BlockData

type BlockData struct {
	Leaf   merkle_dag.DagLeaf
	Branch merkle_dag.ClassicTreeBranch
}

BlockData represents data for a block in the DAG

type BlockedEvent

type BlockedEvent struct {
	EventID     string    `json:"event_id"`     // Event ID as the primary identifier
	Reason      string    `json:"reason"`       // Reason for blocking
	BlockedAt   time.Time `json:"blocked_at"`   // Timestamp when it was blocked
	RetainUntil time.Time `json:"retain_until"` // When to delete (typically 48hrs after blocking)
	HasDispute  bool      `json:"has_dispute"`  // Whether this event has an active dispute
}

BlockedEvent represents an event that has been blocked due to moderation

type BlockedPubkey

type BlockedPubkey struct {
	Pubkey    string    `json:"pubkey" badgerhold:"key"`       // Pubkey as the primary identifier
	Reason    string    `json:"reason"`                        // Reason for blocking
	BlockedAt time.Time `json:"blocked_at" badgerhold:"index"` // Timestamp when it was blocked
}

BlockedPubkey represents a pubkey that is blocked from connecting to the relay

type CacheData

type CacheData struct {
	Keys []string
}

CacheData represents cached data

type CacheMetaData

type CacheMetaData struct {
	LastAccessed string
}

CacheMetaData represents metadata for cache entries

type ClaimOwnershipMessage

type ClaimOwnershipMessage struct {
	Root      string
	PublicKey string
	Signature string
}

ClaimOwnershipMessage is sent by a client to claim ownership over an existing DAG. The root must already exist on the relay. The signature should be the public key's signature of the root hash.

type Config

type Config struct {
	Server               ServerConfig           `mapstructure:"server"`
	ExternalServices     ExternalServicesConfig `mapstructure:"external_services"`
	Logging              LoggingConfig          `mapstructure:"logging"`
	Relay                RelayConfig            `mapstructure:"relay"`
	ContentFiltering     ContentFilteringConfig `mapstructure:"content_filtering"`
	EventFiltering       EventFilteringConfig   `mapstructure:"event_filtering"`
	AllowedUsersSettings AllowedUsersSettings   `mapstructure:"allowed_users"`
	PushNotifications    PushNotificationConfig `mapstructure:"push_notifications"`
}

Config represents the complete application configuration

type ContentFilteringConfig

type ContentFilteringConfig struct {
	TextFilter      TextFilterConfig      `mapstructure:"text_filter"`
	ImageModeration ImageModerationConfig `mapstructure:"image_moderation"`
}

ContentFilteringConfig holds content filtering configuration

type DagContent

type DagContent struct {
	Hash    string
	Content []byte
}

DagContent represents content stored in DAG

type DagData

type DagData struct {
	PublicKey string
	Signature string
	Dag       merkle_dag.Dag
}

DagData represents complete DAG data with signature

type DagLeafData

type DagLeafData struct {
	PublicKey string
	Signature string
	Leaf      merkle_dag.DagLeaf
}

DagLeafData represents DAG leaf data with signature

type DagOwnership

type DagOwnership struct {
	Root      string `badgerhold:"index"`
	PublicKey string `badgerhold:"index"`
	Signature string
}

DagOwnership represents ownership/signature for a DAG. There is one ownership record per DAG root per owner (public key). The signature is the owner's signature of the root hash. Leaf membership is determined by traversing from root, not by ownership records. NOTE: When GC is implemented, deleting all ownership records for a root marks the DAG for cleanup.

type DownloadFilter

type DownloadFilter struct {
	LeafRanges     *LeafLabelRange
	LeafHashes     []string // Specific leaf hashes to download
	IncludeContent bool     // IncludeContent from LeafLabelRange always overrides this
}

DownloadFilter represents filtering options for downloads

type DownloadMessage

type DownloadMessage struct {
	Root      string
	PublicKey string
	Signature string
	Filter    *DownloadFilter
}

DownloadMessage represents a message for downloading DAG data

type DynamicKindsConfig

type DynamicKindsConfig struct {
	Enabled      bool  `mapstructure:"enabled"`
	AllowedKinds []int `mapstructure:"allowed_kinds"`
}

DynamicKindsConfig holds dynamic kinds configuration

type ErrorMessage

type ErrorMessage struct {
	Message string
}

ErrorMessage represents an error response

type EventFilteringConfig

type EventFilteringConfig struct {
	AllowUnregisteredKinds bool                       `mapstructure:"allow_unregistered_kinds"`
	RegisteredKinds        []int                      `mapstructure:"registered_kinds"`
	ModerationMode         string                     `mapstructure:"moderation_mode"`
	KindWhitelist          []string                   `mapstructure:"kind_whitelist"`
	MediaDefinitions       map[string]MediaDefinition `mapstructure:"media_definitions"`
	DynamicKinds           DynamicKindsConfig         `mapstructure:"dynamic_kinds"`
	Protocols              ProtocolsConfig            `mapstructure:"protocols"`
}

EventFilteringConfig holds event filtering configuration

type ExternalServicesConfig

type ExternalServicesConfig struct {
	Ollama    OllamaConfig    `mapstructure:"ollama"`
	Moderator ModeratorConfig `mapstructure:"moderator"`
	Wallet    WalletConfig    `mapstructure:"wallet"`
}

ExternalServicesConfig holds external service configurations

type FCMConfig

type FCMConfig struct {
	Enabled         bool   `mapstructure:"enabled"`
	ProjectID       string `mapstructure:"project_id"`
	CredentialsPath string `mapstructure:"credentials_path"`
}

FCMConfig holds Firebase Cloud Messaging configuration

type FileInfo

type FileInfo struct {
	ID               uint   `gorm:"primaryKey"`
	Root             string `gorm:"size:64;index"`
	Hash             string `gorm:"size:64;uniqueIndex"`
	FileName         string
	MimeType         string `gorm:"size:64;index"`
	LeafCount        int
	Size             int64     `gorm:"default:0"`
	TimestampHornets time.Time `gorm:"autoCreateTime"`
}

FileInfo represents metadata about stored files

type FileTag

type FileTag struct {
	ID    uint   `gorm:"primaryKey;type:INTEGER AUTO_INCREMENT"`
	Root  string `gorm:"size:64;index"`
	Key   string `gorm:"size:128;index"`
	Value string `gorm:"size:512;index"`
}

FileTag represents tags associated with files

type HashBytes

type HashBytes []byte

HashBytes is a []byte type that can unmarshal from both CBOR bytes and strings for backwards compatibility with old data stored as strings

func (*HashBytes) UnmarshalCBOR

func (h *HashBytes) UnmarshalCBOR(data []byte) error

UnmarshalCBOR implements custom CBOR unmarshaling to handle both string and bytes

type ImageModerationConfig

type ImageModerationConfig struct {
	Enabled              bool    `mapstructure:"enabled"`
	Mode                 string  `mapstructure:"mode"`
	Threshold            float64 `mapstructure:"threshold"`
	TimeoutSeconds       int     `mapstructure:"timeout_seconds"`
	CheckIntervalSeconds int     `mapstructure:"check_interval_seconds"`
	Concurrency          int     `mapstructure:"concurrency"`
}

ImageModerationConfig holds image moderation configuration

type JWTClaims

type JWTClaims struct {
	UserID uint   `json:"user_id"`
	Email  string `json:"email"`
	jwt.RegisteredClaims
}

JWTClaims represents the structure of the JWT claims

type Kind

type Kind struct {
	ID               uint `gorm:"primaryKey"`
	KindNumber       int
	EventID          string
	TimestampHornets time.Time `gorm:"autoCreateTime"`
	Size             float64
}

Kind represents event kind metadata

type KindData

type KindData struct {
	Month            string
	Size             float64
	TimestampHornets time.Time
}

KindData represents data for a specific event kind

type LeafContent

type LeafContent struct {
	Hash              string
	ItemName          string
	Type              merkle_dag.LeafType
	ContentHash       []byte
	ClassicMerkleRoot []byte
	CurrentLinkCount  int
	LeafCount         int
	ContentSize       int64
	DagSize           int64
	Links             []string
	AdditionalData    map[string]string
}

LeafContent represents the content-addressed leaf data (stored once per unique hash) NOTE: ParentHash is NOT stored here because the same leaf can have different parents in different DAGs. Parent relationships are cached per-root separately. NOTE: Indexes removed to reduce write amplification - lookups use composite keys directly

type LeafLabelRange

type LeafLabelRange struct {
	From int
	To   int
}

LeafLabelRange represents a range of leaf labels

type LeafParentCache

type LeafParentCache struct {
	RootHash   string
	LeafHash   string
	ParentHash string
}

LeafParentCache caches the parent hash for a leaf within a specific DAG root This is needed because the same leaf can have different parents in different DAGs NOTE: Indexes removed - lookups use composite key "root:leafhash"

type LoggingConfig

type LoggingConfig struct {
	Level  string `mapstructure:"level"`
	Format string `mapstructure:"format"`
	Output string `mapstructure:"output"`
	Path   string `mapstructure:"path"`
}

LoggingConfig holds logging configuration

type LoginPayload

type LoginPayload struct {
	Npub     string `json:"npub"`
	Password string `json:"password"`
}

LoginPayload represents the structure of the login request payload

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

LoginRequest represents a login request

type MediaDefinition

type MediaDefinition struct {
	MimePatterns []string `mapstructure:"mime_patterns"`
	Extensions   []string `mapstructure:"extensions"`
	MaxSizeMB    int      `mapstructure:"max_size_mb"`
}

MediaDefinition holds configuration for a specific media type

type ModerationNotification

type ModerationNotification struct {
	ID           uint      `gorm:"primaryKey" json:"id"`
	PubKey       string    `gorm:"size:128;index" json:"pubkey"`         // User whose content was moderated
	EventID      string    `gorm:"size:128;uniqueIndex" json:"event_id"` // ID of the moderated event
	Reason       string    `gorm:"size:255" json:"reason"`               // Reason for blocking
	CreatedAt    time.Time `gorm:"autoCreateTime" json:"created_at"`     // When the notification was created
	IsRead       bool      `gorm:"default:false" json:"is_read"`         // Whether the notification has been read
	ContentType  string    `gorm:"size:64" json:"content_type"`          // Type of content (image/video)
	MediaURL     string    `gorm:"size:512" json:"media_url"`            // URL of the media that triggered moderation
	ThumbnailURL string    `gorm:"size:512" json:"thumbnail_url"`        // Optional URL for thumbnail
}

ModerationNotification represents a notification about moderated content

type ModerationStats

type ModerationStats struct {
	TotalBlocked      int        `json:"total_blocked"`       // Total number of blocked events
	TotalBlockedToday int        `json:"total_blocked_today"` // Number of events blocked today
	ByContentType     []TypeStat `json:"by_content_type"`     // Breakdown by content type
	ByUser            []UserStat `json:"by_user"`             // Top users with blocked content
	RecentReasons     []string   `json:"recent_reasons"`      // Recent blocking reasons
}

ModerationStats represents statistics about moderated content

type ModeratorConfig

type ModeratorConfig struct {
	URL string `mapstructure:"url"`
}

ModeratorConfig holds moderator service configuration

type MonthlyKindData

type MonthlyKindData struct {
	Month     string  `json:"month"`
	TotalSize float64 `json:"totalSize"`
}

MonthlyKindData represents monthly aggregated kind data

type NostrEvent

type NostrEvent struct {
	ID        string `badgerhold:"index"`
	PubKey    string `badgerhold:"index"`
	CreatedAt nostr.Timestamp
	Kind      string `badgerhold:"index"`
	Tags      nostr.Tags
	Content   string
	Sig       string
	// Extra fields for serialization - this field is used indirectly during JSON serialization
	// and shouldn't be removed even though it appears unused in static analysis
	Extra map[string]any `json:"-"` // Fields will be added to the parent object during serialization
}

NostrEvent represents a Nostr event with additional fields

type OllamaConfig

type OllamaConfig struct {
	URL     string `mapstructure:"url"`
	Model   string `mapstructure:"model"`
	Timeout int    `mapstructure:"timeout"`
}

OllamaConfig holds Ollama service configuration

type PaginationMetadata

type PaginationMetadata struct {
	CurrentPage int   `json:"currentPage"`
	PageSize    int   `json:"pageSize"`
	TotalItems  int64 `json:"totalItems"`
	TotalPages  int   `json:"totalPages"`
	HasNext     bool  `json:"hasNext"`
	HasPrevious bool  `json:"hasPrevious"`
}

PaginationMetadata represents pagination information

type PaidSubscriber

type PaidSubscriber struct {
	ID               uint      `gorm:"primaryKey"`
	Npub             string    `gorm:"size:128;uniqueIndex"` // Unique public key of the subscriber
	Tier             string    `gorm:"not null"`             // Subscription tier (e.g. "1 GB per month")
	ExpirationDate   time.Time `gorm:"not null"`             // When the subscription expires
	StorageBytes     int64     `gorm:"default:0"`            // Total storage allocated in bytes
	UsedBytes        int64     `gorm:"default:0"`            // Currently used storage in bytes
	TimestampHornets time.Time `gorm:"autoCreateTime"`       // When the record was created
	UpdatedAt        time.Time `gorm:"autoUpdateTime"`       // When the record was last updated
}

PaidSubscriber represents a user with an active paid subscription

type PaymentNotification

type PaymentNotification struct {
	ID               uint      `gorm:"primaryKey" json:"id"`
	PubKey           string    `gorm:"size:128;index" json:"pubkey"`           // Subscriber's public key
	TxID             string    `gorm:"size:128;index" json:"tx_id"`            // Transaction ID
	Amount           int64     `gorm:"not null" json:"amount"`                 // Amount in satoshis
	SubscriptionTier string    `gorm:"size:64" json:"subscription_tier"`       // Tier purchased (e.g. "5GB")
	IsNewSubscriber  bool      `gorm:"default:false" json:"is_new_subscriber"` // First time subscriber?
	ExpirationDate   time.Time `json:"expiration_date"`                        // When subscription expires
	CreatedAt        time.Time `gorm:"autoCreateTime" json:"created_at"`       // When the notification was created
	IsRead           bool      `gorm:"default:false" json:"is_read"`           // Whether notification is read
}

PaymentNotification represents a notification about a payment/subscription event

type PaymentStats

type PaymentStats struct {
	TotalRevenue        int64       `json:"total_revenue"`         // Total sats received
	RevenueToday        int64       `json:"revenue_today"`         // Sats received today
	ActiveSubscribers   int         `json:"active_subscribers"`    // Currently active subs
	NewSubscribersToday int         `json:"new_subscribers_today"` // New subscribers today
	ByTier              []TierStat  `json:"by_tier"`               // Breakdown by tier
	RecentTransactions  []TxSummary `json:"recent_transactions"`   // Recent payments
}

PaymentStats represents statistics about payments and subscriptions

type PendingDisputeModeration

type PendingDisputeModeration struct {
	DisputeID     string    `json:"dispute_id"`     // Dispute event ID
	TicketID      string    `json:"ticket_id"`      // Ticket event ID
	EventID       string    `json:"event_id"`       // Original blocked event ID
	MediaURL      string    `json:"media_url"`      // URL of the media to re-evaluate
	DisputeReason string    `json:"dispute_reason"` // Reason provided by the user for the dispute
	UserPubKey    string    `json:"user_pubkey"`    // Public key of the user who created the dispute
	AddedAt       time.Time `json:"added_at"`       // Timestamp when added to queue
}

PendingDisputeModeration represents a dispute waiting for re-evaluation

type PendingModeration

type PendingModeration struct {
	EventID   string    `json:"event_id"`   // Event ID as the primary identifier
	ImageURLs []string  `json:"image_urls"` // URLs of images or videos to moderate (kept as ImageURLs for backward compatibility)
	AddedAt   time.Time `json:"added_at"`   // Timestamp when added to queue
}

PendingModeration represents an event waiting for media moderation

type PendingTransaction

type PendingTransaction struct {
	ID               uint      `gorm:"primaryKey"`
	TxID             string    `gorm:"not null;size:128;uniqueIndex" json:"txid"`
	FeeRate          int       `gorm:"not null" json:"feeRate"`
	Amount           int       `gorm:"not null" json:"amount"`
	RecipientAddress string    `gorm:"not null" json:"recipient_address"`
	TimestampHornets time.Time `gorm:"not null" json:"timestamp"`
	EnableRBF        bool      `gorm:"not null" json:"enable_rbf"` // New field for RBF
}

PendingTransaction represents a pending Bitcoin transaction

type ProtocolsConfig

type ProtocolsConfig struct {
	Enabled          bool     `mapstructure:"enabled"`
	AllowedProtocols []string `mapstructure:"allowed_protocols"`
}

ProtocolsConfig holds protocols configuration

type PushDevice

type PushDevice struct {
	ID            uint      `gorm:"primaryKey" json:"id"`
	Pubkey        string    `gorm:"size:64;not null;index" json:"pubkey"`
	DeviceToken   string    `gorm:"size:255;not null" json:"device_token"`
	Platform      string    `gorm:"size:10;not null" json:"platform"` // 'ios' or 'android'
	AppIdentifier string    `gorm:"size:255" json:"app_identifier"`
	CreatedAt     time.Time `gorm:"autoCreateTime" json:"created_at"`
	UpdatedAt     time.Time `gorm:"autoUpdateTime" json:"updated_at"`
	IsActive      bool      `gorm:"default:true" json:"is_active"`
}

PushDevice represents a registered device for push notifications

type PushNotificationConfig

type PushNotificationConfig struct {
	Enabled bool              `mapstructure:"enabled"`
	APNS    APNSConfig        `mapstructure:"apns"`
	FCM     FCMConfig         `mapstructure:"fcm"`
	Service PushServiceConfig `mapstructure:"service"`
}

PushNotificationConfig holds push notification service configuration

type PushNotificationLog

type PushNotificationLog struct {
	ID               uint       `gorm:"primaryKey" json:"id"`
	Pubkey           string     `gorm:"size:64;not null;index" json:"pubkey"`
	EventID          string     `gorm:"size:64;not null" json:"event_id"`
	EventKind        int        `gorm:"not null" json:"event_kind"`
	NotificationType string     `gorm:"size:50" json:"notification_type"`
	DeviceToken      string     `gorm:"size:255" json:"device_token"`
	Platform         string     `gorm:"size:10" json:"platform"`
	SentAt           *time.Time `json:"sent_at"`
	Delivered        bool       `gorm:"default:false" json:"delivered"`
	ErrorMessage     string     `gorm:"type:text" json:"error_message"`
	CreatedAt        time.Time  `gorm:"autoCreateTime" json:"created_at"`
}

PushNotificationLog represents a log entry for sent push notifications

type PushServiceConfig

type PushServiceConfig struct {
	QueueSize     int    `mapstructure:"queue_size"`
	WorkerCount   int    `mapstructure:"worker_count"`
	BatchSize     int    `mapstructure:"batch_size"`
	RetryAttempts int    `mapstructure:"retry_attempts"`
	RetryDelay    string `mapstructure:"retry_delay"`
}

PushServiceConfig holds general service configuration

type QueryFilter

type QueryFilter struct {
	Names   []string
	PubKeys []string
	Tags    map[string]string
}

QueryFilter represents filtering options for queries

type QueryMessage

type QueryMessage struct {
	QueryFilter map[string]string
}

QueryMessage represents a simple query message

type QueryResponse

type QueryResponse struct {
	Hashes []string
}

QueryResponse represents the response to a query

type RelayConfig

type RelayConfig struct {
	Name          string `mapstructure:"name"`
	Description   string `mapstructure:"description"`
	Contact       string `mapstructure:"contact"`
	Icon          string `mapstructure:"icon"`
	Software      string `mapstructure:"software"`
	Version       string `mapstructure:"version"`
	ServiceTag    string `mapstructure:"service_tag"`
	SupportedNIPs []int  `mapstructure:"supported_nips"`
	SecretKey     string `mapstructure:"secret_key"`
	PrivateKey    string `mapstructure:"private_key"`
	DHTKey        string `mapstructure:"dht_key"`
}

RelayConfig holds relay-specific configuration

type RelayOwner

type RelayOwner struct {
	Npub      string    `gorm:"primaryKey;size:128" json:"npub"`
	CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
	CreatedBy string    `gorm:"size:128" json:"created_by"`
}

type ReplaceTransactionRequest

type ReplaceTransactionRequest struct {
	OriginalTxID     string `json:"original_tx_id"`
	NewTxID          string `json:"new_tx_id"`
	NewFeeRate       int    `json:"new_fee_rate"`
	Amount           int    `json:"amount"`
	RecipientAddress string `json:"recipient_address"`
}

ReplaceTransactionRequest represents a request to replace a transaction

type ReportNotification

type ReportNotification struct {
	ID             uint      `gorm:"primaryKey" json:"id"`
	PubKey         string    `gorm:"size:128;index" json:"pubkey"`         // User whose content was reported
	EventID        string    `gorm:"size:128;uniqueIndex" json:"event_id"` // ID of the reported event
	ReportType     string    `gorm:"size:64" json:"report_type"`           // Type from NIP-56 (nudity, malware, etc.)
	ReportContent  string    `gorm:"size:512" json:"report_content"`       // Content field from the report event
	ReporterPubKey string    `gorm:"size:128" json:"reporter_pubkey"`      // First reporter's public key
	ReportCount    int       `gorm:"default:1" json:"report_count"`        // Number of reports for this content
	CreatedAt      time.Time `gorm:"autoCreateTime" json:"created_at"`     // When the report was first received
	UpdatedAt      time.Time `gorm:"autoUpdateTime" json:"updated_at"`     // When the report was last updated
	IsRead         bool      `gorm:"default:false" json:"is_read"`         // Whether the notification has been read
}

ReportNotification represents a notification about content reported by users (kind 1984)

type ReportStats

type ReportStats struct {
	TotalReported      int             `json:"total_reported"`       // Total number of reported events
	TotalReportedToday int             `json:"total_reported_today"` // Number of events reported today
	ByReportType       []TypeStat      `json:"by_report_type"`       // Breakdown by report type
	MostReported       []ReportSummary `json:"most_reported"`        // Most frequently reported content
}

ReportStats represents statistics about reported content

type ReportSummary

type ReportSummary struct {
	EventID     string    `json:"event_id"`     // ID of the reported event
	PubKey      string    `json:"pubkey"`       // Author of the reported content
	ReportCount int       `json:"report_count"` // Number of times reported
	ReportType  string    `json:"report_type"`  // Type of report
	CreatedAt   time.Time `json:"created_at"`   // When first reported
}

ReportSummary represents a summary of a reported event

type ResponseMessage

type ResponseMessage struct {
	Ok      bool
	Message string // Optional error message when Ok is false
}

ResponseMessage represents a generic response

type ServerConfig

type ServerConfig struct {
	Port        int    `mapstructure:"port"`
	BindAddress string `mapstructure:"bind_address"`
	UPNP        bool   `mapstructure:"upnp"`
	Nostr       bool   `mapstructure:"nostr"`
	Hornets     bool   `mapstructure:"hornets"`
	Web         bool   `mapstructure:"web"`
	Demo        bool   `mapstructure:"demo"`
	Blossom     bool   `mapstructure:"blossom"`
	DataPath    string `mapstructure:"data_path"`
}

ServerConfig holds server-related configuration

type SignUpRequest

type SignUpRequest struct {
	FirstName string `json:"firstName"`
	LastName  string `json:"lastName"`
	Email     string `json:"email"`
	Password  string `json:"password"`
}

SignUpRequest represents a signup request

type Stream

type Stream interface {
	Read(p []byte) (int, error)
	Write(p []byte) (int, error)
	Close() error
	Context() context.Context
}

Stream interface for network communication

type Subscriber

type Subscriber struct {
	Npub              string    `json:"npub" badgerhold:"index"`    // The unique public key of the subscriber
	Tier              string    `json:"tier"`                       // The subscription tier the user has selected
	StartDate         time.Time `json:"start_date"`                 // When the subscription started
	EndDate           time.Time `json:"end_date"`                   // When the subscription ends
	Address           string    `json:"address" badgerhold:"index"` // The address associated with the subscription
	LastTransactionID string    `json:"last_transaction_id"`        // The ID of the last processed transaction
}

Subscriber represents a user subscription

type SubscriberAddress

type SubscriberAddress struct {
	ID           uint       `gorm:"primaryKey"`
	IndexHornets string     `gorm:"not null"`
	Address      string     `gorm:"not null;size:128;unique"`
	WalletName   string     `gorm:"not null"`
	Status       string     `gorm:"default:'available'"`
	AllocatedAt  *time.Time `gorm:"default:null"`
	Npub         *string    `gorm:"type:text;unique"` // Pointer type and unique constraint
	CreditSats   int64      `gorm:"default:0"`        // Track accumulated satoshis that haven't reached a tier
}

SubscriberAddress represents the GORM-compatible model for storing addresses

type SubscriptionTier

type SubscriptionTier struct {
	Name              string `mapstructure:"name" json:"name"`
	PriceSats         int    `mapstructure:"price_sats" json:"price_sats"`
	MonthlyLimitBytes int64  `mapstructure:"monthly_limit_bytes" json:"monthly_limit_bytes"`
	Unlimited         bool   `mapstructure:"unlimited" json:"unlimited"`
}

SubscriptionTier holds subscription tier configuration

type SubscriptionTiers

type SubscriptionTiers struct {
	Tiers []SubscriptionTier `mapstructure:"tiers"`
}

SubscriptionTiersConfig holds subscription tier configuration

type TagEntry

type TagEntry struct {
	EventID  string `badgerhold:"index"`
	TagName  string `badgerhold:"index"`
	TagValue string `badgerhold:"index"`
}

TagEntry represents a tag entry for indexing

type TextFilterConfig

type TextFilterConfig struct {
	Enabled             bool  `mapstructure:"enabled"`
	CacheSize           int   `mapstructure:"cache_size"`
	CacheTTLSeconds     int   `mapstructure:"cache_ttl_seconds"`
	FullTextSearchKinds []int `mapstructure:"full_text_search_kinds"`
}

TextFilterConfig holds text filtering configuration

type TierStat

type TierStat struct {
	Tier    string `json:"tier"`    // Subscription tier name
	Count   int    `json:"count"`   // Number of subscribers
	Revenue int64  `json:"revenue"` // Total revenue from this tier
}

TierStat represents statistics for a specific subscription tier

type TimeSeriesData

type TimeSeriesData struct {
	Month           string `json:"month"`
	Profiles        int    `json:"profiles"`
	LightningAddr   int    `json:"lightning_addr"`
	DHTKey          int    `json:"dht_key"`
	LightningAndDHT int    `json:"lightning_and_dht"`
}

TimeSeriesData represents time series analytics data

type TxSummary

type TxSummary struct {
	PubKey string    `json:"pubkey"` // Subscriber's public key
	Amount int64     `json:"amount"` // Amount in satoshis
	Tier   string    `json:"tier"`   // Tier purchased
	Date   time.Time `json:"date"`   // Transaction date
}

TxSummary represents a simplified transaction summary

type TypeStat

type TypeStat struct {
	Type  string `json:"type"`  // Content type (image/video)
	Count int    `json:"count"` // Number of items
}

TypeStat represents statistics for a specific content type

type UploadMessage

type UploadMessage struct {
	Root      string
	Packet    merkle_dag.SerializableTransmissionPacket
	PublicKey string
	Signature string
}

UploadMessage represents a message for uploading DAG data

type UserChallenge

type UserChallenge struct {
	ID        uint   `gorm:"primaryKey"`
	UserID    uint   `gorm:"index"`
	Npub      string `gorm:"size:128;index"`
	Challenge string `gorm:"size:512"`
	Hash      string
	Expired   bool      `gorm:"default:false"`
	CreatedAt time.Time `gorm:"autoCreateTime"`
}

UserChallenge represents a user authentication challenge

type UserProfile

type UserProfile struct {
	ID               uint      `gorm:"primaryKey"`
	NpubKey          string    `gorm:"size:128;uniqueIndex"`
	LightningAddr    bool      `gorm:"default:false"`
	DHTKey           bool      `gorm:"default:false"`
	TimestampHornets time.Time `gorm:"autoCreateTime"`
}

UserProfile represents a user profile

type UserStat

type UserStat struct {
	PubKey string `json:"pubkey"` // User public key
	Count  int    `json:"count"`  // Number of blocked items
}

UserStat represents moderation statistics for a specific user

type WalletAddress

type WalletAddress struct {
	ID           uint   `gorm:"primaryKey"`
	IndexHornets string `gorm:"not null"`
	Address      string `gorm:"not null;unique"`
}

WalletAddress represents a wallet address

type WalletBalance

type WalletBalance struct {
	ID               uint      `gorm:"primaryKey"`
	Balance          string    `gorm:"not null"`
	TimestampHornets time.Time `gorm:"autoCreateTime"`
}

WalletBalance represents the current wallet balance

type WalletConfig

type WalletConfig struct {
	URL  string `mapstructure:"url"`
	Key  string `mapstructure:"key"`
	Name string `mapstructure:"name"`
}

WalletConfig holds wallet service configuration

type WalletTransactions

type WalletTransactions struct {
	ID      uint      `gorm:"primaryKey"`
	Address string    `gorm:"not null"`
	Date    time.Time `gorm:"not null"` // Date and time formatted like "2024-05-23 19:17:22"
	Output  string    `gorm:"not null"` // Output as a string
	Value   string    `gorm:"not null"` // Value as a float
}

WalletTransactions represents wallet transaction history

type WebSocketStream

type WebSocketStream struct {
	Conn *websocket.Conn
	Ctx  context.Context
	// contains filtered or unexported fields
}

WebSocketStream implements Stream interface for WebSocket connections

func NewWebSocketStream

func NewWebSocketStream(conn *websocket.Conn, ctx context.Context) *WebSocketStream

NewWebSocketStream creates a new WebSocket stream

func (*WebSocketStream) Close

func (ws *WebSocketStream) Close() error

Close closes the WebSocket connection

func (*WebSocketStream) Context

func (ws *WebSocketStream) Context() context.Context

Context returns the context for the WebSocket stream

func (*WebSocketStream) Flush

func (ws *WebSocketStream) Flush() error

Flush sends buffered data through the WebSocket connection

func (*WebSocketStream) Read

func (ws *WebSocketStream) Read(msg []byte) (int, error)

Read reads data from the WebSocket connection

func (*WebSocketStream) Write

func (ws *WebSocketStream) Write(msg []byte) (int, error)

Write writes data to the WebSocket buffer

type WrappedLeaf

type WrappedLeaf struct {
	PublicKey         string
	Signature         string
	Root              string
	Hash              string
	ItemName          string
	Type              merkle_dag.LeafType
	ContentHash       []byte
	ClassicMerkleRoot []byte
	CurrentLinkCount  int
	LeafCount         int
	ContentSize       int64
	DagSize           int64
	Links             []string
	AdditionalData    map[string]string
}

WrappedLeaf represents a leaf in the Merkle DAG structure (backward compatibility) This combines LeafContent + DagOwnership for convenience NOTE: Indexes removed to reduce write amplification

Jump to

Keyboard shortcuts

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