76 lines
2.6 KiB
C
76 lines
2.6 KiB
C
#ifndef DEFAULT_CONFIG_EVENT_H
|
|
#define DEFAULT_CONFIG_EVENT_H
|
|
|
|
#include <cjson/cJSON.h>
|
|
#include "config.h" // For cli_options_t definition
|
|
|
|
/*
|
|
* Default Configuration Event Template
|
|
*
|
|
* This header contains the default configuration values for the C Nostr Relay.
|
|
* These values are used to create the initial kind 33334 configuration event
|
|
* during first-time startup.
|
|
*
|
|
* IMPORTANT: These values should never be accessed directly by other parts
|
|
* of the program. They are only used during initial configuration event creation.
|
|
*/
|
|
|
|
// Default configuration key-value pairs
|
|
static const struct {
|
|
const char* key;
|
|
const char* value;
|
|
} DEFAULT_CONFIG_VALUES[] = {
|
|
// Authentication
|
|
{"auth_enabled", "false"},
|
|
|
|
// NIP-42 Authentication Settings
|
|
{"nip42_auth_required_events", "false"},
|
|
{"nip42_auth_required_subscriptions", "false"},
|
|
{"nip42_auth_required_kinds", "4,14"}, // Default: DM kinds require auth
|
|
{"nip42_challenge_expiration", "600"}, // 10 minutes
|
|
|
|
// Server Core Settings
|
|
{"relay_port", "8888"},
|
|
{"max_connections", "100"},
|
|
|
|
// NIP-11 Relay Information (relay keys will be populated at runtime)
|
|
{"relay_description", "High-performance C Nostr relay with SQLite storage"},
|
|
{"relay_contact", ""},
|
|
{"relay_software", "https://git.laantungir.net/laantungir/c-relay.git"},
|
|
{"relay_version", "v1.0.0"},
|
|
|
|
// NIP-13 Proof of Work (pow_min_difficulty = 0 means PoW disabled)
|
|
{"pow_min_difficulty", "0"},
|
|
{"pow_mode", "basic"},
|
|
|
|
// NIP-40 Expiration Timestamp
|
|
{"nip40_expiration_enabled", "true"},
|
|
{"nip40_expiration_strict", "true"},
|
|
{"nip40_expiration_filter", "true"},
|
|
{"nip40_expiration_grace_period", "300"},
|
|
|
|
// Subscription Limits
|
|
{"max_subscriptions_per_client", "25"},
|
|
{"max_total_subscriptions", "5000"},
|
|
{"max_filters_per_subscription", "10"},
|
|
|
|
// Event Processing Limits
|
|
{"max_event_tags", "100"},
|
|
{"max_content_length", "8196"},
|
|
{"max_message_length", "16384"},
|
|
|
|
// Performance Settings
|
|
{"default_limit", "500"},
|
|
{"max_limit", "5000"}
|
|
};
|
|
|
|
// Number of default configuration values
|
|
#define DEFAULT_CONFIG_COUNT (sizeof(DEFAULT_CONFIG_VALUES) / sizeof(DEFAULT_CONFIG_VALUES[0]))
|
|
|
|
// Function to create default configuration event
|
|
cJSON* create_default_config_event(const unsigned char* admin_privkey_bytes,
|
|
const char* relay_privkey_hex,
|
|
const char* relay_pubkey_hex,
|
|
const cli_options_t* cli_options);
|
|
|
|
#endif /* DEFAULT_CONFIG_EVENT_H */ |