Documentation
¶
Index ¶
- Constants
- Variables
- func ConvertUSKToSSK(uri string, edition int64) string
- func GenerateCHK(data []byte) (string, error)
- func GetFullVersionString() string
- func GetRequestURI(insertURI string) string
- func GetVersionString() string
- func IncrementUSK(uskURI string) (string, error)
- func IsInsertURI(uri string) bool
- func ParseKeyType(uri string) string
- func PrintLicenseNotice() string
- func UpdateUSKEdition(uri string, edition int64) string
- type Client
- func (c *Client) ClientGet(uri string, identifier string) error
- func (c *Client) ClientPut(uri string, identifier string, data []byte) error
- func (c *Client) Close() error
- func (c *Client) GenerateSSK() (*KeyPair, error)
- func (c *Client) GetNode(withPrivate, withVolatile bool) error
- func (c *Client) Listen() error
- func (c *Client) ReceiveMessage() (*Message, error)
- func (c *Client) RegisterHandler(msgType string, handler MessageHandler)
- func (c *Client) SendMessage(msg *Message) error
- func (c *Client) SendRawData(data []byte) error
- type Config
- type KeyPair
- type KeyStore
- func (ks *KeyStore) Add(name string, keyPair *KeyPair) error
- func (ks *KeyStore) Delete(name string) error
- func (ks *KeyStore) Get(name string) (*KeyPair, error)
- func (ks *KeyStore) List() ([]string, error)
- func (ks *KeyStore) ListAll() ([]*KeyPair, error)
- func (ks *KeyStore) Update(name string, keyPair *KeyPair) error
- type KeyStoreInterface
- type Message
- type MessageHandler
- type OperationResult
- type Operations
- func (o *Operations) Get(ctx context.Context, uri string) (*OperationResult, error)
- func (o *Operations) GetWithProgress(ctx context.Context, uri string, progressFn func(succeeded, total int)) (*OperationResult, error)
- func (o *Operations) Put(ctx context.Context, uri string, data []byte) (*OperationResult, error)
- func (o *Operations) PutWithProgress(ctx context.Context, uri string, data []byte, ...) (*OperationResult, error)
- type SQLiteKeyStore
- func (ks *SQLiteKeyStore) Add(name string, keyPair *KeyPair) error
- func (ks *SQLiteKeyStore) Close() error
- func (ks *SQLiteKeyStore) Delete(name string) error
- func (ks *SQLiteKeyStore) Export() ([]byte, error)
- func (ks *SQLiteKeyStore) Get(name string) (*KeyPair, error)
- func (ks *SQLiteKeyStore) GetStats() (map[string]interface{}, error)
- func (ks *SQLiteKeyStore) Import(data []byte) error
- func (ks *SQLiteKeyStore) List() ([]string, error)
- func (ks *SQLiteKeyStore) ListAll() ([]*KeyPair, error)
- func (ks *SQLiteKeyStore) Search(keyType string, searchTerm string) ([]*KeyPair, error)
- func (ks *SQLiteKeyStore) Update(name string, keyPair *KeyPair) error
- type USKCallback
- type USKManager
- func (m *USKManager) GetAllSubscriptions() []*USKSubscription
- func (m *USKManager) GetSubscription(identifier string) *USKSubscription
- func (m *USKManager) Subscribe(uri string, callback USKCallback) (*USKSubscription, error)
- func (m *USKManager) Unsubscribe(identifier string) error
- func (m *USKManager) UnsubscribeByURI(uri string) error
- type USKSubscription
- type VersionInfo
Constants ¶
const ( // Version is the current version of GoHyphanet Version = "0.1.0" // SourceURL is the URL to the source code repository (AGPL requirement) SourceURL = "https://github.com/blubskye/gohyphanet" // LicenseName is the name of the license LicenseName = "GNU AGPLv3" // LicenseURL is the URL to the license text LicenseURL = "https://www.gnu.org/licenses/agpl-3.0.txt" )
Variables ¶
var DebugMode bool
Functions ¶
func ConvertUSKToSSK ¶
ConvertUSKToSSK converts a USK to the equivalent SSK for a specific edition
func GenerateCHK ¶
GenerateCHK generates a CHK from data (deterministic hash)
func GetFullVersionString ¶
func GetFullVersionString() string
GetFullVersionString returns a detailed version string with all info
func GetRequestURI ¶
GetRequestURI extracts the public (request) URI from an insert URI
func GetVersionString ¶
func GetVersionString() string
GetVersionString returns a formatted version string
func IncrementUSK ¶
IncrementUSK increments a USK version number
func IsInsertURI ¶
IsInsertURI checks if a URI is an insert (private) URI
func ParseKeyType ¶
ParseKeyType determines the key type from a URI
func PrintLicenseNotice ¶
func PrintLicenseNotice() string
PrintLicenseNotice prints the AGPL notice
func UpdateUSKEdition ¶
UpdateUSKEdition updates the URI to use a specific edition
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a connection to a Freenet node
func (*Client) GenerateSSK ¶
GenerateSSK generates a new SSK key pair using the Freenet node
func (*Client) ReceiveMessage ¶
ReceiveMessage reads an FCP message from the node
func (*Client) RegisterHandler ¶
func (c *Client) RegisterHandler(msgType string, handler MessageHandler)
RegisterHandler registers a handler for a specific message type
func (*Client) SendMessage ¶
SendMessage sends an FCP message to the node
func (*Client) SendRawData ¶
SendRawData sends raw bytes to the node (used for ClientPutComplexDir file data)
type Config ¶
Config holds configuration for connecting to Freenet node
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a config with sensible defaults
type KeyPair ¶
type KeyPair struct {
Name string `json:"name"`
Type string `json:"type"` // SSK, USK
PublicKey string `json:"public_key"`
PrivateKey string `json:"private_key,omitempty"`
Created time.Time `json:"created"`
Modified time.Time `json:"modified"`
Metadata map[string]string `json:"metadata,omitempty"`
}
KeyPair represents a Freenet key pair
type KeyStore ¶
type KeyStore struct {
// contains filtered or unexported fields
}
KeyStore manages key storage and retrieval (JSON backend)
func NewKeyStore ¶
NewKeyStore creates or loads a key store from the specified path
type KeyStoreInterface ¶
type KeyStoreInterface interface {
Add(name string, keyPair *KeyPair) error
Get(name string) (*KeyPair, error)
Update(name string, keyPair *KeyPair) error
Delete(name string) error
List() ([]string, error)
ListAll() ([]*KeyPair, error)
}
KeyStoreInterface defines the interface for key storage backends
type MessageHandler ¶
MessageHandler is a function that processes incoming messages
type OperationResult ¶
type OperationResult struct {
Success bool
Identifier string
URI string
Data []byte
Error string
Metadata map[string]string
}
OperationResult represents the result of an FCP operation
type Operations ¶
type Operations struct {
// contains filtered or unexported fields
}
Operations provides high-level operations on top of the FCP client
func NewOperations ¶
func NewOperations(client *Client) *Operations
NewOperations creates a new Operations instance
func (*Operations) Get ¶
func (o *Operations) Get(ctx context.Context, uri string) (*OperationResult, error)
Get retrieves data from Freenet with a timeout
func (*Operations) GetWithProgress ¶
func (o *Operations) GetWithProgress(ctx context.Context, uri string, progressFn func(succeeded, total int)) (*OperationResult, error)
GetWithProgress retrieves data and provides progress updates
func (*Operations) Put ¶
func (o *Operations) Put(ctx context.Context, uri string, data []byte) (*OperationResult, error)
Put inserts data into Freenet with a timeout
func (*Operations) PutWithProgress ¶
func (o *Operations) PutWithProgress(ctx context.Context, uri string, data []byte, progressFn func(succeeded, total int)) (*OperationResult, error)
PutWithProgress inserts data and provides progress updates
type SQLiteKeyStore ¶
type SQLiteKeyStore struct {
// contains filtered or unexported fields
}
SQLiteKeyStore implements KeyStore using SQLite database
func NewSQLiteKeyStore ¶
func NewSQLiteKeyStore(path string) (*SQLiteKeyStore, error)
NewSQLiteKeyStore creates or opens an SQLite-backed key store
func (*SQLiteKeyStore) Add ¶
func (ks *SQLiteKeyStore) Add(name string, keyPair *KeyPair) error
Add adds a new key pair or updates an existing one (upsert)
func (*SQLiteKeyStore) Close ¶
func (ks *SQLiteKeyStore) Close() error
Close closes the database connection
func (*SQLiteKeyStore) Delete ¶
func (ks *SQLiteKeyStore) Delete(name string) error
Delete removes a key pair from the store
func (*SQLiteKeyStore) Export ¶
func (ks *SQLiteKeyStore) Export() ([]byte, error)
Export exports all keys to JSON
func (*SQLiteKeyStore) Get ¶
func (ks *SQLiteKeyStore) Get(name string) (*KeyPair, error)
Get retrieves a key pair by name
func (*SQLiteKeyStore) GetStats ¶
func (ks *SQLiteKeyStore) GetStats() (map[string]interface{}, error)
GetStats returns statistics about the keystore
func (*SQLiteKeyStore) Import ¶
func (ks *SQLiteKeyStore) Import(data []byte) error
Import imports keys from JSON
func (*SQLiteKeyStore) List ¶
func (ks *SQLiteKeyStore) List() ([]string, error)
List returns all key names
func (*SQLiteKeyStore) ListAll ¶
func (ks *SQLiteKeyStore) ListAll() ([]*KeyPair, error)
ListAll returns all key pairs
type USKCallback ¶
USKCallback is called when a USK update is received
type USKManager ¶
type USKManager struct {
// contains filtered or unexported fields
}
USKManager handles USK subscriptions
func NewUSKManager ¶
func NewUSKManager(client *Client) *USKManager
NewUSKManager creates a new USK manager
func (*USKManager) GetAllSubscriptions ¶
func (m *USKManager) GetAllSubscriptions() []*USKSubscription
GetAllSubscriptions returns all active subscriptions
func (*USKManager) GetSubscription ¶
func (m *USKManager) GetSubscription(identifier string) *USKSubscription
GetSubscription returns a subscription by identifier
func (*USKManager) Subscribe ¶
func (m *USKManager) Subscribe(uri string, callback USKCallback) (*USKSubscription, error)
Subscribe creates a new USK subscription
func (*USKManager) Unsubscribe ¶
func (m *USKManager) Unsubscribe(identifier string) error
Unsubscribe removes a USK subscription
func (*USKManager) UnsubscribeByURI ¶
func (m *USKManager) UnsubscribeByURI(uri string) error
UnsubscribeByURI removes a USK subscription by URI
type USKSubscription ¶
type USKSubscription struct {
ID string
URI string
Edition int64
Identifier string
DontPoll bool
Callbacks []USKCallback
// contains filtered or unexported fields
}
USKSubscription represents an active USK subscription
type VersionInfo ¶
type VersionInfo struct {
Version string
GoVersion string
OS string
Arch string
SourceURL string
License string
}
VersionInfo contains version and build information
func GetVersionInfo ¶
func GetVersionInfo() VersionInfo
GetVersionInfo returns complete version information