modified: src/client.rs
Some checks failed
gitea/Frida-android-native/pipeline/head There was a failure building this commit
Some checks failed
gitea/Frida-android-native/pipeline/head There was a failure building this commit
This commit is contained in:
parent
686e82a3ec
commit
5b5f621cac
@ -1,13 +1,18 @@
|
||||
use crossbeam_channel::unbounded;
|
||||
use socket2::SockAddr;
|
||||
use tokio::{net::UdpSocket, sync::Mutex};
|
||||
use std::{io::{Read, Write}, net::SocketAddr};
|
||||
use base64::prelude::*;
|
||||
use log::{error, info, warn};
|
||||
use std::sync::Arc;
|
||||
use std::net::Ipv4Addr;
|
||||
use x25519_dalek::{PublicKey, StaticSecret};
|
||||
use std::process::Command;
|
||||
use std::{
|
||||
fs::File,
|
||||
io::{self, Read, Write},
|
||||
net::SocketAddr,
|
||||
process::Command,
|
||||
os::unix::io::FromRawFd,
|
||||
};
|
||||
use aes_gcm::{
|
||||
aead::{Aead, AeadCore, KeyInit, OsRng},
|
||||
Aes256Gcm, Nonce};
|
||||
@ -23,11 +28,11 @@ pub async fn client_mode(client_config: ClientConfiguration, fd: i32) -> i32 {
|
||||
let sock = UdpSocket::bind("0.0.0.0:25565").await.unwrap();
|
||||
sock.connect(&client_config.server.endpoint).await.unwrap();
|
||||
|
||||
let mut config = tun2::Configuration::default();
|
||||
//let mut config = tun2::Configuration::default();
|
||||
info!("FD: {:?}", &fd);
|
||||
config.raw_fd(fd).up();
|
||||
//config.raw_fd(fd).up();
|
||||
|
||||
let mut dev = tun2::create_as_async(&config).unwrap();
|
||||
//let mut dev = tun2::create_as_async(&config).unwrap();
|
||||
//let (mut dev_reader, mut dev_writer) = dev.split();
|
||||
|
||||
let sock_rec = Arc::new(sock);
|
||||
@ -135,9 +140,12 @@ pub async fn client_mode(client_config: ClientConfiguration, fd: i32) -> i32 {
|
||||
}
|
||||
}
|
||||
}*/
|
||||
let mut buf = vec![0; 2048];
|
||||
while let Ok(n) = dev.read(&mut buf) {
|
||||
let mut f = unsafe { File::from_raw_fd(&fd) };
|
||||
|
||||
let mut buf = vec![0; 1400];
|
||||
while let Ok(n) = f.read(&mut buf) {
|
||||
info!("Read from tun. {:?} bytes", n);
|
||||
return n.into();
|
||||
}
|
||||
info!("end.");
|
||||
-2
|
||||
|
Loading…
x
Reference in New Issue
Block a user