Răsfoiți Sursa

bin/ircd: Finalize features refactor.

parazyd 4 ani în urmă
părinte
comite
c70d920a53
5 a modificat fișierele cu 66 adăugiri și 24 ștergeri
  1. 1 3
      bin/ircd/.gitignore
  2. 18 10
      bin/ircd/Cargo.toml
  3. 37 0
      bin/ircd/Makefile
  4. 6 9
      bin/ircd/src/main.rs
  5. 4 2
      bin/ircd/src/privmsg.rs

+ 1 - 3
bin/ircd/.gitignore

@@ -1,3 +1 @@
-
-/target
-Cargo.lock
+target

+ 18 - 10
bin/ircd/Cargo.toml

@@ -1,20 +1,28 @@
 [package]
 name = "ircd"
-version = "0.1.0"
+version = "0.2.0"
 edition = "2021"
 
+[dependencies.darkfi]
+path = "../../"
+features = ["net", "rpc"]
+
 [dependencies]
-darkfi = { path = "../../" }
-clap = "2.34.0"
+# Async
 smol = "1.2.5"
-simplelog = "0.11.1"
+futures = "0.3.19"
 async-std = "1.10.0"
-async-trait = "0.1.51"
-async-executor = "1.4.1"
+async-trait = "0.1.52"
 async-channel = "1.6.1"
-futures = "0.3.17"
-log = "0.4.14"
+async-executor = "1.4.1"
+
+# Crypto
 rand = "0.8.4"
-serde_json = "1.0.72"
-serde = {version = "1.0.130", features = ["derive"]}
 
+# Misc
+clap = "2.34.0"
+log = "0.4.14"
+simplelog = "0.11.2"
+
+# Encoding and parsing
+serde_json = "1.0.74"

+ 37 - 0
bin/ircd/Makefile

@@ -0,0 +1,37 @@
+.POSIX:
+
+# Cargo binary
+CARGO = cargo
+
+# Binary to be built
+BIN = ircd
+
+# Dependencies which should force the binaries to be rebuilt
+BINDEPS = \
+	Cargo.toml \
+	$(shell find src -type f) \
+	$(shell find ../../sql -type f) \
+	$(shell find ../../contrib/token -type f)
+
+all: $(BIN)
+
+$(BIN): $(BINDEPS)
+	$(CARGO) build --release --all-features
+	cp -f target/release/$@ $@
+
+check: $(BINDEPS)
+	$(CARGO) hack check --release --feature-powerset --no-dev-deps
+
+fix:
+	$(CARGO) clippy --release --all-features --fix --allow-dirty
+
+clippy:
+	$(CARGO) clippy --release --all-features
+
+test:
+	$(CARGO) test --release --all-features
+
+clean:
+	rm -f $(BIN)
+
+.PHONY: all check fix clippy test clean

+ 6 - 9
bin/ircd/src/main.rs

@@ -15,17 +15,14 @@ use std::{
 
 use darkfi::{
     net,
-    util::{
-        expand_path,
-        rpc::{
-            jsonrpc::{
-                error as jsonerr, request as jsonreq, response as jsonresp, send_raw_request,
-                ErrorCode::*, JsonRequest, JsonResult,
-            },
-            rpcserver::{listen_and_serve, RequestHandler, RpcServerConfig},
+    rpc::{
+        jsonrpc::{
+            error as jsonerr, request as jsonreq, response as jsonresp, send_raw_request,
+            ErrorCode::*, JsonRequest, JsonResult,
         },
-        sleep,
+        rpcserver::{listen_and_serve, RequestHandler, RpcServerConfig},
     },
+    util::{expand_path, sleep},
     Error, Result,
 };
 

+ 4 - 2
bin/ircd/src/privmsg.rs

@@ -1,10 +1,12 @@
+use std::{collections::HashSet, io, sync::Arc};
+
 use async_std::sync::Mutex;
+
 use darkfi::{
     net,
-    serial::{Decodable, Encodable},
+    util::serial::{Decodable, Encodable},
     Result,
 };
-use std::{collections::HashSet, io, sync::Arc};
 
 pub type PrivMsgId = u32;