mirror of
				https://github.com/TeamPiped/piped-proxy.git
				synced 2024-08-14 23:50:45 +00:00 
			
		
		
		
	add random user-agent
This commit is contained in:
		
							parent
							
								
									eea81836b7
								
							
						
					
					
						commit
						7c5680ca4b
					
				
					 3 changed files with 68 additions and 1 deletions
				
			
		
							
								
								
									
										65
									
								
								Cargo.lock
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										65
									
								
								Cargo.lock
									
										
									
										generated
									
									
									
								
							| 
						 | 
					@ -499,6 +499,15 @@ dependencies = [
 | 
				
			||||||
 "threadpool",
 | 
					 "threadpool",
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[package]]
 | 
				
			||||||
 | 
					name = "fastrand"
 | 
				
			||||||
 | 
					version = "1.9.0"
 | 
				
			||||||
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
 | 
					checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
 | 
				
			||||||
 | 
					dependencies = [
 | 
				
			||||||
 | 
					 "instant",
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "flate2"
 | 
					name = "flate2"
 | 
				
			||||||
version = "1.0.24"
 | 
					version = "1.0.24"
 | 
				
			||||||
| 
						 | 
					@ -784,6 +793,15 @@ dependencies = [
 | 
				
			||||||
 "hashbrown",
 | 
					 "hashbrown",
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[package]]
 | 
				
			||||||
 | 
					name = "instant"
 | 
				
			||||||
 | 
					version = "0.1.12"
 | 
				
			||||||
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
 | 
					checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
 | 
				
			||||||
 | 
					dependencies = [
 | 
				
			||||||
 | 
					 "cfg-if",
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "ipnet"
 | 
					name = "ipnet"
 | 
				
			||||||
version = "2.5.0"
 | 
					version = "2.5.0"
 | 
				
			||||||
| 
						 | 
					@ -1080,6 +1098,7 @@ dependencies = [
 | 
				
			||||||
 "regex",
 | 
					 "regex",
 | 
				
			||||||
 "reqwest",
 | 
					 "reqwest",
 | 
				
			||||||
 "tokio",
 | 
					 "tokio",
 | 
				
			||||||
 | 
					 "ua_generator",
 | 
				
			||||||
 "webp",
 | 
					 "webp",
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1334,6 +1353,20 @@ name = "serde"
 | 
				
			||||||
version = "1.0.147"
 | 
					version = "1.0.147"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965"
 | 
					checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965"
 | 
				
			||||||
 | 
					dependencies = [
 | 
				
			||||||
 | 
					 "serde_derive",
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[package]]
 | 
				
			||||||
 | 
					name = "serde_derive"
 | 
				
			||||||
 | 
					version = "1.0.147"
 | 
				
			||||||
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
 | 
					checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852"
 | 
				
			||||||
 | 
					dependencies = [
 | 
				
			||||||
 | 
					 "proc-macro2",
 | 
				
			||||||
 | 
					 "quote",
 | 
				
			||||||
 | 
					 "syn",
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "serde_json"
 | 
					name = "serde_json"
 | 
				
			||||||
| 
						 | 
					@ -1588,6 +1621,18 @@ version = "1.15.0"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
 | 
					checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[package]]
 | 
				
			||||||
 | 
					name = "ua_generator"
 | 
				
			||||||
 | 
					version = "0.3.5"
 | 
				
			||||||
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
 | 
					checksum = "1d91c667af349d600c11b92b5f937722341d1543deab1db7c63c2a6fcc7e66e8"
 | 
				
			||||||
 | 
					dependencies = [
 | 
				
			||||||
 | 
					 "fastrand",
 | 
				
			||||||
 | 
					 "serde",
 | 
				
			||||||
 | 
					 "serde_json",
 | 
				
			||||||
 | 
					 "ureq",
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "unicode-bidi"
 | 
					name = "unicode-bidi"
 | 
				
			||||||
version = "0.3.8"
 | 
					version = "0.3.8"
 | 
				
			||||||
| 
						 | 
					@ -1615,6 +1660,26 @@ version = "0.7.1"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
 | 
					checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[package]]
 | 
				
			||||||
 | 
					name = "ureq"
 | 
				
			||||||
 | 
					version = "2.6.2"
 | 
				
			||||||
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
 | 
					checksum = "338b31dd1314f68f3aabf3ed57ab922df95ffcd902476ca7ba3c4ce7b908c46d"
 | 
				
			||||||
 | 
					dependencies = [
 | 
				
			||||||
 | 
					 "base64 0.13.1",
 | 
				
			||||||
 | 
					 "brotli-decompressor",
 | 
				
			||||||
 | 
					 "encoding_rs",
 | 
				
			||||||
 | 
					 "flate2",
 | 
				
			||||||
 | 
					 "log",
 | 
				
			||||||
 | 
					 "once_cell",
 | 
				
			||||||
 | 
					 "rustls",
 | 
				
			||||||
 | 
					 "serde",
 | 
				
			||||||
 | 
					 "serde_json",
 | 
				
			||||||
 | 
					 "url",
 | 
				
			||||||
 | 
					 "webpki",
 | 
				
			||||||
 | 
					 "webpki-roots",
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "url"
 | 
					name = "url"
 | 
				
			||||||
version = "2.3.1"
 | 
					version = "2.3.1"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,6 +9,7 @@ version = "0.1.0"
 | 
				
			||||||
actix-web = "4.3.1"
 | 
					actix-web = "4.3.1"
 | 
				
			||||||
image = "0.24.5"
 | 
					image = "0.24.5"
 | 
				
			||||||
once_cell = "1.17.1"
 | 
					once_cell = "1.17.1"
 | 
				
			||||||
 | 
					ua_generator = "0.3.5"
 | 
				
			||||||
qstring = "0.7.2"
 | 
					qstring = "0.7.2"
 | 
				
			||||||
regex = "1.7.2"
 | 
					regex = "1.7.2"
 | 
				
			||||||
reqwest = {version = "0.11.15", features = ["rustls-tls", "stream", "brotli", "gzip"], default-features = false}
 | 
					reqwest = {version = "0.11.15", features = ["rustls-tls", "stream", "brotli", "gzip"], default-features = false}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,6 +5,7 @@ use actix_web::http::Method;
 | 
				
			||||||
use actix_web::{web, App, HttpRequest, HttpResponse, HttpResponseBuilder, HttpServer};
 | 
					use actix_web::{web, App, HttpRequest, HttpResponse, HttpResponseBuilder, HttpServer};
 | 
				
			||||||
use image::EncodableLayout;
 | 
					use image::EncodableLayout;
 | 
				
			||||||
use once_cell::sync::Lazy;
 | 
					use once_cell::sync::Lazy;
 | 
				
			||||||
 | 
					use ua_generator::ua::spoof_ua;
 | 
				
			||||||
use qstring::QString;
 | 
					use qstring::QString;
 | 
				
			||||||
use regex::Regex;
 | 
					use regex::Regex;
 | 
				
			||||||
use reqwest::{Client, Request, Url};
 | 
					use reqwest::{Client, Request, Url};
 | 
				
			||||||
| 
						 | 
					@ -36,7 +37,7 @@ static RE_DASH_MANIFEST: Lazy<Regex> =
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static CLIENT: Lazy<Client> = Lazy::new(|| {
 | 
					static CLIENT: Lazy<Client> = Lazy::new(|| {
 | 
				
			||||||
    let builder = Client::builder()
 | 
					    let builder = Client::builder()
 | 
				
			||||||
        .user_agent("Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0");
 | 
					        .user_agent(spoof_ua());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if env::var("IPV4_ONLY").is_ok() {
 | 
					    if env::var("IPV4_ONLY").is_ok() {
 | 
				
			||||||
        builder
 | 
					        builder
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue