rename rust lib from gurt to gurtlib
This commit is contained in:
4
protocol/cli/Cargo.lock
generated
4
protocol/cli/Cargo.lock
generated
@@ -416,7 +416,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
|
||||
|
||||
[[package]]
|
||||
name = "gurt"
|
||||
name = "gurtlib"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"base64",
|
||||
@@ -440,7 +440,7 @@ dependencies = [
|
||||
"async-trait",
|
||||
"clap",
|
||||
"colored",
|
||||
"gurt",
|
||||
"gurtlib",
|
||||
"indexmap",
|
||||
"mime_guess",
|
||||
"regex",
|
||||
|
||||
@@ -12,7 +12,7 @@ name = "gurty"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
gurt = { path = "../library" }
|
||||
gurtlib = { path = "../library" }
|
||||
|
||||
tokio = { version = "1.0", features = ["full"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
|
||||
@@ -29,8 +29,8 @@ impl From<std::io::Error> for ServerError {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<gurt::GurtError> for ServerError {
|
||||
fn from(err: gurt::GurtError) -> Self {
|
||||
impl From<gurtlib::GurtError> for ServerError {
|
||||
fn from(err: gurtlib::GurtError) -> Self {
|
||||
ServerError::ServerStartup(err.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::{
|
||||
config::GurtConfig,
|
||||
security::SecurityMiddleware,
|
||||
};
|
||||
use gurt::prelude::*;
|
||||
use gurtlib::prelude::*;
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
use tracing;
|
||||
@@ -238,14 +238,14 @@ impl RequestHandler {
|
||||
}
|
||||
|
||||
let result = match method {
|
||||
gurt::message::GurtMethod::GET => {
|
||||
gurtlib::message::GurtMethod::GET => {
|
||||
if ctx.path() == "/" {
|
||||
self.handle_root_request().await
|
||||
} else {
|
||||
self.handle_file_request(ctx.path()).await
|
||||
}
|
||||
}
|
||||
gurt::message::GurtMethod::HEAD => {
|
||||
gurtlib::message::GurtMethod::HEAD => {
|
||||
let mut response = if ctx.path() == "/" {
|
||||
self.handle_root_request().await?
|
||||
} else {
|
||||
@@ -254,7 +254,7 @@ impl RequestHandler {
|
||||
response.body = Vec::new();
|
||||
Ok(response)
|
||||
}
|
||||
gurt::message::GurtMethod::OPTIONS => {
|
||||
gurtlib::message::GurtMethod::OPTIONS => {
|
||||
let allowed_methods = if let Some(config) = &self.config {
|
||||
if let Some(security) = &config.security {
|
||||
security.allowed_methods.join(", ")
|
||||
@@ -272,7 +272,7 @@ impl RequestHandler {
|
||||
Ok(self.apply_global_headers(response))
|
||||
}
|
||||
_ => {
|
||||
let response = GurtResponse::new(gurt::protocol::GurtStatusCode::MethodNotAllowed)
|
||||
let response = GurtResponse::new(gurtlib::protocol::GurtStatusCode::MethodNotAllowed)
|
||||
.with_header("Content-Type", "text/html");
|
||||
Ok(self.apply_global_headers(response))
|
||||
}
|
||||
@@ -430,7 +430,7 @@ impl RequestHandler {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use gurt::GurtStatusCode;
|
||||
use gurtlib::GurtStatusCode;
|
||||
use std::fs;
|
||||
use std::env;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::config::GurtConfig;
|
||||
use gurt::{prelude::*, GurtMethod, GurtStatusCode};
|
||||
use gurtlib::{prelude::*, GurtMethod, GurtStatusCode};
|
||||
use std::collections::HashMap;
|
||||
use std::net::IpAddr;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::{
|
||||
handlers::{FileHandler, DirectoryHandler, DefaultFileHandler, DefaultDirectoryHandler},
|
||||
request_handler::{RequestHandler, RequestHandlerBuilder},
|
||||
};
|
||||
use gurt::prelude::*;
|
||||
use gurtlib::prelude::*;
|
||||
use std::{path::PathBuf, sync::Arc};
|
||||
|
||||
pub struct FileServerBuilder {
|
||||
|
||||
@@ -12,7 +12,7 @@ name = "gurt_godot"
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
gurt = { path = "../library" }
|
||||
gurtlib = { path = "../library" }
|
||||
|
||||
godot = "0.1"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use godot::prelude::*;
|
||||
use gurt::prelude::*;
|
||||
use gurt::{GurtMethod, GurtClientConfig, GurtRequest};
|
||||
use gurtlib::prelude::*;
|
||||
use gurtlib::{GurtMethod, GurtClientConfig, GurtRequest};
|
||||
use tokio::runtime::Runtime;
|
||||
use std::sync::Arc;
|
||||
use std::cell::RefCell;
|
||||
@@ -266,12 +266,12 @@ impl GurtProtocolClient {
|
||||
|
||||
#[func]
|
||||
fn get_version(&self) -> GString {
|
||||
gurt::GURT_VERSION.to_string().into()
|
||||
gurtlib::GURT_VERSION.to_string().into()
|
||||
}
|
||||
|
||||
#[func]
|
||||
fn get_default_port(&self) -> i32 {
|
||||
gurt::DEFAULT_PORT as i32
|
||||
gurtlib::DEFAULT_PORT as i32
|
||||
}
|
||||
|
||||
#[func]
|
||||
|
||||
@@ -10,7 +10,7 @@ path = "src/main.rs"
|
||||
[dependencies]
|
||||
clap = { version = "4.0", features = ["derive"] }
|
||||
tokio = { version = "1.0", features = ["full"] }
|
||||
gurt = { path = "../library" }
|
||||
gurtlib = { path = "../library" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
openssl = "0.10"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use anyhow::Result;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use gurt::prelude::*;
|
||||
use gurtlib::prelude::*;
|
||||
|
||||
pub struct GurtCAClient {
|
||||
ca_url: String,
|
||||
@@ -67,9 +67,9 @@ impl GurtCAClient {
|
||||
println!("✅ Fetched CA certificate via HTTP bootstrap");
|
||||
|
||||
// Create new client with custom CA
|
||||
let mut config = gurt::client::GurtClientConfig::default();
|
||||
let mut config = gurtlib::client::GurtClientConfig::default();
|
||||
config.custom_ca_certificates = vec![ca_cert];
|
||||
let gurt_client = gurt::GurtClient::with_config(config);
|
||||
let gurt_client = gurtlib::GurtClient::with_config(config);
|
||||
let client_with_ca = Self {
|
||||
ca_url,
|
||||
gurt_client,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use gurt::{GurtServer, GurtResponse, ServerContext, Result};
|
||||
use gurtlib::{GurtServer, GurtResponse, ServerContext, Result};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
|
||||
Reference in New Issue
Block a user