mirror of https://github.com/oxen-io/lokinet
clang-format
parent
a704a28f34
commit
de3ddbb93e
@ -0,0 +1,108 @@
|
||||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -2
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlines: Right
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: false
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 80
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||
Priority: 3
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IndentCaseLabels: false
|
||||
IndentWidth: 2
|
||||
IndentWrappedFunctionNames: false
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PointerAlignment: Right
|
||||
ReflowComments: true
|
||||
SortIncludes: true
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Cpp11
|
||||
TabWidth: 2
|
||||
UseTab: Never
|
||||
...
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef SARP_NET_H
|
||||
#define SARP_NET_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#endif
|
||||
|
@ -1,33 +1,26 @@
|
||||
#ifndef LLARP_LINK_HPP
|
||||
#define LLARP_LINK_HPP
|
||||
#include <netinet/in.h>
|
||||
#include <llarp/crypto.h>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <llarp/crypto.h>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "mem.hpp"
|
||||
#include <llarp/ev.h>
|
||||
#include <llarp/router_contact.h>
|
||||
#include "mem.hpp"
|
||||
|
||||
|
||||
struct llarp_link
|
||||
{
|
||||
static void * operator new(size_t sz)
|
||||
{
|
||||
struct llarp_link {
|
||||
static void *operator new(size_t sz) {
|
||||
return llarp_g_mem.alloc(sz, llarp::alignment<llarp_link>());
|
||||
}
|
||||
|
||||
static void operator delete(void * ptr)
|
||||
{
|
||||
llarp_g_mem.free(ptr);
|
||||
}
|
||||
static void operator delete(void *ptr) { llarp_g_mem.free(ptr); }
|
||||
|
||||
struct sockaddr_in6 localaddr;
|
||||
int af;
|
||||
llarp_udp_listener listener;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -1,8 +1,5 @@
|
||||
#include <llarp/mem.h>
|
||||
|
||||
extern "C" {
|
||||
struct llarp_alloc llarp_g_mem = {
|
||||
.alloc = nullptr,
|
||||
.free = nullptr
|
||||
};
|
||||
struct llarp_alloc llarp_g_mem = {.alloc = nullptr, .free = nullptr};
|
||||
}
|
||||
|
@ -1,14 +1,11 @@
|
||||
#ifndef LLARP_MEM_HPP
|
||||
#define LLARP_MEM_HPP
|
||||
#include <llarp/mem.h>
|
||||
#include <cmath>
|
||||
namespace llarp
|
||||
{
|
||||
template<typename T>
|
||||
static constexpr size_t alignment()
|
||||
{
|
||||
#include <llarp/mem.h>
|
||||
namespace llarp {
|
||||
template <typename T> static constexpr size_t alignment() {
|
||||
return std::exp2(1 + std::floor(std::log2(sizeof(T))));
|
||||
}
|
||||
}
|
||||
} // namespace llarp
|
||||
|
||||
#endif
|
||||
|
@ -1,24 +1,20 @@
|
||||
#include "router_contact.hpp"
|
||||
#include "exit_info.hpp"
|
||||
#include "address_info.hpp"
|
||||
#include "bencode.hpp"
|
||||
#include "exit_info.hpp"
|
||||
|
||||
extern "C" {
|
||||
extern "C" {}
|
||||
|
||||
}
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
bool BEncode(const llarp_rc & a, llarp_buffer_t * buff)
|
||||
{
|
||||
namespace llarp {
|
||||
bool BEncode(const llarp_rc &a, llarp_buffer_t *buff) {
|
||||
std::list<llarp_ai> addresses = ai_list_to_std(a.addrs);
|
||||
std::list<llarp_xi> exits = xi_list_to_std(a.exits);
|
||||
return bencodeDict(buff) &&
|
||||
bencodeDictKey(buff, "a") && BEncode(addresses, buff) &&
|
||||
return bencodeDict(buff) && bencodeDictKey(buff, "a") &&
|
||||
BEncode(addresses, buff) &&
|
||||
bencodeDict_Bytes(buff, "k", a.pubkey, sizeof(a.pubkey)) &&
|
||||
bencodeDict_Int(buff, "v", 0) &&
|
||||
bencodeDictKey(buff, "x") && BEncode(exits, buff) &&
|
||||
bencodeDict_Int(buff, "v", 0) && bencodeDictKey(buff, "x") &&
|
||||
BEncode(exits, buff) &&
|
||||
bencodeDict_Bytes(buff, "z", a.signature, sizeof(a.signature)) &&
|
||||
bencodeEnd(buff);
|
||||
}
|
||||
}
|
||||
} // namespace llarp
|
||||
|
@ -1,25 +1,22 @@
|
||||
#include <llarp/time.h>
|
||||
#include <chrono>
|
||||
#include <llarp/time.h>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
namespace llarp {
|
||||
typedef std::chrono::steady_clock clock_t;
|
||||
|
||||
template<typename Res, typename IntType>
|
||||
static IntType time_since_epoch()
|
||||
{
|
||||
return std::chrono::duration_cast<Res>(llarp::clock_t::now().time_since_epoch()).count();
|
||||
}
|
||||
template <typename Res, typename IntType> static IntType time_since_epoch() {
|
||||
return std::chrono::duration_cast<Res>(
|
||||
llarp::clock_t::now().time_since_epoch())
|
||||
.count();
|
||||
}
|
||||
} // namespace llarp
|
||||
|
||||
extern "C" {
|
||||
llarp_time_t llarp_time_now_ms()
|
||||
{
|
||||
llarp_time_t llarp_time_now_ms() {
|
||||
return llarp::time_since_epoch<std::chrono::milliseconds, llarp_time_t>();
|
||||
}
|
||||
|
||||
llarp_seconds_t llarp_time_now_sec()
|
||||
{
|
||||
llarp_seconds_t llarp_time_now_sec() {
|
||||
return llarp::time_since_epoch<std::chrono::seconds, llarp_seconds_t>();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue