mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-07 13:03:45 +02:00
Says hello to a root again!
This commit is contained in:
parent
2017dcf746
commit
aafac271f5
10 changed files with 29 additions and 14 deletions
|
@ -6,9 +6,9 @@
|
||||||
|
|
||||||
for i in $*; do
|
for i in $*; do
|
||||||
echo $i
|
echo $i
|
||||||
../../zerotier-system-service/target/debug/zerotier-system-service rootset sign root.zerotier.com.json $i >tmp.json
|
../../target/debug/zerotier rootset sign root.zerotier.com.json $i >tmp.json
|
||||||
mv -f tmp.json root.zerotier.com.json
|
mv -f tmp.json root.zerotier.com.json
|
||||||
../../zerotier-system-service/target/debug/zerotier-system-service rootset marshal root.zerotier.com.json >root.zerotier.com.bin
|
../../target/debug/zerotier rootset marshal root.zerotier.com.json >root.zerotier.com.bin
|
||||||
done
|
done
|
||||||
|
|
||||||
cat root.zerotier.com.json
|
cat root.zerotier.com.json
|
||||||
|
|
Binary file not shown.
|
@ -4,8 +4,8 @@
|
||||||
"revision": 1,
|
"revision": 1,
|
||||||
"members": [ {
|
"members": [ {
|
||||||
"identity": "bc47f54ab2:0:cfb92160bab1da37f31247ded76d8327c00c4d3e49d8a424c6ba16fe3e77b949ab782426584b0169e7b38f7679ea24f38cea637a7a93a9272bfcb0ff461c1e97",
|
"identity": "bc47f54ab2:0:cfb92160bab1da37f31247ded76d8327c00c4d3e49d8a424c6ba16fe3e77b949ab782426584b0169e7b38f7679ea24f38cea637a7a93a9272bfcb0ff461c1e97",
|
||||||
"endpoints": [ "udp:207.148.9.48/19993" ],
|
"endpoints": [ "udp:155.138.155.187/9994", "udp:2001:19f0:b002:97d:5400:4ff:fe23:8b4f/9994" ],
|
||||||
"signature": [ 1, 245, 109, 237, 214, 63, 96, 169, 196, 122, 200, 142, 64, 240, 230, 212, 109, 84, 136, 72, 101, 127, 75, 243, 56, 4, 140, 117, 131, 184, 94, 156, 153, 33, 8, 70, 12, 108, 107, 240, 180, 30, 7, 32, 161, 85, 15, 151, 247, 91, 197, 68, 30, 157, 229, 245, 162, 120, 123, 2, 191, 104, 255, 212, 6 ],
|
"signature": [ 1, 113, 131, 214, 145, 253, 53, 42, 191, 16, 109, 100, 128, 235, 154, 127, 188, 108, 120, 147, 151, 5, 33, 116, 162, 162, 35, 214, 88, 242, 61, 184, 14, 49, 33, 153, 210, 140, 175, 252, 108, 220, 1, 121, 20, 88, 56, 42, 196, 19, 159, 200, 57, 219, 103, 229, 42, 149, 170, 39, 239, 8, 32, 159, 9 ],
|
||||||
"priority": 0,
|
"priority": 0,
|
||||||
"protocol_version": 0
|
"protocol_version": 0
|
||||||
} ]
|
} ]
|
||||||
|
|
|
@ -820,6 +820,15 @@ impl<HostSystemImpl: HostSystem> Node<HostSystemImpl> {
|
||||||
self.roots.read().sets.iter().any(|rs| !rs.1.members.is_empty())
|
self.roots.read().sets.iter().any(|rs| !rs.1.members.is_empty())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Initialize with default roots if there are no roots defined, otherwise do nothing.
|
||||||
|
pub fn init_default_roots(&self) -> bool {
|
||||||
|
if !self.has_roots_defined() {
|
||||||
|
self.add_update_root_set(RootSet::zerotier_default())
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Get the root sets that this node trusts.
|
/// Get the root sets that this node trusts.
|
||||||
pub fn root_sets(&self) -> Vec<RootSet> {
|
pub fn root_sets(&self) -> Vec<RootSet> {
|
||||||
self.roots.read().sets.values().cloned().collect()
|
self.roots.read().sets.values().cloned().collect()
|
||||||
|
|
|
@ -90,11 +90,9 @@ impl RootSet {
|
||||||
/// Get the ZeroTier default root set, which contains roots run by ZeroTier Inc.
|
/// Get the ZeroTier default root set, which contains roots run by ZeroTier Inc.
|
||||||
pub fn zerotier_default() -> Self {
|
pub fn zerotier_default() -> Self {
|
||||||
let mut cursor = 0;
|
let mut cursor = 0;
|
||||||
let rs = Self::unmarshal(
|
//let rs = include_bytes!("../../default-rootset/root.zerotier.com.bin");
|
||||||
&Buffer::from(include_bytes!("../../default-rootset/root.zerotier.com.bin")),
|
let rs = include_bytes!("../../default-rootset/test-root.bin");
|
||||||
&mut cursor,
|
let rs = Self::unmarshal(&Buffer::from(rs), &mut cursor).unwrap();
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
assert!(rs.verify());
|
assert!(rs.verify());
|
||||||
rs
|
rs
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,9 +73,9 @@ Advanced Operations:
|
||||||
service Start local service
|
service Start local service
|
||||||
(usually not invoked manually)
|
(usually not invoked manually)
|
||||||
|
|
||||||
· Command requires a running node to control.
|
· Command requires a running node to control.
|
||||||
@ Argument is the path to a file containing the object.
|
@ Argument is the path to a file containing the object.
|
||||||
? Argument can be either the object or a path to it (auto-detected).
|
? Argument can be either the object or a path to it (auto-detected).
|
||||||
|
|
||||||
"###,
|
"###,
|
||||||
VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION,
|
VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION,
|
||||||
|
|
|
@ -4,7 +4,7 @@ use std::collections::BTreeMap;
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use zerotier_network_hypervisor::vl1::{Address, Endpoint, InetAddress};
|
use zerotier_network_hypervisor::vl1::{Address, Endpoint};
|
||||||
use zerotier_network_hypervisor::vl2::NetworkId;
|
use zerotier_network_hypervisor::vl2::NetworkId;
|
||||||
use zerotier_vl1_service::Settings;
|
use zerotier_vl1_service::Settings;
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,8 @@ async fn async_main(flags: Flags, global_args: Box<ArgMatches>) -> i32 {
|
||||||
let datadir = open_datadir(&flags).await;
|
let datadir = open_datadir(&flags).await;
|
||||||
let svc = VL1Service::new(datadir, test_inner, test_path_filter, zerotier_vl1_service::Settings::default()).await;
|
let svc = VL1Service::new(datadir, test_inner, test_path_filter, zerotier_vl1_service::Settings::default()).await;
|
||||||
if svc.is_ok() {
|
if svc.is_ok() {
|
||||||
|
let svc = svc.unwrap();
|
||||||
|
svc.node().init_default_roots();
|
||||||
let _ = tokio::signal::ctrl_c().await;
|
let _ = tokio::signal::ctrl_c().await;
|
||||||
println!("Terminate signal received, shutting down...");
|
println!("Terminate signal received, shutting down...");
|
||||||
exitcode::OK
|
exitcode::OK
|
||||||
|
|
|
@ -135,7 +135,10 @@ impl<StorageImpl: Storage, PathFilterImpl: PathFilter, InnerProtocolImpl: InnerP
|
||||||
|
|
||||||
let p = 50000 + ((random::xorshift64_random() as u16) % 15535);
|
let p = 50000 + ((random::xorshift64_random() as u16) % 15535);
|
||||||
if !state.udp_sockets.contains_key(&p) && udp_test_bind(p) {
|
if !state.udp_sockets.contains_key(&p) && udp_test_bind(p) {
|
||||||
let _ = state.udp_sockets.insert(p, parking_lot::RwLock::new(BoundUdpPort::new(p)));
|
have_random_port_count += state
|
||||||
|
.udp_sockets
|
||||||
|
.insert(p, parking_lot::RwLock::new(BoundUdpPort::new(p)))
|
||||||
|
.is_none() as usize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,6 +195,7 @@ impl<StorageImpl: Storage, PathFilterImpl: PathFilter, InnerProtocolImpl: InnerP
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn node_background_task_daemon(self: Arc<Self>) {
|
async fn node_background_task_daemon(self: Arc<Self>) {
|
||||||
|
tokio::time::sleep(Duration::from_secs(1)).await;
|
||||||
loop {
|
loop {
|
||||||
tokio::time::sleep(self.node().do_background_tasks(self.as_ref()).await).await;
|
tokio::time::sleep(self.node().do_background_tasks(self.as_ref()).await).await;
|
||||||
}
|
}
|
||||||
|
@ -238,7 +242,9 @@ impl<StorageImpl: Storage, PathFilterImpl: PathFilter, InnerProtocolImpl: InnerP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
println!("wire_send {}", endpoint.to_string());
|
||||||
let state = self.state.read().await;
|
let state = self.state.read().await;
|
||||||
|
println!("2 wire_send {}", endpoint.to_string());
|
||||||
if !state.udp_sockets.is_empty() {
|
if !state.udp_sockets.is_empty() {
|
||||||
if let Some(specific_interface) = local_interface {
|
if let Some(specific_interface) = local_interface {
|
||||||
// Send from a specific interface if that interface is specified.
|
// Send from a specific interface if that interface is specified.
|
||||||
|
|
Loading…
Add table
Reference in a new issue