Compare commits

..

5 Commits

4 changed files with 12 additions and 10 deletions

View File

@ -13,6 +13,7 @@ better RAC client
- RACv1.99.x and RACv2.0 compatible - RACv1.99.x and RACv2.0 compatible
- WRAC compatible ([docs](docs/wrac.md)) - WRAC compatible ([docs](docs/wrac.md))
- chat commands (type /help) - chat commands (type /help)
- uses tor proxy as default (wracs://meex.lol:11234)
- no ip and date visible for anyone (almost) - no ip and date visible for anyone (almost)
- coloring usernames by their clients (CRAB, clRAC, Mefidroniy, etc.) - coloring usernames by their clients (CRAB, clRAC, Mefidroniy, etc.)
- many command-line options (see --help) - many command-line options (see --help)

View File

@ -1,7 +1,6 @@
use clap::Parser; use clap::Parser;
use serde_default::DefaultFromSerde; use serde_default::DefaultFromSerde;
use serde_yml; use serde_yml;
use std::str::FromStr;
use std::{fs, path::PathBuf}; use std::{fs, path::PathBuf};
const MESSAGE_FORMAT: &str = "\u{B9AC}\u{3E70}<{name}> {text}"; const MESSAGE_FORMAT: &str = "\u{B9AC}\u{3E70}<{name}> {text}";
@ -22,7 +21,7 @@ pub fn default_konata_size() -> usize {
100 100
} }
pub fn default_host() -> String { pub fn default_host() -> String {
"wracs://meex.lol".to_string() "wracs://meex.lol:11234".to_string()
} }
pub fn default_message_format() -> String { pub fn default_message_format() -> String {
MESSAGE_FORMAT.to_string() MESSAGE_FORMAT.to_string()

View File

@ -39,13 +39,14 @@ lazy_static! {
pub static ref COLORED_USERNAMES: Vec<(Regex, String)> = vec![ pub static ref COLORED_USERNAMES: Vec<(Regex, String)> = vec![
(Regex::new(r"\u{B9AC}\u{3E70}<(.*?)> (.*)").unwrap(), "#70fa7a".to_string()), // bRAC (Regex::new(r"\u{B9AC}\u{3E70}<(.*?)> (.*)").unwrap(), "#70fa7a".to_string()), // bRAC
(Regex::new(r"\u{2550}\u{2550}\u{2550}<(.*?)> (.*)").unwrap(), "#fa7070".to_string()), // CRAB (Regex::new(r"\u{2550}\u{2550}\u{2550}<(.*?)> (.*)").unwrap(), "#fa7070".to_string()), // CRAB
(Regex::new(r"\u{00B0}\u{0298}<(.*?)> (.*)").unwrap(), "#da70fa".to_string()), // Mefidroniy (Regex::new(r"\u{00B0}\u{0298}<(.*?)> (.*)").unwrap(), "#da70fa".to_string()), // Mefidroniy
(Regex::new(r"\u{2042}<(.*?)> (.*)").unwrap(), "#f5f543".to_string()), // cRACk (Regex::new(r"\u{2042}<(.*?)> (.*)").unwrap(), "#f5f543".to_string()), // cRACk
(Regex::new(r"<(.*?)> (.*)").unwrap(), "#70fadc".to_string()), // clRAC (Regex::new(r"<(.*?)> (.*)").unwrap(), "#70fadc".to_string()), // clRAC
]; ];
pub static ref SERVER_LIST: Vec<String> = vec![ pub static ref SERVER_LIST: Vec<String> = vec![
"wracs://meex.lol:11234".to_string(),
"rac://meex.lol".to_string(), "rac://meex.lol".to_string(),
"wracs://meex.lol".to_string(), "wracs://meex.lol".to_string(),
"rac://91.192.22.20".to_string() "rac://91.192.22.20".to_string()

View File

@ -8,7 +8,7 @@ use std::{
use native_tls::{TlsConnector, TlsStream}; use native_tls::{TlsConnector, TlsStream};
use socks::Socks5Stream; use socks::Socks5Stream;
use tungstenite::WebSocket; use tungstenite::{client::client_with_config, protocol::WebSocketConfig, WebSocket};
pub mod rac; pub mod rac;
pub mod wrac; pub mod wrac;
@ -177,13 +177,14 @@ pub fn connect(host: &str, proxy: Option<String>) -> Result<RacStream, Box<dyn E
stream stream
}; };
stream.set_read_timeout(Duration::from_secs(3)); stream.set_read_timeout(Duration::from_secs(15)); // TODO: softcode this
stream.set_write_timeout(Duration::from_secs(3)); stream.set_write_timeout(Duration::from_secs(15));
if wrac { if wrac {
let (client, _) = tungstenite::client( let (client, _) = client_with_config(
&format!("ws{}://{host}", if ssl { "s" } else { "" }), &format!("ws{}://{host}", if ssl { "s" } else { "" }),
stream, stream,
Some(WebSocketConfig::default().max_message_size(Some(512 * 1024 * 1024))), // TODO: softcode this
)?; )?;
Ok(RacStream::WRAC(client)) Ok(RacStream::WRAC(client))
} else { } else {