irc-tor
lza_menace 2 years ago
parent 29275e61bb
commit 6abdd2be79

395
Cargo.lock generated

@ -68,6 +68,15 @@ dependencies = [
"pkg-config",
]
[[package]]
name = "android_system_properties"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
dependencies = [
"libc",
]
[[package]]
name = "arboard"
version = "2.1.1"
@ -79,7 +88,7 @@ dependencies = [
"objc",
"objc-foundation",
"objc_id",
"parking_lot",
"parking_lot 0.12.1",
"thiserror",
"winapi",
"x11rb",
@ -245,6 +254,21 @@ dependencies = [
"libc",
]
[[package]]
name = "chrono"
version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1"
dependencies = [
"iana-time-zone",
"js-sys",
"num-integer",
"num-traits",
"time",
"wasm-bindgen",
"winapi",
]
[[package]]
name = "clang-sys"
version = "1.4.0"
@ -313,6 +337,16 @@ dependencies = [
"objc",
]
[[package]]
name = "codespan-reporting"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
dependencies = [
"termcolor",
"unicode-width",
]
[[package]]
name = "combine"
version = "4.6.6"
@ -413,7 +447,7 @@ dependencies = [
"nix 0.23.1",
"oboe",
"once_cell",
"parking_lot",
"parking_lot 0.12.1",
"stdweb",
"thiserror",
"web-sys",
@ -458,6 +492,50 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35"
[[package]]
name = "cxx"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f83d0ebf42c6eafb8d7c52f7e5f2d3003b89c7aa4fd2b79229209459a849af8"
dependencies = [
"cc",
"cxxbridge-flags",
"cxxbridge-macro",
"link-cplusplus",
]
[[package]]
name = "cxx-build"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07d050484b55975889284352b0ffc2ecbda25c0c55978017c132b29ba0818a86"
dependencies = [
"cc",
"codespan-reporting",
"once_cell",
"proc-macro2",
"quote",
"scratch",
"syn",
]
[[package]]
name = "cxxbridge-flags"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99d2199b00553eda8012dfec8d3b1c75fce747cf27c169a270b3b99e3448ab78"
[[package]]
name = "cxxbridge-macro"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcb67a6de1f602736dd7eaead0080cf3435df806c61b24b13328db128c58868f"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "darling"
version = "0.13.4"
@ -635,6 +713,70 @@ dependencies = [
"serde",
]
[[package]]
name = "encoding"
version = "0.2.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec"
dependencies = [
"encoding-index-japanese",
"encoding-index-korean",
"encoding-index-simpchinese",
"encoding-index-singlebyte",
"encoding-index-tradchinese",
]
[[package]]
name = "encoding-index-japanese"
version = "1.20141219.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91"
dependencies = [
"encoding_index_tests",
]
[[package]]
name = "encoding-index-korean"
version = "1.20141219.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81"
dependencies = [
"encoding_index_tests",
]
[[package]]
name = "encoding-index-simpchinese"
version = "1.20141219.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7"
dependencies = [
"encoding_index_tests",
]
[[package]]
name = "encoding-index-singlebyte"
version = "1.20141219.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a"
dependencies = [
"encoding_index_tests",
]
[[package]]
name = "encoding-index-tradchinese"
version = "1.20141219.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18"
dependencies = [
"encoding_index_tests",
]
[[package]]
name = "encoding_index_tests"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569"
[[package]]
name = "encoding_rs"
version = "0.8.31"
@ -656,7 +798,7 @@ dependencies = [
"bytemuck",
"emath",
"nohash-hasher",
"parking_lot",
"parking_lot 0.12.1",
"serde",
]
@ -784,6 +926,21 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394"
[[package]]
name = "futures"
version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f21eda599937fba36daeb58a22e8f5cee2d14c4a17b5b7739c7c8e5e3b8230c"
dependencies = [
"futures-channel",
"futures-core",
"futures-executor",
"futures-io",
"futures-sink",
"futures-task",
"futures-util",
]
[[package]]
name = "futures-channel"
version = "0.3.24"
@ -791,6 +948,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050"
dependencies = [
"futures-core",
"futures-sink",
]
[[package]]
@ -799,12 +957,34 @@ version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf"
[[package]]
name = "futures-executor"
version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ff63c23854bee61b6e9cd331d523909f238fc7636290b96826e9cfa5faa00ab"
dependencies = [
"futures-core",
"futures-task",
"futures-util",
]
[[package]]
name = "futures-io"
version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68"
[[package]]
name = "futures-macro"
version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "futures-sink"
version = "0.3.24"
@ -823,8 +1003,11 @@ version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90"
dependencies = [
"futures-channel",
"futures-core",
"futures-io",
"futures-macro",
"futures-sink",
"futures-task",
"memchr",
"pin-project-lite",
@ -851,7 +1034,7 @@ dependencies = [
"cfg-if",
"js-sys",
"libc",
"wasi",
"wasi 0.11.0+wasi-snapshot-preview1",
"wasm-bindgen",
]
@ -902,7 +1085,7 @@ dependencies = [
"objc",
"once_cell",
"osmesa-sys",
"parking_lot",
"parking_lot 0.12.1",
"raw-window-handle 0.5.0",
"wayland-client",
"wayland-egl",
@ -964,7 +1147,7 @@ dependencies = [
"indexmap",
"slab",
"tokio",
"tokio-util",
"tokio-util 0.7.4",
"tracing",
]
@ -1060,6 +1243,30 @@ dependencies = [
"tokio-native-tls",
]
[[package]]
name = "iana-time-zone"
version = "0.1.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5a6ef98976b22b3b7f2f3a806f858cb862044cfa66805aa3ad84cb3d3b785ed"
dependencies = [
"android_system_properties",
"core-foundation-sys",
"iana-time-zone-haiku",
"js-sys",
"wasm-bindgen",
"winapi",
]
[[package]]
name = "iana-time-zone-haiku"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca"
dependencies = [
"cxx",
"cxx-build",
]
[[package]]
name = "ident_case"
version = "1.0.1"
@ -1104,6 +1311,43 @@ version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b"
[[package]]
name = "irc"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c5510c4c4631e53c57d6b05c44ab8447d1db6beef28fb9d12c4d6a46fad9dfcc"
dependencies = [
"chrono",
"encoding",
"futures-util",
"irc-proto",
"log",
"native-tls",
"parking_lot 0.11.2",
"pin-project",
"serde",
"serde_derive",
"thiserror",
"tokio",
"tokio-native-tls",
"tokio-stream",
"tokio-util 0.6.10",
"toml",
]
[[package]]
name = "irc-proto"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55fa0a52d825e59ba8aea5b7503890245aea000f77e68d9b1903f3491fa33643"
dependencies = [
"bytes",
"encoding",
"thiserror",
"tokio",
"tokio-util 0.6.10",
]
[[package]]
name = "itoa"
version = "1.0.4"
@ -1250,6 +1494,15 @@ dependencies = [
"vcpkg",
]
[[package]]
name = "link-cplusplus"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369"
dependencies = [
"cc",
]
[[package]]
name = "lock_api"
version = "0.4.9"
@ -1360,7 +1613,7 @@ checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf"
dependencies = [
"libc",
"log",
"wasi",
"wasi 0.11.0+wasi-snapshot-preview1",
"windows-sys",
]
@ -1443,7 +1696,7 @@ dependencies = [
"ndk-macro",
"ndk-sys 0.4.0",
"once_cell",
"parking_lot",
"parking_lot 0.12.1",
]
[[package]]
@ -1542,6 +1795,16 @@ dependencies = [
"syn",
]
[[package]]
name = "num-integer"
version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
dependencies = [
"autocfg",
"num-traits",
]
[[package]]
name = "num-traits"
version = "0.2.15"
@ -1712,6 +1975,17 @@ dependencies = [
"ttf-parser",
]
[[package]]
name = "parking_lot"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
dependencies = [
"instant",
"lock_api",
"parking_lot_core 0.8.5",
]
[[package]]
name = "parking_lot"
version = "0.12.1"
@ -1719,7 +1993,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
"parking_lot_core",
"parking_lot_core 0.9.3",
]
[[package]]
name = "parking_lot_core"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216"
dependencies = [
"cfg-if",
"instant",
"libc",
"redox_syscall",
"smallvec",
"winapi",
]
[[package]]
@ -1747,6 +2035,26 @@ version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
[[package]]
name = "pin-project"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "pin-project-lite"
version = "0.2.9"
@ -1936,7 +2244,7 @@ dependencies = [
"tokio",
"tokio-native-tls",
"tokio-socks",
"tokio-util",
"tokio-util 0.7.4",
"tower-service",
"url",
"wasm-bindgen",
@ -2021,6 +2329,12 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "scratch"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898"
[[package]]
name = "sctk-adwaita"
version = "0.4.2"
@ -2268,6 +2582,15 @@ dependencies = [
"winapi",
]
[[package]]
name = "termcolor"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
dependencies = [
"winapi-util",
]
[[package]]
name = "thiserror"
version = "1.0.37"
@ -2288,6 +2611,17 @@ dependencies = [
"syn",
]
[[package]]
name = "time"
version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
dependencies = [
"libc",
"wasi 0.10.0+wasi-snapshot-preview1",
"winapi",
]
[[package]]
name = "tiny-skia"
version = "0.7.0"
@ -2367,6 +2701,31 @@ dependencies = [
"tokio",
]
[[package]]
name = "tokio-stream"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce"
dependencies = [
"futures-core",
"pin-project-lite",
"tokio",
]
[[package]]
name = "tokio-util"
version = "0.6.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507"
dependencies = [
"bytes",
"futures-core",
"futures-sink",
"log",
"pin-project-lite",
"tokio",
]
[[package]]
name = "tokio-util"
version = "0.7.4"
@ -2449,6 +2808,12 @@ dependencies = [
"tinyvec",
]
[[package]]
name = "unicode-width"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
[[package]]
name = "url"
version = "2.3.1"
@ -2499,6 +2864,12 @@ dependencies = [
"try-lock",
]
[[package]]
name = "wasi"
version = "0.10.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
@ -2829,7 +3200,7 @@ dependencies = [
"ndk-glue 0.7.0",
"objc",
"once_cell",
"parking_lot",
"parking_lot 0.12.1",
"percent-encoding",
"raw-window-handle 0.4.3",
"raw-window-handle 0.5.0",
@ -2867,6 +3238,8 @@ version = "0.1.0"
dependencies = [
"eframe",
"egui",
"futures",
"irc",
"libtor",
"regex",
"reqwest",

@ -12,4 +12,6 @@ eframe = { version = "0.19.0", features = ["persistence"] }
reqwest = { version = "0.11.12", features = ["blocking", "json", "stream", "socks"] }
egui = "0.19.0"
rodio = "0.16.0"
regex = "1.6.0"
regex = "1.6.0"
irc = "0.15.0"
futures = "0.3.24"

@ -0,0 +1,19 @@
server = "oftcnet6xg6roj6d7id4y4cu6dchysacqj2ldgea73qzdagufflqxrid.onion"
port = 6697
nickname = "wowboombox"
channels = ["#wownero-music", "#wownero"]
proxy_type = "SOCKS5"
proxy_server = "127.0.0.1"
proxy_port = 19050
proxy_username = ""
proxy_password = ""
use_tls = true
encoding = "UTF-8"
umodes = "+RB-x"
user_info = "I'm a test user for the irc crate."
version = "irc:git:Rust"
source = "https://github.com/aatxe/irc"
ping_time = 180
ping_timeout = 20
burst_window_length = 8
max_messages_in_burst = 15

@ -11,7 +11,8 @@ pub struct App {
pub tor_connected: bool,
pub to_data: String,
pub show_irc: bool,
pub irc_message: String
pub irc_message: String,
pub irc_thread: std::thread::JoinHandle<()>
}
impl Default for App {
@ -22,7 +23,8 @@ impl Default for App {
show_irc: false,
to_data: "".to_owned(),
player: Player::default(),
irc_message: "".to_owned()
irc_message: "".to_owned(),
irc_thread: std::thread::spawn(move|| {})
}
}
}
@ -81,13 +83,32 @@ impl eframe::App for App {
}
}
} else {
if self.irc_thread.is_finished() {
let _ = crate::irc::start_irc();
// println!("{:?}", r);
// self.irc_thread = std::thread::spawn(move || {
// let _ = crate::irc::start_irc();
// });
}
ui.heading("IRC");
if self.tor_started {
ui.label("Chat wit da braddahs and sistas");
ui.text_edit_singleline(&mut self.irc_message);
if ui.button("[> Send <]").clicked() {
let _r: std::io::Result<()> = crate::clear_tor_log();
}
egui::ScrollArea::vertical().stick_to_bottom(true).show(ui, |ui| {
// let mut bod = "connecting";
let contents = std::fs::read_to_string(crate::IRC_LOG.to_string());
if contents.is_ok() {
let bod = contents.unwrap();
ui.label(bod);
} else {
ui.label("connecting".to_owned());
}
});
ui.horizontal(|ui| {
ui.text_edit_singleline(&mut self.irc_message);
if ui.button("|> Send <|").clicked() {
let _r: std::io::Result<()> = crate::clear_tor_log();
}
});
} else {
ui.label("You should connect to Tor network first brah");
}
@ -102,12 +123,10 @@ impl eframe::App for App {
if self.player.playing {
if ui.button("⏸").clicked() {
let _ = &self.player.sink.pause();
// let _ = &self.player.sink.stop();
self.player.playing = false;
}
ui.add(egui::Slider::new(&mut self.player.volume, 0.0..=100.0));
self.player.sink.set_volume(self.player.volume / 100.0);
// self.player.sink.stop();
} else {
if ui.button("▶").clicked() {
// If stream thread is done, start again

@ -0,0 +1,39 @@
extern crate irc;
use std::io::Write;
use irc::client::prelude::*;
use futures::prelude::*;
pub async fn start_irc() -> Result<(), ()> {
let config = Config::load("config.toml").unwrap();
let mut client = Client::from_config(config).await.unwrap();
client.identify().unwrap();
let log_file = std::path::Path::new(crate::IRC_LOG);
if ! log_file.is_file() {
let f = std::fs::File::create(log_file);
let _ = f.unwrap().write(b"connecting");
}
let mut file = std::fs::OpenOptions::new()
.write(true)
.append(true)
.open(log_file)
.unwrap();
let mut stream = client.stream().unwrap();
while let Some(message) = stream.next().await.transpose().unwrap() {
if let Command::PRIVMSG(channel, message) = message.command {
if message.contains(&*client.current_nickname()) {
// send_privmsg comes from ClientExt
client.send_privmsg(&channel, "beep boop").unwrap();
}
file.write_all(message.to_string().as_bytes()).unwrap();
}
}
Ok(())
}

@ -12,6 +12,7 @@ use rodio::{Decoder, OutputStream, source::Source, Sink};
mod app;
mod player;
mod irc;
// "http://wowradiod6mhb4ignjqy5ghf5l42yh2yeumgeq3yi7gn7yqy3efhe5ad.onion"
// "http://wowradiof5wx62w4avdk5fwbvcoea2z4ul2q3awffn5vmfaa3vhlgiid.onion"
@ -23,6 +24,8 @@ mod player;
pub const TOR_DATA: &str = &"/tmp/tor-rust";
pub const TOR_LOG: &str = &"/tmp/tor-rust/tor.log";
pub const RADIO_STREAM: &str = &"radio.ogg";
pub const IRC_LOG: &str = &"irc.log";
pub const IRC_CONFIG: &str = &"config.toml";
fn cleanup() {
let r: std::io::Result<()> = std::fs::remove_file(&RADIO_STREAM);