lib

package
v0.0.0-...-9b41daf Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveToken

type ActiveToken struct {
	UserID    uint   `gorm:"index"`
	Token     string `gorm:"uniqueIndex"`
	ExpiresAt time.Time
}

type ActivityData

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

type Address

type Address struct {
	Index       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"`
	AllocatedAt *time.Time `json:"allocated_at,omitempty"`
	Npub        string     `json:"npub,omitempty"`
}

Address structure to be stored in Graviton

type AddressResponse

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

type AggregatedKindData

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

type Audio

type Audio struct {
	ID        uint   `gorm:"primaryKey"`
	Hash      string `gorm:"uniqueIndex"`
	LeafCount int
	KindName  string
	Timestamp time.Time `gorm:"autoCreateTime"`
	Size      float64   `gorm:"default:0"` // Size in MB
}

type BarChartData

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

type BitcoinRate

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

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"`
}

type BlockData

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

type CacheData

type CacheData struct {
	Keys []string
}

type CacheMetaData

type CacheMetaData struct {
	LastAccessed string
}

type DagData

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

type DagLeafData

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

type DownloadFilter

type DownloadFilter struct {
	Leaves         []string
	LeafRanges     []LeafLabelRange
	IncludeContent bool // IncludeContent from LeafLabelRange always overrides this
}

type DownloadMessage

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

type ErrorMessage

type ErrorMessage struct {
	Message string
}

type GitNestr

type GitNestr struct {
	ID        uint `gorm:"primaryKey"`
	GitType   string
	EventID   string
	Timestamp time.Time `gorm:"autoCreateTime"`
	Size      float64   `gorm:"default:0"` // Size in MB
}

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
	Timestamp  time.Time `gorm:"autoCreateTime"`
	Size       float64   `gorm:"default:0"` // Size in MB
}

type KindData

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

type LeafLabelRange

type LeafLabelRange struct {
	From           string
	To             string
	IncludeContent bool
}

type Libp2pStream

type Libp2pStream struct {
	Stream network.Stream
	Ctx    context.Context
}

func (*Libp2pStream) Close

func (ls *Libp2pStream) Close() error

func (*Libp2pStream) Context

func (ls *Libp2pStream) Context() context.Context

func (*Libp2pStream) Read

func (ls *Libp2pStream) Read(msg []byte) (int, error)

func (*Libp2pStream) Write

func (ls *Libp2pStream) Write(msg []byte) (int, error)

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"`
}

type Misc

type Misc struct {
	ID        uint   `gorm:"primaryKey"`
	Hash      string `gorm:"uniqueIndex"`
	LeafCount int
	KindName  string
	Timestamp time.Time `gorm:"autoCreateTime"`
	Size      float64   `gorm:"default:0"` // Size in MB
}

type MonthlyKindData

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

type PendingTransaction

type PendingTransaction struct {
	ID               uint      `gorm:"primaryKey"`
	TxID             string    `gorm:"not null;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"`
	Timestamp        time.Time `gorm:"not null" json:"timestamp"`
	EnableRBF        bool      `gorm:"not null" json:"enable_rbf"` // New field for RBF
}

type Photo

type Photo struct {
	ID        uint   `gorm:"primaryKey"`
	Hash      string `gorm:"uniqueIndex"`
	LeafCount int
	KindName  string
	Timestamp time.Time `gorm:"autoCreateTime"`
	Size      float64   `gorm:"default:0"` // Size in MB
}

type QueryMessage

type QueryMessage struct {
	QueryFilter map[string]string
}

type QueryResponse

type QueryResponse struct {
	Hashes []string
}

type RelaySettings

type RelaySettings struct {
	Mode             string   `json:"mode"`
	Protocol         []string `json:"protocol"`
	Chunked          []string `json:"chunked"`
	Chunksize        string   `json:"chunksize"`
	MaxFileSize      int      `json:"maxFileSize"`
	MaxFileSizeUnit  string   `json:"maxFileSizeUnit"`
	Kinds            []string `json:"kinds"`
	DynamicKinds     []string `json:"dynamicKinds"`
	Photos           []string `json:"photos"`
	Videos           []string `json:"videos"`
	GitNestr         []string `json:"gitNestr"`
	Audio            []string `json:"audio"`
	IsKindsActive    bool     `json:"isKindsActive"`
	IsPhotosActive   bool     `json:"isPhotosActive"`
	IsVideosActive   bool     `json:"isVideosActive"`
	IsGitNestrActive bool     `json:"isGitNestrActive"`
	IsAudioActive    bool     `json:"isAudioActive"`
}

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"`
}

type ResponseMessage

type ResponseMessage struct {
	Ok bool
}

type SignUpRequest

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

type Stream

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

type Subscriber

type Subscriber struct {
	Npub              string    `json:"npub"`                // 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"`             // The address associated with the subscription
	LastTransactionID string    `json:"last_transaction_id"` // The ID of the last processed transaction
}

type SubscriptionTier

type SubscriptionTier struct {
	DataLimit string
	Price     string
}

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"`
}

type UploadMessage

type UploadMessage struct {
	Root      string
	Count     int
	Leaf      merkle_dag.DagLeaf
	Parent    string
	Branch    *merkle_dag.ClassicTreeBranch
	PublicKey string
	Signature string
}

type User

type User struct {
	ID        uint      `gorm:"primaryKey"`
	Password  string    // Store hashed passwords
	Npub      string    `gorm:"uniqueIndex"`
	CreatedAt time.Time `gorm:"autoCreateTime"`
	UpdatedAt time.Time `gorm:"autoUpdateTime"`
}

type UserChallenge

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

type UserProfile

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

type Video

type Video struct {
	ID        uint   `gorm:"primaryKey"`
	Hash      string `gorm:"uniqueIndex"`
	LeafCount int
	KindName  string
	Timestamp time.Time `gorm:"autoCreateTime"`
	Size      float64   `gorm:"default:0"` // Size in MB
}

type WalletAddress

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

type WalletBalance

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

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
}

type WebSocketStream

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

func NewWebSocketStream

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

func (*WebSocketStream) Close

func (ws *WebSocketStream) Close() error

func (*WebSocketStream) Context

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

func (*WebSocketStream) Flush

func (ws *WebSocketStream) Flush() error

func (*WebSocketStream) Read

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

func (*WebSocketStream) Write

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

Jump to

Keyboard shortcuts

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