mirror of
https://github.com/uqbar-dao/nectar.git
synced 2025-01-08 18:52:49 +03:00
remove Nectar
and .nec
This commit is contained in:
parent
7adcd47ebb
commit
94bac2de4b
@ -16,5 +16,5 @@
|
|||||||
# S3_ACCESS_KEY=minioadmin
|
# S3_ACCESS_KEY=minioadmin
|
||||||
# S3_SECRET__KEY=minioadmin
|
# S3_SECRET__KEY=minioadmin
|
||||||
# S3_REGION=eu-north-1
|
# S3_REGION=eu-north-1
|
||||||
# S3_BUCKET=nectar
|
# S3_BUCKET=mylittlebucket
|
||||||
# S3_ENDPOINT=http://localhost:9000
|
# S3_ENDPOINT=http://localhost:9000
|
||||||
|
@ -62,12 +62,12 @@ On boot you will be prompted to navigate to `localhost:8080`. Make sure your ETH
|
|||||||
- Example: `/app our@net:sys:nectar`, then `/m diagnostics`
|
- Example: `/app our@net:sys:nectar`, then `/m diagnostics`
|
||||||
- Can also use `/a` for same command: `/a our@net:sys:nectar`
|
- Can also use `/a` for same command: `/a our@net:sys:nectar`
|
||||||
- Example of sending many messages:
|
- Example of sending many messages:
|
||||||
- `/a ben.nec@net:sys:nectar`
|
- `/a ben.os@net:sys:nectar`
|
||||||
- `/m hey there`
|
- `/m hey there`
|
||||||
- `/m how are you?`
|
- `/m how are you?`
|
||||||
- `/a` (to exit app mode)
|
- `/a` (to exit app mode)
|
||||||
- `/hi <name> <string>`: send a text message to another node's command line.
|
- `/hi <name> <string>`: send a text message to another node's command line.
|
||||||
- Example: `/hi ben.nec hello world`
|
- Example: `/hi ben.os hello world`
|
||||||
- `/top <process_id>`: display kernel debugging info about a process. Leave the process ID blank to display info about all processes and get the total number of running processes.
|
- `/top <process_id>`: display kernel debugging info about a process. Leave the process ID blank to display info about all processes and get the total number of running processes.
|
||||||
- Example: `/top net:sys:nectar`
|
- Example: `/top net:sys:nectar`
|
||||||
- Example: `/top`
|
- Example: `/top`
|
||||||
|
@ -19,7 +19,7 @@ use ft_worker_lib::{
|
|||||||
spawn_receive_transfer, spawn_transfer, FTWorkerCommand, FTWorkerResult, FileTransferContext,
|
spawn_receive_transfer, spawn_transfer, FTWorkerCommand, FTWorkerResult, FileTransferContext,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Nectar App Store:
|
/// App Store:
|
||||||
/// acts as both a local package manager and a protocol to share packages across the network.
|
/// acts as both a local package manager and a protocol to share packages across the network.
|
||||||
/// packages are apps; apps are packages. we use an onchain app listing contract to determine
|
/// packages are apps; apps are packages. we use an onchain app listing contract to determine
|
||||||
/// what apps are available to download and what node(s) to download them from.
|
/// what apps are available to download and what node(s) to download them from.
|
||||||
@ -173,8 +173,8 @@ struct ManifestCap {
|
|||||||
params: Value,
|
params: Value,
|
||||||
}
|
}
|
||||||
|
|
||||||
// /m our@main:app_store:ben.nec {"Download": {"package": {"package_name": "sdapi", "publisher_node": "benjammin.nec"}, "install_from": "testnode107.nec"}}
|
// /m our@main:app_store:ben.os {"Download": {"package": {"package_name": "sdapi", "publisher_node": "benjammin.os"}, "install_from": "testnode107.os"}}
|
||||||
// /m our@main:app_store:ben.nec {"Install": {"package_name": "sdapi", "publisher_node": "benjammin.nec"}}
|
// /m our@main:app_store:ben.os {"Install": {"package_name": "sdapi", "publisher_node": "benjammin.os"}}
|
||||||
|
|
||||||
call_init!(init);
|
call_init!(init);
|
||||||
fn init(our: Address) {
|
fn init(our: Address) {
|
||||||
|
@ -94,7 +94,7 @@ fn send_ws_update(our: &Address, game: &Game, open_channels: &HashSet<u32>) -> a
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Boilerplate: generate the wasm bindings for a Nectar app
|
// Boilerplate: generate the wasm bindings for a process
|
||||||
wit_bindgen::generate!({
|
wit_bindgen::generate!({
|
||||||
path: "../../../wit",
|
path: "../../../wit",
|
||||||
world: "process",
|
world: "process",
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -645,7 +645,7 @@ async fn recv_connection(
|
|||||||
noise.read_message(first_message, &mut buf)?;
|
noise.read_message(first_message, &mut buf)?;
|
||||||
|
|
||||||
// -> e, ee, s, es
|
// -> e, ee, s, es
|
||||||
send_nectar_handshake(
|
send_protocol_handshake(
|
||||||
our,
|
our,
|
||||||
keypair,
|
keypair,
|
||||||
&our_static_key,
|
&our_static_key,
|
||||||
@ -658,7 +658,7 @@ async fn recv_connection(
|
|||||||
|
|
||||||
// <- s, se
|
// <- s, se
|
||||||
let their_handshake =
|
let their_handshake =
|
||||||
recv_nectar_handshake(&mut noise, &mut buf, &mut read_stream, &mut write_stream).await?;
|
recv_protocol_handshake(&mut noise, &mut buf, &mut read_stream, &mut write_stream).await?;
|
||||||
|
|
||||||
// now validate this handshake payload against the NDNS PKI
|
// now validate this handshake payload against the NDNS PKI
|
||||||
let their_id = pki
|
let their_id = pki
|
||||||
@ -724,7 +724,7 @@ async fn recv_connection_via_router(
|
|||||||
)?;
|
)?;
|
||||||
|
|
||||||
// -> e, ee, s, es
|
// -> e, ee, s, es
|
||||||
send_nectar_handshake(
|
send_protocol_handshake(
|
||||||
our,
|
our,
|
||||||
keypair,
|
keypair,
|
||||||
&our_static_key,
|
&our_static_key,
|
||||||
@ -737,7 +737,7 @@ async fn recv_connection_via_router(
|
|||||||
|
|
||||||
// <- s, se
|
// <- s, se
|
||||||
let their_handshake =
|
let their_handshake =
|
||||||
recv_nectar_handshake(&mut noise, &mut buf, &mut read_stream, &mut write_stream).await?;
|
recv_protocol_handshake(&mut noise, &mut buf, &mut read_stream, &mut write_stream).await?;
|
||||||
|
|
||||||
// now validate this handshake payload against the NDNS PKI
|
// now validate this handshake payload against the NDNS PKI
|
||||||
let their_id = pki
|
let their_id = pki
|
||||||
@ -816,7 +816,7 @@ async fn init_connection(
|
|||||||
|
|
||||||
// <- e, ee, s, es
|
// <- e, ee, s, es
|
||||||
let their_handshake =
|
let their_handshake =
|
||||||
recv_nectar_handshake(&mut noise, &mut buf, &mut read_stream, &mut write_stream).await?;
|
recv_protocol_handshake(&mut noise, &mut buf, &mut read_stream, &mut write_stream).await?;
|
||||||
|
|
||||||
// now validate this handshake payload against the NDNS PKI
|
// now validate this handshake payload against the NDNS PKI
|
||||||
validate_handshake(
|
validate_handshake(
|
||||||
@ -828,7 +828,7 @@ async fn init_connection(
|
|||||||
)?;
|
)?;
|
||||||
|
|
||||||
// -> s, se
|
// -> s, se
|
||||||
send_nectar_handshake(
|
send_protocol_handshake(
|
||||||
our,
|
our,
|
||||||
keypair,
|
keypair,
|
||||||
&our_static_key,
|
&our_static_key,
|
||||||
|
@ -59,7 +59,7 @@ pub async fn maintain_connection(
|
|||||||
let mut last_message = std::time::Instant::now();
|
let mut last_message = std::time::Instant::now();
|
||||||
loop {
|
loop {
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
recv_result = recv_nectar_message(&mut conn) => {
|
recv_result = recv_protocol_message(&mut conn) => {
|
||||||
match recv_result {
|
match recv_result {
|
||||||
Ok(km) => {
|
Ok(km) => {
|
||||||
if km.source.node != peer_name {
|
if km.source.node != peer_name {
|
||||||
@ -81,7 +81,7 @@ pub async fn maintain_connection(
|
|||||||
maybe_recv = peer_rx.recv() => {
|
maybe_recv = peer_rx.recv() => {
|
||||||
match maybe_recv {
|
match maybe_recv {
|
||||||
Some(km) => {
|
Some(km) => {
|
||||||
match send_nectar_message(&km, &mut conn).await {
|
match send_protocol_message(&km, &mut conn).await {
|
||||||
Ok(()) => {
|
Ok(()) => {
|
||||||
last_message = std::time::Instant::now();
|
last_message = std::time::Instant::now();
|
||||||
continue
|
continue
|
||||||
@ -299,7 +299,7 @@ pub fn validate_handshake(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn send_nectar_message(km: &KernelMessage, conn: &mut PeerConnection) -> Result<()> {
|
pub async fn send_protocol_message(km: &KernelMessage, conn: &mut PeerConnection) -> Result<()> {
|
||||||
let serialized = rmp_serde::to_vec(km)?;
|
let serialized = rmp_serde::to_vec(km)?;
|
||||||
if serialized.len() > MESSAGE_MAX_SIZE as usize {
|
if serialized.len() > MESSAGE_MAX_SIZE as usize {
|
||||||
return Err(anyhow!("message too large"));
|
return Err(anyhow!("message too large"));
|
||||||
@ -320,7 +320,7 @@ pub async fn send_nectar_message(km: &KernelMessage, conn: &mut PeerConnection)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// any error in receiving a message will result in the connection being closed.
|
/// any error in receiving a message will result in the connection being closed.
|
||||||
pub async fn recv_nectar_message(conn: &mut PeerConnection) -> Result<KernelMessage> {
|
pub async fn recv_protocol_message(conn: &mut PeerConnection) -> Result<KernelMessage> {
|
||||||
let outer_len = conn.noise.read_message(
|
let outer_len = conn.noise.read_message(
|
||||||
&ws_recv(&mut conn.read_stream, &mut conn.write_stream).await?,
|
&ws_recv(&mut conn.read_stream, &mut conn.write_stream).await?,
|
||||||
&mut conn.buf,
|
&mut conn.buf,
|
||||||
@ -349,7 +349,7 @@ pub async fn recv_nectar_message(conn: &mut PeerConnection) -> Result<KernelMess
|
|||||||
Ok(rmp_serde::from_slice(&msg)?)
|
Ok(rmp_serde::from_slice(&msg)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn send_nectar_handshake(
|
pub async fn send_protocol_handshake(
|
||||||
our: &Identity,
|
our: &Identity,
|
||||||
keypair: &Ed25519KeyPair,
|
keypair: &Ed25519KeyPair,
|
||||||
noise_static_key: &[u8],
|
noise_static_key: &[u8],
|
||||||
@ -373,7 +373,7 @@ pub async fn send_nectar_handshake(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn recv_nectar_handshake(
|
pub async fn recv_protocol_handshake(
|
||||||
noise: &mut snow::HandshakeState,
|
noise: &mut snow::HandshakeState,
|
||||||
buf: &mut [u8],
|
buf: &mut [u8],
|
||||||
read_stream: &mut SplitStream<WebSocketStream<MaybeTlsStream<TcpStream>>>,
|
read_stream: &mut SplitStream<WebSocketStream<MaybeTlsStream<TcpStream>>>,
|
||||||
|
@ -118,10 +118,10 @@ pub async fn register(
|
|||||||
name: "".to_string(),
|
name: "".to_string(),
|
||||||
ws_routing: Some((ip.clone(), ws_port)),
|
ws_routing: Some((ip.clone(), ws_port)),
|
||||||
allowed_routers: vec![
|
allowed_routers: vec![
|
||||||
"nectar-next-router.nec".into(),
|
"next-release-router.os".into(),
|
||||||
// "nectar-router-1.nec".into(),
|
// "default-router-1.os".into(),
|
||||||
// "nectar-router-2.nec".into(),
|
// "default-router-2.os".into(),
|
||||||
// "nectar-router-3.nec".into(),
|
// "default-router-3.os".into(),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ pub async fn terminal(
|
|||||||
execute!(
|
execute!(
|
||||||
stdout,
|
stdout,
|
||||||
EnableBracketedPaste,
|
EnableBracketedPaste,
|
||||||
terminal::SetTitle(format!("{}@{}", our.name, "nectar"))
|
terminal::SetTitle(format!("{}", our.name))
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let (mut win_cols, mut win_rows) = terminal::size().unwrap();
|
let (mut win_cols, mut win_rows) = terminal::size().unwrap();
|
||||||
@ -126,18 +126,21 @@ pub async fn terminal(
|
|||||||
|
|
||||||
// use to trigger cleanup if receive signal to kill process
|
// use to trigger cleanup if receive signal to kill process
|
||||||
let mut sigalrm =
|
let mut sigalrm =
|
||||||
signal(SignalKind::alarm()).expect("nectar: failed to set up SIGALRM handler");
|
signal(SignalKind::alarm()).expect("terminal: failed to set up SIGALRM handler");
|
||||||
let mut sighup = signal(SignalKind::hangup()).expect("nectar: failed to set up SIGHUP handler");
|
let mut sighup =
|
||||||
|
signal(SignalKind::hangup()).expect("terminal: failed to set up SIGHUP handler");
|
||||||
let mut sigint =
|
let mut sigint =
|
||||||
signal(SignalKind::interrupt()).expect("nectar: failed to set up SIGINT handler");
|
signal(SignalKind::interrupt()).expect("terminal: failed to set up SIGINT handler");
|
||||||
let mut sigpipe = signal(SignalKind::pipe()).expect("nectar: failed to set up SIGPIPE handler");
|
let mut sigpipe =
|
||||||
let mut sigquit = signal(SignalKind::quit()).expect("nectar: failed to set up SIGQUIT handler");
|
signal(SignalKind::pipe()).expect("terminal: failed to set up SIGPIPE handler");
|
||||||
|
let mut sigquit =
|
||||||
|
signal(SignalKind::quit()).expect("terminal: failed to set up SIGQUIT handler");
|
||||||
let mut sigterm =
|
let mut sigterm =
|
||||||
signal(SignalKind::terminate()).expect("nectar: failed to set up SIGTERM handler");
|
signal(SignalKind::terminate()).expect("terminal: failed to set up SIGTERM handler");
|
||||||
let mut sigusr1 =
|
let mut sigusr1 =
|
||||||
signal(SignalKind::user_defined1()).expect("nectar: failed to set up SIGUSR1 handler");
|
signal(SignalKind::user_defined1()).expect("terminal: failed to set up SIGUSR1 handler");
|
||||||
let mut sigusr2 =
|
let mut sigusr2 =
|
||||||
signal(SignalKind::user_defined2()).expect("nectar: failed to set up SIGUSR2 handler");
|
signal(SignalKind::user_defined2()).expect("terminal: failed to set up SIGUSR2 handler");
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let event = reader.next().fuse();
|
let event = reader.next().fuse();
|
||||||
|
@ -720,7 +720,7 @@ pub type CapMessageSender = tokio::sync::mpsc::Sender<CapMessage>;
|
|||||||
pub type CapMessageReceiver = tokio::sync::mpsc::Receiver<CapMessage>;
|
pub type CapMessageReceiver = tokio::sync::mpsc::Receiver<CapMessage>;
|
||||||
|
|
||||||
//
|
//
|
||||||
// types used for Nectar's identity system
|
// types used for onchain identity system
|
||||||
//
|
//
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
|
Loading…
Reference in New Issue
Block a user