Skip to content

Commit

Permalink
Modify node menu
Browse files Browse the repository at this point in the history
  • Loading branch information
dayeon5470 committed Dec 4, 2023
1 parent db75bdb commit 7108be0
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 423 deletions.
66 changes: 26 additions & 40 deletions src/graphql/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ use ipnet::Ipv4Net;
use review_database::{Indexable, Indexed};
use roxy::Process as RoxyProcess;
use serde::{Deserialize, Serialize};
use std::net::{IpAddr, SocketAddr};
use std::{
collections::HashMap,
net::{IpAddr, SocketAddr},
};

pub type PortNumber = u16;

Expand Down Expand Up @@ -109,50 +112,38 @@ pub(super) struct Node {
customer_id: u32,
description: String,
pub(super) hostname: String,
// nics: Vec<Nic>,
// disk_usage_limit: Option<f32>,
// #[graphql(skip)]
// allow_access_from: Option<Vec<IpAddr>>,

// #[graphql(skip)]
// review_id: Option<u32>,

// ssh_port: PortNumber,
// #[graphql(skip)]
// dns_server_ip: Option<IpAddr>,
// dns_server_port: Option<PortNumber>,
// #[graphql(skip)]
// syslog_server_ip: Option<IpAddr>,
// syslog_server_port: Option<PortNumber>,

review: bool,
// review_nics: Option<Vec<String>>,
review_port: Option<PortNumber>,
review_web_port: Option<PortNumber>,
// #[graphql(skip)]
// ntp_server_ip: Option<IpAddr>,
// ntp_server_port: Option<PortNumber>,

piglet: bool,
#[graphql(skip)]
piglet_giganto_ingestion_ip: Option<IpAddr>,
piglet_giganto_ingestion_port: Option<PortNumber>,
#[graphql(skip)]
piglet_review_ip: Option<IpAddr>,
piglet_review_port: Option<PortNumber>,

save_packets: bool,
http: bool,
office: bool,
exe: bool,
pdf: bool,
html: bool,
txt: bool,
smtp_eml: bool,
ftp: bool,
giganto: bool,
// giganto_ingestion_nics: Option<Vec<String>>,
#[graphql(skip)]
giganto_ingestion_ip: Option<IpAddr>,
giganto_ingestion_port: Option<PortNumber>,
// giganto_publish_nics: Option<Vec<String>>,
#[graphql(skip)]
giganto_publish_ip: Option<IpAddr>,
giganto_publish_port: Option<PortNumber>,
// giganto_graphql_nics: Option<Vec<String>>,
#[graphql(skip)]
giganto_graphql_ip: Option<IpAddr>,
giganto_graphql_port: Option<PortNumber>,
retention_period: Option<String>,
retention_period: Option<u16>,

reconverge: bool,
#[graphql(skip)]
Expand All @@ -169,6 +160,11 @@ pub(super) struct Node {
#[graphql(skip)]
hog_giganto_ip: Option<IpAddr>,
hog_giganto_port: Option<PortNumber>,
protocols: bool,
protocol_list: HashMap<String, bool>,

sources: bool,
source_list: HashMap<String, bool>,

creation_time: DateTime<Utc>,
}
Expand Down Expand Up @@ -207,11 +203,11 @@ impl Node {
// async fn syslog_server_ip(&self) -> Option<String> {
// self.syslog_server_ip.as_ref().map(ToString::to_string)
// }
// async fn piglet_giganto_ingestion_ip(&self) -> Option<String> {
// self.piglet_giganto_ingestion_ip
// .as_ref()
// .map(ToString::to_string)
// }
async fn piglet_giganto_ingestion_ip(&self) -> Option<String> {
self.piglet_giganto_ingestion_ip
.as_ref()
.map(ToString::to_string)
}
async fn piglet_review_ip(&self) -> Option<String> {
self.piglet_review_ip.as_ref().map(ToString::to_string)
}
Expand Down Expand Up @@ -380,26 +376,16 @@ impl Indexable for NodeStatus {
#[derive(Serialize)]
pub struct Setting {
name: String,
// nics: Vec<Nic>,
// accesslist: Option<Vec<IpAddr>>,
// disklimit: f32,
// ingest, publish address of Piglet. web_addr is not used
piglet: Option<ServerAddress>,
// graphql, ingest, publish address of Giganto
giganto: Option<ServerAddress>,
// hog: bool,
// ingest, publish address of Hog. web_addr is not used
hog: Option<ServerAddress>,
// ntp: Option<SocketAddr>,
// piglet: bool,
// ingest, publish address of REconverge. web_addr is not used
reconverge: Option<ServerAddress>,
// reconverge: bool,
// rpc, web address of REview. pub_addr is not used
review: Option<ServerPort>,
// ssh: Option<PortNumber>,
// True for UDP, False for TCP
// syslog: Option<Vec<(bool, SocketAddr)>>,
}

#[derive(Serialize)]
Expand Down
Loading

0 comments on commit 7108be0

Please sign in to comment.