More cleanup.

This commit is contained in:
Adam Ierymenko 2021-09-13 15:03:21 -04:00
parent 13e342d34e
commit 4f70873a46
No known key found for this signature in database
GPG key ID: C8877CF2D7A5D7F3
7 changed files with 17 additions and 138 deletions

View file

@ -1,75 +0,0 @@
---
BasedOnStyle: LLVM
BreakBeforeBraces: Stroustrup
IndentWidth: 4
TabWidth: 4
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveMacros: Consecutive
AlignConsecutiveAssignments: Consecutive
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AlwaysBreakAfterReturnType: None
BinPackArguments: true
BinPackParameters: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
FixNamespaceComments: true
IncludeBlocks: Regroup
IndentCaseLabels: true
IndentPPDirectives: None
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PointerAlignment: Right
ReflowComments: true
SortIncludes: CaseInsensitive
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 3
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: true
SpacesInParentheses: false
SpacesInSquareBrackets: false
UseTab: Never
---
Language: Cpp
Standard: c++11
ColumnLimit: 360
---
Language: ObjC
ColumnLimit: 360
---
Language: Java
ColumnLimit: 360
---
Language: CSharp
ColumnLimit: 360
...

View file

@ -1,3 +0,0 @@
.git/
build/
!build/zerotier

48
.gitignore vendored
View file

@ -1,42 +1,8 @@
/build
/cmake-build-debug
/cmake-build-release
/core/version.h
/.idea
/.ide-*
.DS_Store
.Trashes
*.swp
._*
*~
*~.nib
*.secret
.Apple*
Thumbs.db
@eaDir
.vscode
__pycache__
*.log
*.bak
*.opensdf
*.user
*.cache
*.obj
*.tlog
*.pid
*.pkg
/target
/**/target
.DS_*
.Icon*
*.o
*.o-*
*.core
*.deb
*.rpm
*.autosave
*.tmp
.depend
node_modules
*.vcxproj.backup
/*.db
/*.opendb
/rust-zerotier-core/src/capi.rs
/service/src/osdep.rs
/*/target
*.so
*.dylib
*.a

View file

@ -12,11 +12,11 @@ use crate::vl1::protocol::PACKET_SIZE_MAX;
/// no involvement from a root at all.
#[derive(Clone, PartialEq, Eq)]
pub struct Locator {
subject: Address,
signer: Address,
timestamp: i64,
endpoints: Vec<Endpoint>,
signature: Vec<u8>,
pub subject: Address,
pub signer: Address,
pub timestamp: i64,
pub endpoints: Vec<Endpoint>,
pub signature: Vec<u8>,
}
impl Locator {
@ -62,21 +62,9 @@ impl Locator {
}
}
#[inline(always)]
pub fn subject(&self) -> Address { self.subject }
#[inline(always)]
pub fn signer(&self) -> Address { self.signer }
#[inline(always)]
pub fn is_proxy_signed(&self) -> bool { self.subject != self.signer }
#[inline(always)]
pub fn timestamp(&self) -> i64 { self.timestamp }
#[inline(always)]
pub fn endpoints(&self) -> &[Endpoint] { self.endpoints.as_slice() }
pub fn verify_signature(&self, signer_identity: &Identity) -> bool {
let mut buf: Buffer<{ PACKET_SIZE_MAX }> = Buffer::new();
if self.marshal_internal(&mut buf, true).is_ok() {

View file

@ -276,7 +276,7 @@ impl Node {
if peer.is_some() {
peer.unwrap().receive(self, ci, ph, time_ticks, &path, &packet_header, data.as_ref(), &[]);
} else {
self.whois.query(self, ci, source, Some(QueuedPacket::Singular(data)));
self.whois.query(self, ci, source, Some(QueuedPacket::Unfragmented(data)));
}
}
}

View file

@ -95,6 +95,8 @@ pub struct Root {
/// A signed bundle of root nodes.
///
/// In v1 this was the "World" object.
///
/// This is how roots are normally specified to nodes. The embedded signing key allows the
/// root set to be updated automatically. Updates can add, remove, or change the endpoints
/// of roots, allowing infrastructure updates with automatic client configuration as long

View file

@ -9,7 +9,7 @@ use crate::vl1::node::{Node, PacketBuffer, VL1CallerInterface};
use crate::vl1::protocol::{WHOIS_RETRY_INTERVAL, WHOIS_MAX_WAITING_PACKETS, WHOIS_RETRY_MAX};
pub(crate) enum QueuedPacket {
Singular(PacketBuffer),
Unfragmented(PacketBuffer),
Fragmented(FragmentedPacket)
}
@ -26,6 +26,7 @@ impl WhoisQueue {
pub fn new() -> Self { Self(Mutex::new(HashMap::new())) }
/// Launch or renew a WHOIS query and enqueue a packet to be processed when (if) it is received.
pub fn query<CI: VL1CallerInterface>(&self, node: &Node, ci: &CI, target: Address, packet: Option<QueuedPacket>) {
let mut q = self.0.lock();