From 7d9bffdf9cd2bdb9627c925358f8e3477c5025d5 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Fri, 29 Jun 2018 08:15:15 -0400 Subject: [PATCH] make format --- daemon/rcutil.cpp | 55 +++++++++++++++++--------------- doc/proto_v0.txt | 2 +- include/llarp.h | 3 +- llarp/api/message.cpp | 2 +- llarp/codel.hpp | 18 ++++++----- llarp/context.cpp | 66 +++++++++++++++++++++----------------- llarp/iwp_link.cpp | 60 +++++++++++++++++++++-------------- llarp/logger.c | 1 - llarp/logger.cpp | 1 - llarp/net.hpp | 9 +++--- llarp/router.cpp | 73 ++++++++++++++++++++++--------------------- 11 files changed, 160 insertions(+), 130 deletions(-) diff --git a/daemon/rcutil.cpp b/daemon/rcutil.cpp index 6372ea6d2..b437faeac 100644 --- a/daemon/rcutil.cpp +++ b/daemon/rcutil.cpp @@ -24,8 +24,8 @@ handle_signal(int sig) #include "buffer.hpp" #include "crypto.hpp" #include "fs.hpp" -#include "router.hpp" #include "net.hpp" +#include "router.hpp" bool printNode(struct llarp_nodedb_iter *iter) @@ -41,16 +41,18 @@ printNode(struct llarp_nodedb_iter *iter) // fwd declr struct check_online_request; -void HandleDHTLocate(llarp_router_lookup_job *job) +void +HandleDHTLocate(llarp_router_lookup_job *job) { llarp::Info("DHT result: ", job->found ? "found" : "not found"); // save to nodedb? } -bool aiLister(struct llarp_ai_list_iter *request, struct llarp_ai *addr) +bool +aiLister(struct llarp_ai_list_iter *request, struct llarp_ai *addr) { static size_t count = 0; - count ++; + count++; llarp::Addr a(*addr); std::cout << "AddressInfo " << count << ": " << a << std::endl; return true; @@ -138,9 +140,9 @@ main(int argc, char *argv[]) break; case 'q': // printf ("option -g with value `%s'\n", optarg); - rcfname = optarg; + rcfname = optarg; haveRequiredOptions = true; - locateMode = true; + locateMode = true; break; case 'g': // printf ("option -g with value `%s'\n", optarg); @@ -168,7 +170,8 @@ main(int argc, char *argv[]) return 0; } printf("parsed options\n"); - if(!genMode && !updMode && !listMode && !importMode && !exportMode && !locateMode && !localMode) + if(!genMode && !updMode && !listMode && !importMode && !exportMode + && !locateMode && !localMode) { llarp::Error("I don't know what to do, no generate or update parameter\n"); return 0; @@ -283,48 +286,48 @@ main(int argc, char *argv[]) llarp::Info("Writing out: ", filename); llarp_rc_write(rc, filename.c_str()); } - if (locateMode) + if(locateMode) { llarp::Info("Going online"); llarp_main_setup(ctx); llarp::PubKey binaryPK; llarp::HexDecode(rcfname, binaryPK.data()); - - //llarp::SetLogLevel(llarp::eLogDebug); - + + // llarp::SetLogLevel(llarp::eLogDebug); + llarp::Info("Queueing job"); llarp_router_lookup_job *job = new llarp_router_lookup_job; - job->found = false; - job->hook = &HandleDHTLocate; - memcpy(job->target, binaryPK, PUBKEYSIZE); // set job's target + job->found = false; + job->hook = &HandleDHTLocate; + memcpy(job->target, binaryPK, PUBKEYSIZE); // set job's target // create query DHT request check_online_request *request = new check_online_request; - request->ptr = ctx; - request->job = job; - request->online = false; - request->nodes = 0; - request->first = false; + request->ptr = ctx; + request->job = job; + request->online = false; + request->nodes = 0; + request->first = false; llarp_main_queryDHT(request); llarp::Info("Processing"); // run system and wait llarp_main_run(ctx); } - if (localMode) + if(localMode) { - //llarp::Info("find our local rc file"); + // llarp::Info("find our local rc file"); - //llarp_rc *rc = llarp_rc_read("router.signed"); - llarp_rc *rc = llarp_main_getLocalRC(ctx); + // llarp_rc *rc = llarp_rc_read("router.signed"); + llarp_rc *rc = llarp_main_getLocalRC(ctx); char ftmp[68] = {0}; const char *hexPubSigKey = - llarp::HexEncode< llarp::PubKey, decltype(ftmp) >(rc->pubkey, ftmp); + llarp::HexEncode< llarp::PubKey, decltype(ftmp) >(rc->pubkey, ftmp); printf("PubSigKey [%s]\n", hexPubSigKey); struct llarp_ai_list_iter iter; - //iter.user - iter.visit=&aiLister; + // iter.user + iter.visit = &aiLister; llarp_ai_list_iterate(rc->addrs, &iter); } llarp_main_free(ctx); diff --git a/doc/proto_v0.txt b/doc/proto_v0.txt index b232d550e..4fde18ae5 100644 --- a/doc/proto_v0.txt +++ b/doc/proto_v0.txt @@ -316,7 +316,7 @@ the validity of the proof of work is that given h = HS(BE(w)) -h has log_e(y) prefix of 0x00 +h has log_e(y) prefixed bytes being 0x00 this proof of work requirement is subject to change diff --git a/include/llarp.h b/include/llarp.h index fb3d0b821..87338f9fd 100644 --- a/include/llarp.h +++ b/include/llarp.h @@ -57,7 +57,8 @@ struct check_online_request; /// check_online_request hook definition typedef void (*check_online_request_hook_func)(struct check_online_request *); -struct check_online_request { +struct check_online_request +{ struct llarp_main *ptr; struct llarp_router_lookup_job *job; bool online; diff --git a/llarp/api/message.cpp b/llarp/api/message.cpp index fc3c7b3f0..d5b1ac148 100644 --- a/llarp/api/message.cpp +++ b/llarp/api/message.cpp @@ -86,7 +86,7 @@ namespace llarp passbuf.sz = password.size(); crypto->shorthash(secret, passbuf); - //llarp::ShortHash digest; + // llarp::ShortHash digest; // zero hash hash.Zero(); diff --git a/llarp/codel.hpp b/llarp/codel.hpp index f6647f275..f80082d5a 100644 --- a/llarp/codel.hpp +++ b/llarp/codel.hpp @@ -32,7 +32,8 @@ namespace llarp Put(const T& i) { std::unique_lock< std::mutex > lock(m_QueueMutex); - //llarp::Info("CoDelQueue::Put - adding item, queue now has ", m_Queue.size(), " items at ", getTime(*item)); + // llarp::Info("CoDelQueue::Put - adding item, queue now has ", + // m_Queue.size(), " items at ", getTime(*item)); PutTime()(i); m_Queue.push(i); if(firstPut == 0) @@ -43,20 +44,21 @@ namespace llarp Process(std::queue< T >& result) { llarp_time_t lowest = 0xFFFFFFFFFFFFFFFFUL; - //auto start = llarp_time_now_ms(); - //llarp::Info("CoDelQueue::Process - start at ", start); + // auto start = llarp_time_now_ms(); + // llarp::Info("CoDelQueue::Process - start at ", start); std::unique_lock< std::mutex > lock(m_QueueMutex); auto start = firstPut; while(m_Queue.size()) { - //llarp::Info("CoDelQueue::Process - queue has ", m_Queue.size()); + // llarp::Info("CoDelQueue::Process - queue has ", m_Queue.size()); const auto& item = m_Queue.top(); auto dlt = start - GetTime()(item); - //llarp::Info("CoDelQueue::Process - dlt ", dlt); - lowest = std::min(dlt, lowest); + // llarp::Info("CoDelQueue::Process - dlt ", dlt); + lowest = std::min(dlt, lowest); if(m_Queue.size() == 1) { - //llarp::Info("CoDelQueue::Process - single item: lowest ", lowest, " dropMs: ", dropMs); + // llarp::Info("CoDelQueue::Process - single item: lowest ", lowest, + // " dropMs: ", dropMs); if(lowest > dropMs) { // drop @@ -73,7 +75,7 @@ namespace llarp dropNum = 0; } } - //llarp::Info("CoDelQueue::Process - passing"); + // llarp::Info("CoDelQueue::Process - passing"); result.push(item); m_Queue.pop(); } diff --git a/llarp/context.cpp b/llarp/context.cpp index f30c3f7f4..c7d93e8e5 100644 --- a/llarp/context.cpp +++ b/llarp/context.cpp @@ -2,8 +2,8 @@ #include #include #include "logger.hpp" -#include "router.hpp" #include "math.h" +#include "router.hpp" #if(__FreeBSD__) #include @@ -59,12 +59,12 @@ namespace llarp { ctx->worker = llarp_init_threadpool(workers, "llarp-worker"); } - } else - if (!strcmp(key, "contact-file")) + } + else if(!strcmp(key, "contact-file")) { strncpy(ctx->conatctFile, val, fmin(255, strlen(val))); - } else - if(!strcmp(key, "net-threads")) + } + else if(!strcmp(key, "net-threads")) { ctx->num_nethreads = atoi(val); if(ctx->num_nethreads <= 0) @@ -167,17 +167,18 @@ namespace llarp // set nodedb, load our RC, establish DHT llarp_run_router(router, nodedb); - return 0; // success + return 0; // success } int Context::Run() { - // just check to make sure it's not already set up (either this or we add a bool and/or add another function) - if (!this->router) + // just check to make sure it's not already set up (either this or we add a + // bool and/or add another function) + if(!this->router) { // set up all requirements - if (this->Setup()) + if(this->Setup()) { llarp::Error("Failed to setup router"); return 1; @@ -199,11 +200,10 @@ namespace llarp #if(__APPLE__ && __MACH__) #elif(__FreeBSD__) - pthread_set_name_np(netio_threads.back().native_handle(), - "llarp-netio"); + pthread_set_name_np(netio_threads.back().native_handle(), + "llarp-netio"); #else - pthread_setname_np(netio_threads.back().native_handle(), - "llarp-netio"); + pthread_setname_np(netio_threads.back().native_handle(), "llarp-netio"); #endif } llarp::Info("running mainloop"); @@ -367,7 +367,7 @@ llarp_main_getDatabase(struct llarp_main *ptr, byte_t *pk) { return ptr->ctx->GetDatabase(pk); } - + struct llarp_rc * llarp_main_getLocalRC(struct llarp_main *ptr) { @@ -383,17 +383,22 @@ llarp_main_getLocalRC(struct llarp_main *ptr) return rc; } -void llarp_main_checkOnline(void *u, uint64_t orig, uint64_t left) { - //llarp::Info("checkOnline - check ", left); +void +llarp_main_checkOnline(void *u, uint64_t orig, uint64_t left) +{ + // llarp::Info("checkOnline - check ", left); if(left) return; - struct check_online_request *request = static_cast(u); - //llarp::Debug("checkOnline - running"); - //llarp::Info("checkOnline - DHT nodes ", request->ptr->ctx->router->dht->impl.nodes->nodes.size()); + struct check_online_request *request = + static_cast< struct check_online_request * >(u); + // llarp::Debug("checkOnline - running"); + // llarp::Info("checkOnline - DHT nodes ", + // request->ptr->ctx->router->dht->impl.nodes->nodes.size()); request->online = false; - request->nodes = request->ptr->ctx->router->dht->impl.nodes->nodes.size(); - if (request->ptr->ctx->router->dht->impl.nodes->nodes.size()) { - //llarp::Info("checkOnline - Going to say we're online"); + request->nodes = request->ptr->ctx->router->dht->impl.nodes->nodes.size(); + if(request->ptr->ctx->router->dht->impl.nodes->nodes.size()) + { + // llarp::Info("checkOnline - Going to say we're online"); request->online = true; } request->hook(request); @@ -401,9 +406,13 @@ void llarp_main_checkOnline(void *u, uint64_t orig, uint64_t left) { llarp_main_queryDHT(request); } -void llarp_main_queryDHT_online(struct check_online_request *request) { - //Info("llarp_main_queryDHT_online: ", request->online ? "online" : "offline"); - if (request->online && !request->first) { +void +llarp_main_queryDHT_online(struct check_online_request *request) +{ + // Info("llarp_main_queryDHT_online: ", request->online ? "online" : + // "offline"); + if(request->online && !request->first) + { request->first = true; llarp::Info("llarp_main_queryDHT_online - We're online"); llarp::Info("llarp_main_queryDHT_online - Querying DHT"); @@ -411,13 +420,14 @@ void llarp_main_queryDHT_online(struct check_online_request *request) { } } -void llarp_main_queryDHT(struct check_online_request *request) +void +llarp_main_queryDHT(struct check_online_request *request) { - //llarp::Info("llarp_main_queryDHT - setting up timer"); + // llarp::Info("llarp_main_queryDHT - setting up timer"); request->hook = &llarp_main_queryDHT_online; llarp_logic_call_later(request->ptr->ctx->router->logic, {1000, request, &llarp_main_checkOnline}); - //llarp_dht_lookup_router(ptr->ctx->router->dht, job); + // llarp_dht_lookup_router(ptr->ctx->router->dht, job); } void diff --git a/llarp/iwp_link.cpp b/llarp/iwp_link.cpp index a40607b8a..2a67224ca 100644 --- a/llarp/iwp_link.cpp +++ b/llarp/iwp_link.cpp @@ -657,7 +657,9 @@ namespace iwp llarp::Debug("iwp_link::frame_state::process Got frag"); return got_frag(hdr, sz - 6); default: - llarp::Warn("iwp_link::frame_state::process - unknown header message type: ", (int)hdr.msgtype()); + llarp::Warn( + "iwp_link::frame_state::process - unknown header message type: ", + (int)hdr.msgtype()); return false; } } @@ -780,7 +782,7 @@ namespace iwp { session *self = static_cast< session * >(s->impl); auto id = self->frame.txids++; - //llarp::Debug("session sending to, number", id); + // llarp::Debug("session sending to, number", id); llarp::ShortHash digest; self->crypto->shorthash(digest, msg); transit_message *m = new transit_message(msg, digest, id); @@ -894,7 +896,7 @@ namespace iwp void pump() { - //llarp::Info("session pump"); + // llarp::Info("session pump"); // TODO: in codel the timestamp may cause excssive drop when all the // packets have a similar timestamp now = llarp_time_now_ms(); @@ -910,10 +912,10 @@ namespace iwp void recv(const void *buf, size_t sz) { - //llarp::Debug("session recv", state); + // llarp::Debug("session recv", state); - //frame_header hdr((byte_t *)buf); - //llarp::Debug("recv - message header type ", (int)hdr.msgtype()); + // frame_header hdr((byte_t *)buf); + // llarp::Debug("recv - message header type ", (int)hdr.msgtype()); now = llarp_time_now_ms(); switch(state) @@ -938,7 +940,10 @@ namespace iwp case eLIMSent: case eEstablished: // session is started - llarp::Debug("session recv - ", state==eSessionStartSent?"startsent":"", state==eLIMSent?"limset":"", state==eEstablished?"established":""); + llarp::Debug("session recv - ", + state == eSessionStartSent ? "startsent" : "", + state == eLIMSent ? "limset" : "", + state == eEstablished ? "established" : ""); decrypt_frame(buf, sz); break; @@ -1128,8 +1133,8 @@ namespace iwp { if(sz > 64) { - //auto frame = alloc_frame(inboundFrames, buf, sz); - //inboundFrames.Put(frame); + // auto frame = alloc_frame(inboundFrames, buf, sz); + // inboundFrames.Put(frame); auto f = alloc_frame(buf, sz); /* if(iwp_decrypt_frame(f)) @@ -1153,8 +1158,8 @@ namespace iwp llarp::Warn("short packet of ", sz, " bytes"); } - //static void - //handle_crypto_pump(void *u); + // static void + // handle_crypto_pump(void *u); static void handle_crypto_outbound(void *u); @@ -1218,9 +1223,9 @@ namespace iwp frame->user = this; frame->sessionkey = sessionkey; /// TODO: this could be rather slow - //frame->created = now; - //llarp::Info("alloc_frame putting into q"); - //q.Put(frame); + // frame->created = now; + // llarp::Info("alloc_frame putting into q"); + // q.Put(frame); return frame; } @@ -1248,8 +1253,8 @@ namespace iwp { auto &front = outq.front(); - //if(iwp_encrypt_frame(&front)) - //q.push(front); + // if(iwp_encrypt_frame(&front)) + // q.push(front); if(iwp_encrypt_frame(front)) handle_frame_encrypt(front); delete front; @@ -1391,14 +1396,16 @@ namespace iwp void EnterState(State st) { - llarp::Debug("EnterState - entering state: ", st, state==eLIMSent?"eLIMSent":"", state==eSessionStartSent?"eSessionStartSent":""); + llarp::Debug("EnterState - entering state: ", st, + state == eLIMSent ? "eLIMSent" : "", + state == eSessionStartSent ? "eSessionStartSent" : ""); frame.alive(); state = st; if(state == eSessionStartSent || state == eIntroAckSent) { - //llarp::Info("EnterState - ", state==eLIMSent?"eLIMSent":"", state==eSessionStartSent?"eSessionStartSent":""); - //PumpCodelInbound(); - //PumpCodelOutbound(); + // llarp::Info("EnterState - ", state==eLIMSent?"eLIMSent":"", + // state==eSessionStartSent?"eSessionStartSent":""); PumpCodelInbound(); + // PumpCodelOutbound(); PumpCryptoOutbound(); // StartInboundCodel(); } @@ -1922,19 +1929,24 @@ namespace iwp // both sides agreeed to session invalidation // terminate our session when all of our frames from the crypto workers // are done - llarp::Warn("Tick - ", addr, " invaldiated session with ", frames, " frames left"); + llarp::Warn("Tick - ", addr, " invaldiated session with ", frames, + " frames left"); return !working; } // send keepalive if we are established or a session is made - if(state == eEstablished || state == eLIMSent) { - llarp::Debug("Tick - sending keepalive because state=", state == eEstablished ? "eEstablished" : "", state == eLIMSent ? "eLIMSent" : ""); + if(state == eEstablished || state == eLIMSent) + { + llarp::Debug("Tick - sending keepalive because state=", + state == eEstablished ? "eEstablished" : "", + state == eLIMSent ? "eLIMSent" : ""); send_keepalive(this); } // pump frame state if(state == eEstablished) { - //llarp::Debug("Tick - pumping and retransmitting because we're eEstablished"); + // llarp::Debug("Tick - pumping and retransmitting because we're + // eEstablished"); frame.retransmit(); pump(); PumpCryptoOutbound(); diff --git a/llarp/logger.c b/llarp/logger.c index 3f37f58f7..86198b309 100644 --- a/llarp/logger.c +++ b/llarp/logger.c @@ -1,2 +1 @@ #include "logger.h" - diff --git a/llarp/logger.cpp b/llarp/logger.cpp index c9db6eb5d..738564bc2 100644 --- a/llarp/logger.cpp +++ b/llarp/logger.cpp @@ -18,5 +18,4 @@ cSetLogLevel(LogLevel lvl) { llarp::SetLogLevel((llarp::LogLevel)lvl); } - } diff --git a/llarp/net.hpp b/llarp/net.hpp index 8aceb8c36..c5ab10d2a 100644 --- a/llarp/net.hpp +++ b/llarp/net.hpp @@ -204,15 +204,16 @@ namespace llarp return !(*this == other); } - bool isPrivate() + bool + isPrivate() { in_addr_t addr = this->addr4()->s_addr; - unsigned byte = ntohl(addr); + unsigned byte = ntohl(addr); unsigned byte1 = byte >> 24 & 0xff; unsigned byte2 = byte >> 16 & 0xff; - return (byte1 == 10 || (byte1 == 192 && byte2 == 168) || (byte1 == 172 && (byte2 & 0xf0) == 16)); + return (byte1 == 10 || (byte1 == 192 && byte2 == 168) + || (byte1 == 172 && (byte2 & 0xf0) == 16)); } - }; struct addrhash diff --git a/llarp/router.cpp b/llarp/router.cpp index f5e0e0e75..b44f54a20 100644 --- a/llarp/router.cpp +++ b/llarp/router.cpp @@ -38,7 +38,7 @@ llarp_router::llarp_router() { // set rational defaults this->ip4addr.sin_family = AF_INET; - this->ip4addr.sin_port = htons(1090); + this->ip4addr.sin_port = htons(1090); llarp_rc_clear(&rc); } @@ -99,8 +99,8 @@ llarp_router::SendToOrQueue(const llarp::RouterID &remote, // this would never be true, as everything is in memory // but we'll keep around if we ever need to swap them out of memory - // but it's best to keep the paradigm that everythign is in memory at this point in development - // as it will reduce complexity + // but it's best to keep the paradigm that everythign is in memory at this + // point in development as it will reduce complexity /* // try requesting the rc from the disk llarp_async_load_rc *job = new llarp_async_load_rc; @@ -523,12 +523,12 @@ llarp_router::on_try_connect_result(llarp_link_establish_job *job) llarp_router *router = static_cast< llarp_router * >(job->user); if(job->session) { - //llarp::Debug("try_connect got session"); + // llarp::Debug("try_connect got session"); auto session = job->session; router->async_verify_RC(session, false, job); return; } - //llarp::Debug("try_connect no session"); + // llarp::Debug("try_connect no session"); llarp::PubKey pk = job->pubkey; if(job->retries > 0) { @@ -595,51 +595,52 @@ llarp_router::Run() // zero out router contact llarp::Zero(&rc, sizeof(llarp_rc)); // fill our address list - rc.addrs = llarp_ai_list_new(); + rc.addrs = llarp_ai_list_new(); bool publicFound = false; - - sockaddr * dest = (sockaddr *) &this->ip4addr; + + sockaddr *dest = (sockaddr *)&this->ip4addr; llarp::Addr publicAddr(*dest); - if (this->publicOverride) + if(this->publicOverride) { - if (publicAddr) + if(publicAddr) { - llarp::Info("public address:port ", publicAddr);; + llarp::Info("public address:port ", publicAddr); + ; } } - + llarp::Info("You have ", inboundLinks.size(), " inbound links"); for(auto link : inboundLinks) { llarp_ai addr; link->get_our_address(link, &addr); llarp::Addr a(addr); - if (this->publicOverride && a.sameAddr(publicAddr)) + if(this->publicOverride && a.sameAddr(publicAddr)) { llarp::Info("Found adapter for public address"); publicFound = true; } - if (a.isPrivate()) + if(a.isPrivate()) { llarp::Warn("Skipping private network link: ", a); continue; } llarp::Info("Loading Addr: ", a, " into our RC"); - + llarp_ai_list_pushback(rc.addrs, &addr); }; - if (this->publicOverride && !publicFound) + if(this->publicOverride && !publicFound) { - //llarp::Warn("Need to load our public IP into RC!"); - + // llarp::Warn("Need to load our public IP into RC!"); + llarp_link *link = nullptr; - if (inboundLinks.size() == 1) + if(inboundLinks.size() == 1) { link = inboundLinks.front(); } else { - if (!inboundLinks.size()) + if(!inboundLinks.size()) { llarp::Error("No inbound links found, aborting"); return; @@ -649,7 +650,7 @@ llarp_router::Run() // create a new link link = new llarp_link; llarp::Zero(link, sizeof(llarp_link)); - + llarp_iwp_args args = { .crypto = &this->crypto, .logic = this->logic, @@ -660,13 +661,13 @@ llarp_router::Run() iwp_link_init(link, args); if(llarp_link_initialized(link)) { - + } */ } link->get_our_address(link, &this->addrInfo); // override ip and port - this->addrInfo.ip = *publicAddr.addr6(); + this->addrInfo.ip = *publicAddr.addr6(); this->addrInfo.port = publicAddr.port(); llarp::Info("Loaded our public ", publicAddr, " override into RC!"); // we need the link to set the pubkey @@ -846,10 +847,11 @@ llarp_router_try_connect(struct llarp_router *router, struct llarp_rc *remote, { char ftmp[68] = {0}; const char *hexname = - llarp::HexEncode< llarp::PubKey, decltype(ftmp) >(remote->pubkey, ftmp); + llarp::HexEncode< llarp::PubKey, decltype(ftmp) >(remote->pubkey, ftmp); // do we already have a pending job for this remote? - if(router->HasPendingConnectJob(remote->pubkey)) { + if(router->HasPendingConnectJob(remote->pubkey)) + { llarp::Debug("We have pending connect jobs to ", hexname); return false; } @@ -1156,10 +1158,11 @@ namespace llarp } else { - llarp::Error("link ", key, " failed to initialize. Link state", link); + llarp::Error("link ", key, " failed to initialize. Link state", link); } } - llarp::Error("link ", key, " failed to configure. (Note: We don't support * yet)"); + llarp::Error("link ", key, + " failed to configure. (Note: We don't support * yet)"); } else if(StrEq(section, "connect")) { @@ -1186,25 +1189,25 @@ namespace llarp if(StrEq(key, "public-address")) { llarp::Info("public ip ", val, " size ", strlen(val)); - if (strlen(val) < 17) { + if(strlen(val) < 17) + { // assume IPv4 inet_pton(AF_INET, val, &self->ip4addr.sin_addr); - //struct sockaddr dest; - sockaddr * dest = (sockaddr *) &self->ip4addr; + // struct sockaddr dest; + sockaddr *dest = (sockaddr *)&self->ip4addr; llarp::Addr a(*dest); llarp::Info("setting public ipv4 ", a); - self->addrInfo.ip = *a.addr6(); + self->addrInfo.ip = *a.addr6(); self->publicOverride = true; } - //llarp::Addr a(val); - + // llarp::Addr a(val); } if(StrEq(key, "public-port")) { llarp::Info("Setting public port ", val); self->ip4addr.sin_port = htons(atoi(val)); - self->addrInfo.port = htons(atoi(val)); - self->publicOverride = true; + self->addrInfo.port = htons(atoi(val)); + self->publicOverride = true; } } }