diff --git a/.env b/.env deleted file mode 100644 index c60e236..0000000 --- a/.env +++ /dev/null @@ -1 +0,0 @@ -DATABASE_URL=postgres://ap_actix:ap_actix@localhost:5432/ap_actix diff --git a/src/args.rs b/src/args.rs index 4a90602..3f032f1 100644 --- a/src/args.rs +++ b/src/args.rs @@ -2,7 +2,7 @@ use structopt::StructOpt; #[derive(Debug, StructOpt)] #[structopt(name = "relay", about = "An activitypub relay")] -pub struct Args { +pub(crate) struct Args { #[structopt(short, help = "A list of domains that should be blocked")] blocks: Vec, @@ -14,19 +14,19 @@ pub struct Args { } impl Args { - pub fn new() -> Self { + pub(crate) fn new() -> Self { Self::from_args() } - pub fn blocks(&self) -> &[String] { + pub(crate) fn blocks(&self) -> &[String] { &self.blocks } - pub fn allowed(&self) -> &[String] { + pub(crate) fn allowed(&self) -> &[String] { &self.allowed } - pub fn undo(&self) -> bool { + pub(crate) fn undo(&self) -> bool { self.undo } } diff --git a/src/config.rs b/src/config.rs index 877dd1c..4a3e602 100644 --- a/src/config.rs +++ b/src/config.rs @@ -12,7 +12,7 @@ use std::{net::IpAddr, path::PathBuf}; use uuid::Uuid; #[derive(Clone, Debug, serde::Deserialize)] -pub struct ParsedConfig { +pub(crate) struct ParsedConfig { hostname: String, addr: IpAddr, port: u16, @@ -20,10 +20,8 @@ pub struct ParsedConfig { restricted_mode: bool, validate_signatures: bool, https: bool, - database_url: String, pretty_log: bool, publish_blocks: bool, - max_connections: usize, sled_path: PathBuf, } @@ -35,10 +33,8 @@ pub struct Config { debug: bool, restricted_mode: bool, validate_signatures: bool, - database_url: String, pretty_log: bool, publish_blocks: bool, - max_connections: usize, base_uri: Url, sled_path: PathBuf, } @@ -57,7 +53,7 @@ pub enum UrlKind { } impl Config { - pub fn build() -> Result { + pub(crate) fn build() -> Result { let mut config = config::Config::new(); config .set_default("hostname", "localhost:8080")? @@ -69,7 +65,6 @@ impl Config { .set_default("https", false)? .set_default("pretty_log", true)? .set_default("publish_blocks", false)? - .set_default("max_connections", 2)? .set_default("sled_path", "./sled/db-0-34")? .merge(Environment::new())?; @@ -85,32 +80,26 @@ impl Config { debug: config.debug, restricted_mode: config.restricted_mode, validate_signatures: config.validate_signatures, - database_url: config.database_url, pretty_log: config.pretty_log, publish_blocks: config.publish_blocks, - max_connections: config.max_connections, base_uri, sled_path: config.sled_path, }) } - pub fn sled_path(&self) -> &PathBuf { + pub(crate) fn sled_path(&self) -> &PathBuf { &self.sled_path } - pub fn pretty_log(&self) -> bool { + pub(crate) fn pretty_log(&self) -> bool { self.pretty_log } - pub fn max_connections(&self) -> usize { - self.max_connections - } - - pub fn validate_signatures(&self) -> bool { + pub(crate) fn validate_signatures(&self) -> bool { self.validate_signatures } - pub fn digest_middleware(&self) -> VerifyDigest { + pub(crate) fn digest_middleware(&self) -> VerifyDigest { if self.validate_signatures { VerifyDigest::new(Sha256::new()) } else { @@ -118,7 +107,7 @@ impl Config { } } - pub fn signature_middleware( + pub(crate) fn signature_middleware( &self, requests: Requests, actors: ActorCache, @@ -131,47 +120,43 @@ impl Config { } } - pub fn bind_address(&self) -> (IpAddr, u16) { + pub(crate) fn bind_address(&self) -> (IpAddr, u16) { (self.addr, self.port) } - pub fn debug(&self) -> bool { + pub(crate) fn debug(&self) -> bool { self.debug } - pub fn publish_blocks(&self) -> bool { + pub(crate) fn publish_blocks(&self) -> bool { self.publish_blocks } - pub fn restricted_mode(&self) -> bool { + pub(crate) fn restricted_mode(&self) -> bool { self.restricted_mode } - pub fn database_url(&self) -> &str { - &self.database_url - } - - pub fn hostname(&self) -> &str { + pub(crate) fn hostname(&self) -> &str { &self.hostname } - pub fn generate_resource(&self) -> String { + pub(crate) fn generate_resource(&self) -> String { format!("relay@{}", self.hostname) } - pub fn software_name(&self) -> String { + pub(crate) fn software_name(&self) -> String { "AodeRelay".to_owned() } - pub fn software_version(&self) -> String { + pub(crate) fn software_version(&self) -> String { "v0.2.0-main".to_owned() } - pub fn source_code(&self) -> String { + pub(crate) fn source_code(&self) -> String { "https://git.asonix.dog/asonix/ap-relay".to_owned() } - pub fn generate_url(&self, kind: UrlKind) -> Url { + pub(crate) fn generate_url(&self, kind: UrlKind) -> Url { let mut url = self.base_uri.clone(); match kind { diff --git a/src/data/media.rs b/src/data/media.rs index 3907b56..66377e2 100644 --- a/src/data/media.rs +++ b/src/data/media.rs @@ -15,19 +15,19 @@ pub struct MediaCache { } impl MediaCache { - pub fn new(db: Db) -> Self { + pub(crate) fn new(db: Db) -> Self { MediaCache { db } } - pub async fn get_uuid(&self, url: Url) -> Result, MyError> { + pub(crate) async fn get_uuid(&self, url: Url) -> Result, MyError> { self.db.media_id(url).await } - pub async fn get_url(&self, uuid: Uuid) -> Result, MyError> { + pub(crate) async fn get_url(&self, uuid: Uuid) -> Result, MyError> { self.db.media_url(uuid).await } - pub async fn is_outdated(&self, uuid: Uuid) -> Result { + pub(crate) async fn is_outdated(&self, uuid: Uuid) -> Result { if let Some(meta) = self.db.media_meta(uuid).await? { if meta.saved_at + MEDIA_DURATION > SystemTime::now() { return Ok(false); @@ -37,7 +37,7 @@ impl MediaCache { Ok(true) } - pub async fn get_bytes(&self, uuid: Uuid) -> Result, MyError> { + pub(crate) async fn get_bytes(&self, uuid: Uuid) -> Result, MyError> { if let Some(meta) = self.db.media_meta(uuid).await? { if meta.saved_at + MEDIA_DURATION > SystemTime::now() { return self @@ -51,7 +51,7 @@ impl MediaCache { Ok(None) } - pub async fn store_url(&self, url: Url) -> Result { + pub(crate) async fn store_url(&self, url: Url) -> Result { let uuid = Uuid::new_v4(); self.db.save_url(url, uuid).await?; @@ -59,7 +59,7 @@ impl MediaCache { Ok(uuid) } - pub async fn store_bytes( + pub(crate) async fn store_bytes( &self, uuid: Uuid, media_type: String, diff --git a/src/db.rs b/src/db.rs index 71d4851..569179f 100644 --- a/src/db.rs +++ b/src/db.rs @@ -8,7 +8,7 @@ use std::{collections::HashMap, sync::Arc, time::SystemTime}; use uuid::Uuid; #[derive(Clone)] -pub struct Db { +pub(crate) struct Db { inner: Arc, } @@ -39,7 +39,7 @@ pub struct Actor { } #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct MediaMeta { +pub(crate) struct MediaMeta { pub(crate) media_type: String, pub(crate) saved_at: SystemTime, } diff --git a/src/error.rs b/src/error.rs index 9670b87..b5d0e5a 100644 --- a/src/error.rs +++ b/src/error.rs @@ -10,7 +10,7 @@ use rsa_pem::KeyError; use std::{convert::Infallible, fmt::Debug, io::Error}; #[derive(Debug, thiserror::Error)] -pub enum MyError { +pub(crate) enum MyError { #[error("Error queueing job, {0}")] Queue(anyhow::Error), @@ -89,9 +89,6 @@ pub enum MyError { #[error("Response from {0} has invalid status code, {1}")] Status(String, StatusCode), - #[error("Uri {0} is missing host")] - Host(String), - #[error("Expected an Object, found something else")] ObjectFormat, diff --git a/src/jobs/apub/announce.rs b/src/jobs/apub/announce.rs index 8c4e9f9..3005ea4 100644 --- a/src/jobs/apub/announce.rs +++ b/src/jobs/apub/announce.rs @@ -12,7 +12,7 @@ use background_jobs::ActixJob; use std::{future::Future, pin::Pin}; #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct Announce { +pub(crate) struct Announce { object_id: Url, actor: Actor, } diff --git a/src/jobs/apub/follow.rs b/src/jobs/apub/follow.rs index 352d0c9..8c31e47 100644 --- a/src/jobs/apub/follow.rs +++ b/src/jobs/apub/follow.rs @@ -14,7 +14,7 @@ use background_jobs::ActixJob; use std::{future::Future, pin::Pin}; #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct Follow { +pub(crate) struct Follow { is_listener: bool, input: AcceptedActivities, actor: Actor, diff --git a/src/jobs/apub/forward.rs b/src/jobs/apub/forward.rs index 36faea1..8014673 100644 --- a/src/jobs/apub/forward.rs +++ b/src/jobs/apub/forward.rs @@ -9,7 +9,7 @@ use background_jobs::ActixJob; use std::{future::Future, pin::Pin}; #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct Forward { +pub(crate) struct Forward { input: AcceptedActivities, actor: Actor, } diff --git a/src/jobs/apub/mod.rs b/src/jobs/apub/mod.rs index 9cd40c9..9c6825b 100644 --- a/src/jobs/apub/mod.rs +++ b/src/jobs/apub/mod.rs @@ -19,7 +19,9 @@ mod forward; mod reject; mod undo; -pub use self::{announce::Announce, follow::Follow, forward::Forward, reject::Reject, undo::Undo}; +pub(crate) use self::{ + announce::Announce, follow::Follow, forward::Forward, reject::Reject, undo::Undo, +}; async fn get_inboxes(state: &State, actor: &Actor, object_id: &Url) -> Result, MyError> { let domain = object_id.host().ok_or(MyError::Domain)?.to_string(); diff --git a/src/jobs/apub/reject.rs b/src/jobs/apub/reject.rs index 2d25d6e..3e9e1fa 100644 --- a/src/jobs/apub/reject.rs +++ b/src/jobs/apub/reject.rs @@ -7,7 +7,7 @@ use background_jobs::ActixJob; use std::{future::Future, pin::Pin}; #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct Reject(pub Actor); +pub(crate) struct Reject(pub(crate) Actor); impl Reject { async fn perform(self, state: JobState) -> Result<(), anyhow::Error> { diff --git a/src/jobs/apub/undo.rs b/src/jobs/apub/undo.rs index 4262871..cd62f61 100644 --- a/src/jobs/apub/undo.rs +++ b/src/jobs/apub/undo.rs @@ -8,13 +8,13 @@ use background_jobs::ActixJob; use std::{future::Future, pin::Pin}; #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct Undo { +pub(crate) struct Undo { input: AcceptedActivities, actor: Actor, } impl Undo { - pub fn new(input: AcceptedActivities, actor: Actor) -> Self { + pub(crate) fn new(input: AcceptedActivities, actor: Actor) -> Self { Undo { input, actor } } diff --git a/src/jobs/cache_media.rs b/src/jobs/cache_media.rs index c1e5482..f12ab89 100644 --- a/src/jobs/cache_media.rs +++ b/src/jobs/cache_media.rs @@ -5,12 +5,12 @@ use std::{future::Future, pin::Pin}; use uuid::Uuid; #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct CacheMedia { +pub(crate) struct CacheMedia { uuid: Uuid, } impl CacheMedia { - pub fn new(uuid: Uuid) -> Self { + pub(crate) fn new(uuid: Uuid) -> Self { CacheMedia { uuid } } diff --git a/src/jobs/deliver.rs b/src/jobs/deliver.rs index bdb83ce..5db691f 100644 --- a/src/jobs/deliver.rs +++ b/src/jobs/deliver.rs @@ -5,13 +5,13 @@ use background_jobs::{ActixJob, Backoff}; use std::{future::Future, pin::Pin}; #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct Deliver { +pub(crate) struct Deliver { to: Url, data: serde_json::Value, } impl Deliver { - pub fn new(to: Url, data: T) -> Result + pub(crate) fn new(to: Url, data: T) -> Result where T: serde::ser::Serialize, { diff --git a/src/jobs/deliver_many.rs b/src/jobs/deliver_many.rs index d6b411b..39cbb30 100644 --- a/src/jobs/deliver_many.rs +++ b/src/jobs/deliver_many.rs @@ -8,13 +8,13 @@ use background_jobs::ActixJob; use futures::future::{ready, Ready}; #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct DeliverMany { +pub(crate) struct DeliverMany { to: Vec, data: serde_json::Value, } impl DeliverMany { - pub fn new(to: Vec, data: T) -> Result + pub(crate) fn new(to: Vec, data: T) -> Result where T: serde::ser::Serialize, { diff --git a/src/jobs/instance.rs b/src/jobs/instance.rs index 044f2bf..12dc585 100644 --- a/src/jobs/instance.rs +++ b/src/jobs/instance.rs @@ -8,12 +8,12 @@ use background_jobs::ActixJob; use std::{future::Future, pin::Pin}; #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct QueryInstance { +pub(crate) struct QueryInstance { actor_id: Url, } impl QueryInstance { - pub fn new(actor_id: Url) -> Self { + pub(crate) fn new(actor_id: Url) -> Self { QueryInstance { actor_id: actor_id.into(), } diff --git a/src/jobs/mod.rs b/src/jobs/mod.rs index 1761b51..425f739 100644 --- a/src/jobs/mod.rs +++ b/src/jobs/mod.rs @@ -6,7 +6,7 @@ mod instance; mod nodeinfo; mod process_listeners; -pub use self::{ +pub(crate) use self::{ cache_media::CacheMedia, deliver::Deliver, deliver_many::DeliverMany, instance::QueryInstance, nodeinfo::QueryNodeinfo, }; @@ -22,7 +22,7 @@ use crate::{ use background_jobs::{memory_storage::Storage, Job, QueueHandle, WorkerConfig}; use std::time::Duration; -pub fn create_server() -> JobServer { +pub(crate) fn create_server() -> JobServer { let shared = background_jobs::create_server(Storage::new()); shared.every(Duration::from_secs(60 * 5), Listeners); @@ -30,7 +30,7 @@ pub fn create_server() -> JobServer { JobServer::new(shared) } -pub fn create_workers( +pub(crate) fn create_workers( db: Db, state: State, actors: ActorCache, @@ -66,7 +66,7 @@ pub fn create_workers( } #[derive(Clone)] -pub struct JobState { +pub(crate) struct JobState { db: Db, requests: Requests, state: State, @@ -78,7 +78,7 @@ pub struct JobState { } #[derive(Clone)] -pub struct JobServer { +pub(crate) struct JobServer { remote: QueueHandle, } @@ -111,7 +111,7 @@ impl JobServer { } } - pub fn queue(&self, job: J) -> Result<(), MyError> + pub(crate) fn queue(&self, job: J) -> Result<(), MyError> where J: Job, { diff --git a/src/jobs/nodeinfo.rs b/src/jobs/nodeinfo.rs index 2d0b952..3bf6846 100644 --- a/src/jobs/nodeinfo.rs +++ b/src/jobs/nodeinfo.rs @@ -5,12 +5,12 @@ use background_jobs::ActixJob; use std::{future::Future, pin::Pin}; #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct QueryNodeinfo { +pub(crate) struct QueryNodeinfo { actor_id: Url, } impl QueryNodeinfo { - pub fn new(actor_id: Url) -> Self { + pub(crate) fn new(actor_id: Url) -> Self { QueryNodeinfo { actor_id } } diff --git a/src/jobs/process_listeners.rs b/src/jobs/process_listeners.rs index 75ef255..2827578 100644 --- a/src/jobs/process_listeners.rs +++ b/src/jobs/process_listeners.rs @@ -4,7 +4,7 @@ use background_jobs::ActixJob; use std::{future::Future, pin::Pin}; #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct Listeners; +pub(crate) struct Listeners; impl Listeners { async fn perform(self, state: JobState) -> Result<(), Error> { diff --git a/src/middleware/mod.rs b/src/middleware/mod.rs index f910828..e11344d 100644 --- a/src/middleware/mod.rs +++ b/src/middleware/mod.rs @@ -2,6 +2,6 @@ mod payload; mod verifier; mod webfinger; -pub use payload::DebugPayload; -pub use verifier::MyVerify; -pub use webfinger::RelayResolver; +pub(crate) use payload::DebugPayload; +pub(crate) use verifier::MyVerify; +pub(crate) use webfinger::RelayResolver; diff --git a/src/middleware/payload.rs b/src/middleware/payload.rs index fdff1ea..700d409 100644 --- a/src/middleware/payload.rs +++ b/src/middleware/payload.rs @@ -14,15 +14,15 @@ use log::{error, info}; use std::task::{Context, Poll}; #[derive(Clone, Debug)] -pub struct DebugPayload(pub bool); +pub(crate) struct DebugPayload(pub bool); #[doc(hidden)] #[derive(Clone, Debug)] -pub struct DebugPayloadMiddleware(bool, S); +pub(crate) struct DebugPayloadMiddleware(bool, S); #[derive(Clone, Debug, thiserror::Error)] #[error("Failed to read payload")] -pub struct DebugError; +pub(crate) struct DebugError; impl ResponseError for DebugError { fn status_code(&self) -> StatusCode { diff --git a/src/middleware/verifier.rs b/src/middleware/verifier.rs index e6012ba..8f838d7 100644 --- a/src/middleware/verifier.rs +++ b/src/middleware/verifier.rs @@ -14,7 +14,7 @@ use sha2::{Digest, Sha256}; use std::{future::Future, pin::Pin}; #[derive(Clone)] -pub struct MyVerify(pub Requests, pub ActorCache, pub State); +pub(crate) struct MyVerify(pub Requests, pub ActorCache, pub State); impl MyVerify { async fn verify( diff --git a/src/middleware/webfinger.rs b/src/middleware/webfinger.rs index f458170..b947a12 100644 --- a/src/middleware/webfinger.rs +++ b/src/middleware/webfinger.rs @@ -7,11 +7,11 @@ use actix_webfinger::{Resolver, Webfinger}; use rsa_magic_public_key::AsMagicPublicKey; use std::{future::Future, pin::Pin}; -pub struct RelayResolver; +pub(crate) struct RelayResolver; #[derive(Clone, Debug, thiserror::Error)] #[error("Error resolving webfinger data")] -pub struct RelayError; +pub(crate) struct RelayError; type FutResult = dyn Future>; diff --git a/src/requests.rs b/src/requests.rs index ef09275..c138c5c 100644 --- a/src/requests.rs +++ b/src/requests.rs @@ -20,15 +20,11 @@ use std::{ }; #[derive(Clone)] -pub struct Breakers { +pub(crate) struct Breakers { inner: Arc>>>>, } impl Breakers { - pub fn new() -> Self { - Self::default() - } - async fn should_try(&self, url: &Url) -> bool { if let Some(domain) = url.domain() { if let Some(breaker) = self.inner.read().await.get(domain) { @@ -127,7 +123,7 @@ impl Default for Breaker { } #[derive(Clone)] -pub struct Requests { +pub(crate) struct Requests { client: Rc>, consecutive_errors: Rc, error_limit: usize, @@ -139,7 +135,7 @@ pub struct Requests { } impl Requests { - pub fn new( + pub(crate) fn new( key_id: String, private_key: RSAPrivateKey, user_agent: String, @@ -176,14 +172,14 @@ impl Requests { self.consecutive_errors.swap(0, Ordering::Relaxed); } - pub async fn fetch_json(&self, url: &str) -> Result + pub(crate) async fn fetch_json(&self, url: &str) -> Result where T: serde::de::DeserializeOwned, { self.do_fetch(url, "application/json").await } - pub async fn fetch(&self, url: &str) -> Result + pub(crate) async fn fetch(&self, url: &str) -> Result where T: serde::de::DeserializeOwned, { @@ -249,7 +245,7 @@ impl Requests { Ok(serde_json::from_slice(body.as_ref())?) } - pub async fn fetch_bytes(&self, url: &str) -> Result<(String, Bytes), MyError> { + pub(crate) async fn fetch_bytes(&self, url: &str) -> Result<(String, Bytes), MyError> { let parsed_url = url.parse::()?; if !self.breakers.should_try(&parsed_url).await { @@ -318,7 +314,7 @@ impl Requests { Ok((content_type, bytes)) } - pub async fn deliver(&self, inbox: Url, item: &T) -> Result<(), MyError> + pub(crate) async fn deliver(&self, inbox: Url, item: &T) -> Result<(), MyError> where T: serde::ser::Serialize, { diff --git a/src/routes/actor.rs b/src/routes/actor.rs index ff6b1d8..09b7928 100644 --- a/src/routes/actor.rs +++ b/src/routes/actor.rs @@ -5,17 +5,17 @@ use crate::{ error::MyError, routes::ok, }; -use activitystreams_ext::Ext1; use activitystreams::{ actor::{ApActor, Application, Endpoints}, context, prelude::*, security, }; +use activitystreams_ext::Ext1; use actix_web::{web, Responder}; use rsa_pem::KeyExt; -pub async fn route( +pub(crate) async fn route( state: web::Data, config: web::Data, ) -> Result { diff --git a/src/routes/inbox.rs b/src/routes/inbox.rs index 7dcf53e..87a3b5c 100644 --- a/src/routes/inbox.rs +++ b/src/routes/inbox.rs @@ -16,7 +16,7 @@ use actix_web::{web, HttpResponse}; use http_signature_normalization_actix::prelude::{DigestVerified, SignatureVerified}; use log::error; -pub async fn route( +pub(crate) async fn route( state: web::Data, actors: web::Data, config: web::Data, diff --git a/src/routes/index.rs b/src/routes/index.rs index 430ef7d..6f597d8 100644 --- a/src/routes/index.rs +++ b/src/routes/index.rs @@ -4,7 +4,7 @@ use log::error; use rand::{seq::SliceRandom, thread_rng}; use std::io::BufWriter; -pub async fn route( +pub(crate) async fn route( state: web::Data, config: web::Data, ) -> Result { diff --git a/src/routes/media.rs b/src/routes/media.rs index 920ab63..291cd74 100644 --- a/src/routes/media.rs +++ b/src/routes/media.rs @@ -5,7 +5,7 @@ use actix_web::{ }; use uuid::Uuid; -pub async fn route( +pub(crate) async fn route( media: web::Data, requests: web::Data, uuid: web::Path, diff --git a/src/routes/mod.rs b/src/routes/mod.rs index 67e5aa1..e978774 100644 --- a/src/routes/mod.rs +++ b/src/routes/mod.rs @@ -5,7 +5,7 @@ mod media; mod nodeinfo; mod statics; -pub use self::{ +pub(crate) use self::{ actor::route as actor, inbox::route as inbox, index::route as index, diff --git a/src/routes/nodeinfo.rs b/src/routes/nodeinfo.rs index 8ba875e..f3a6ff4 100644 --- a/src/routes/nodeinfo.rs +++ b/src/routes/nodeinfo.rs @@ -5,7 +5,7 @@ use crate::{ use actix_web::{web, Responder}; use actix_webfinger::Link; -pub async fn well_known(config: web::Data) -> impl Responder { +pub(crate) async fn well_known(config: web::Data) -> impl Responder { web::Json(Links { links: vec![Link { rel: "http://nodeinfo.diaspora.software/ns/schema/2.0".to_owned(), @@ -22,7 +22,10 @@ struct Links { links: Vec, } -pub async fn route(config: web::Data, state: web::Data) -> web::Json { +pub(crate) async fn route( + config: web::Data, + state: web::Data, +) -> web::Json { web::Json(NodeInfo { version: NodeInfoVersion, software: Software { diff --git a/src/routes/statics.rs b/src/routes/statics.rs index f68f579..6a74b48 100644 --- a/src/routes/statics.rs +++ b/src/routes/statics.rs @@ -4,7 +4,7 @@ use actix_web::{ web, HttpResponse, }; -pub async fn route(filename: web::Path) -> HttpResponse { +pub(crate) async fn route(filename: web::Path) -> HttpResponse { if let Some(data) = StaticFile::get(&filename.into_inner()) { HttpResponse::Ok() .set(CacheControl(vec![