#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <stdint.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/socket.h>
#include <switch.h>
#include <curl/curl.h>
#include <pthread.h>
#include <errno.h>
#include <stdatomic.h>
#include "dashboard.h"
#include "switch/crypto/sha1.h"
#include "jsmn.h"
Go to the source code of this file.
Data Structures | |
struct | MiningResults |
aggregated mining results of all threads More... | |
struct | ThreadData |
thread-specific mining data and state More... | |
struct | WebDashboard |
web dashboard server information More... | |
struct | ResourceManager |
resource manager for system-wide state More... | |
struct | MiningConfig |
mining configuration from config file More... | |
struct | MemoryStruct |
memory buffer for CURL operation More... | |
Macros | |
#define | CONFIG_FILE "config.txt" |
config file/path | |
#define | SOFTWARE "nxducominer" |
software identifier | |
#define | GET_POOL "https://server.duinocoin.com/getPool" |
pool server url | |
#define | DUCO_ORANGE CONSOLE_ESC(38;2;252;104;3m) |
duinocoin branding https://github.com/revoxhere/duino-coin/tree/useful-tools#branding | |
#define | ERROR_RED CONSOLE_ESC(31m) |
#define | NOTICE_BLUE CONSOLE_ESC(38;2;135;206;235m) |
#define | DARK_GREY CONSOLE_ESC(38;2;90;90;90m) |
#define | LIGHT_GREY CONSOLE_ESC(38;2;135;135;135m) |
#define | RESET CONSOLE_ESC(0m) |
#define | CONSOLE_ESC_NSTR(fmt) "\033[" fmt |
console escape helper, does not stringify. | |
Functions | |
void | cleanup (char *msg) |
clean up resources and exit | |
const char * | get_psm_charger_type (PsmChargerType type) |
string representation of charger type | |
void | get_time_string (char *buffer, int size) |
get current time as formatted string | |
void * | safe_malloc (size_t size) |
safe malloc with zero-initialization | |
char * | safe_strdup (const char *src) |
safe strdup | |
void | set_dynamic_string (char **field, const char *value) |
set dynamic string field with memory management | |
ssize_t | safe_write (int fd, const char *buf, size_t len) |
safe socket write with retry | |
static size_t | write_memory_callback (void *contents, size_t size, size_t nmemb, void *userp) |
CURL write callback for memory buffer. | |
void | replace_placeholder (char **str, const char *placeholder, const char *value) |
replace all occurrences of placeholder in string (html) with value | |
void | parse_config_file (MiningConfig *config) |
parse configuration file | |
void | get_node (char **ip, int *port, char **name) |
get mining node from DuinoCoin server | |
void * | do_mining_work (void *arg) |
mining thread worker function | |
void * | web_dashboard (void *arg) |
web dashboard server thread | |
int | main () |
entry point | |
Variables | |
MiningResults | mr |
WebDashboard | web |
ResourceManager | res |
MiningConfig | mc |
#define CONSOLE_ESC_NSTR | ( | fmt | ) | "\033[" fmt |
#define DUCO_ORANGE CONSOLE_ESC(38;2;252;104;3m) |
duinocoin branding https://github.com/revoxhere/duino-coin/tree/useful-tools#branding
#define GET_POOL "https://server.duinocoin.com/getPool" |
void cleanup | ( | char * | msg | ) |
void * do_mining_work | ( | void * | arg | ) |
void get_node | ( | char ** | ip, |
int * | port, | ||
char ** | name | ||
) |
int main | ( | ) |
void parse_config_file | ( | MiningConfig * | config | ) |
void * web_dashboard | ( | void * | arg | ) |