From 25cb3edeb0060d7d418e954d1d298cd48d14b6fd Mon Sep 17 00:00:00 2001 From: Tom Early Date: Fri, 24 Mar 2023 21:21:08 -0700 Subject: [PATCH] added bootstrap string to config --- config/urfd.ini | 5 +++++ config/urfd.mk | 3 +++ reflector/Configure.cpp | 6 ++++++ reflector/JsonKeys.h | 4 ++-- reflector/Makefile | 6 ++++++ 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/config/urfd.ini b/config/urfd.ini index e476ab6..aa6a251 100644 --- a/config/urfd.ini +++ b/config/urfd.ini @@ -12,6 +12,11 @@ Country = GB Sponsor = My Home Club +# Bootstrap is the internet address of any existing DHT client. +# Usually, choose a frequented, or close, reflector if it's already a DHT +# client. If that's not possible, you can use xrf757.openquad.net +Bootstrap = xrf757.openquad.net + [IP Addresses] # Binding addresses are usually the 'any' address IPv4Binding = 0.0.0.0 diff --git a/config/urfd.mk b/config/urfd.mk index 641bc68..3e4ad1a 100644 --- a/config/urfd.mk +++ b/config/urfd.mk @@ -4,3 +4,6 @@ BINDIR = /usr/local/bin # besides making an executable that gdb can use, # this will also provide some additional log messsage debug = false + +# To disable DHT support, set DHT to false. +DHT = true diff --git a/reflector/Configure.cpp b/reflector/Configure.cpp index 35dfa3a..b3444eb 100644 --- a/reflector/Configure.cpp +++ b/reflector/Configure.cpp @@ -33,6 +33,7 @@ // ini file keywords #define JAUTOLINKMODULE "AutoLinkModule" #define JBLACKLISTPATH "BlacklistPath" +#define JBOOTSTRAP "Bootstrap" #define JBRANDMEISTER "Brandmeister" #define JCALLSIGN "Callsign" #define JCOUNTRY "Country" @@ -250,6 +251,8 @@ bool CConfigure::ReadData(const std::string &path) case ESection::names: if (0 == key.compare(JCALLSIGN)) data[g_Keys.names.callsign] = value; + else if (0 == key.compare(JBOOTSTRAP)) + data[g_Keys.names.bootstrap] = value; else if (0 == key.compare(JSYSOPEMAIL)) data[g_Keys.names.email] = value; else if (0 == key.compare(JCOUNTRY)) @@ -506,6 +509,9 @@ bool CConfigure::ReadData(const std::string &path) } } +#ifndef NO_DHT + isDefined(ErrorLevel::fatal, JNAMES, JBOOTSTRAP, g_Keys.names.bootstrap, rval); +#endif isDefined(ErrorLevel::mild, JNAMES, JSYSOPEMAIL, g_Keys.names.email, rval); isDefined(ErrorLevel::mild, JNAMES, JCOUNTRY, g_Keys.names.country, rval); isDefined(ErrorLevel::mild, JNAMES, JSPONSOR, g_Keys.names.sponsor, rval); diff --git a/reflector/JsonKeys.h b/reflector/JsonKeys.h index f604e30..29e96b5 100644 --- a/reflector/JsonKeys.h +++ b/reflector/JsonKeys.h @@ -39,8 +39,8 @@ struct SJsonKeys { struct MMDVM { const std::string port, defaultid; } mmdvm { "MMDVMPort", "mmdvmdefaultid" }; - struct NAMES { const std::string callsign, email, country, sponsor; } - names { "Callsign", "SysopEmail", "Country", "Sponsor" }; + struct NAMES { const std::string callsign, bootstrap, email, country, sponsor; } + names { "Callsign", "bootstrap", "SysopEmail", "Country", "Sponsor" }; struct IP { const std::string ipv4bind, ipv4address, ipv6bind, ipv6address, transcoder; } ip { "ipv4bind", "IPv4Address", "ipv6bind", "IPv6Address", "tcaddress" }; diff --git a/reflector/Makefile b/reflector/Makefile index c9c8272..86a9d26 100644 --- a/reflector/Makefile +++ b/reflector/Makefile @@ -34,6 +34,12 @@ endif LDFLAGS=-pthread -lcurl +ifeq ($(DHT), true) +LDFLAGS += -lopendht +else +CFLAGS += -DNO_DHT +endif + SRCS = $(wildcard *.cpp) OBJS = $(SRCS:.cpp=.o) DEPS = $(SRCS:.cpp=.d)