mirror of
https://github.com/sadoyan/aralez.git
synced 2026-04-29 22:38:36 +08:00
Removed unnecessary protocol declaration.
This commit is contained in:
@@ -2,7 +2,6 @@ upstreams:
|
|||||||
myip.netangels.net:
|
myip.netangels.net:
|
||||||
paths:
|
paths:
|
||||||
"/echo":
|
"/echo":
|
||||||
protocol: "X-Proxied-From:Fooooooooooooooo, X-DoSome-About:Yaaaaaaaaaaaaaaa"
|
|
||||||
ssl: false
|
ssl: false
|
||||||
servers:
|
servers:
|
||||||
- "127.0.0.1:8000"
|
- "127.0.0.1:8000"
|
||||||
@@ -10,32 +9,27 @@ upstreams:
|
|||||||
- "127.0.0.3:8000"
|
- "127.0.0.3:8000"
|
||||||
- "127.0.0.4:8000"
|
- "127.0.0.4:8000"
|
||||||
"/ping":
|
"/ping":
|
||||||
protocol: "PLACEHOLDER"
|
|
||||||
ssl: false
|
ssl: false
|
||||||
servers:
|
servers:
|
||||||
- "127.0.0.1:8000"
|
- "127.0.0.1:8000"
|
||||||
- "127.0.0.2:8000"
|
- "127.0.0.2:8000"
|
||||||
"/draw":
|
"/draw":
|
||||||
protocol: "PLACEHOLDER"
|
|
||||||
ssl: false
|
ssl: false
|
||||||
servers:
|
servers:
|
||||||
- "192.168.1.1:8000"
|
- "192.168.1.1:8000"
|
||||||
polo.netangels.net:
|
polo.netangels.net:
|
||||||
paths:
|
paths:
|
||||||
"/":
|
"/":
|
||||||
protocol: "PLACEHOLDER"
|
|
||||||
ssl: false
|
ssl: false
|
||||||
servers:
|
servers:
|
||||||
- "192.168.1.10:8000"
|
- "192.168.1.10:8000"
|
||||||
"/ws":
|
"/ws":
|
||||||
protocol: "PLACEHOLDER"
|
|
||||||
ssl: false
|
ssl: false
|
||||||
servers:
|
servers:
|
||||||
- "192.168.1.1:8000"
|
- "192.168.1.1:8000"
|
||||||
glop.netangels.net:
|
glop.netangels.net:
|
||||||
paths:
|
paths:
|
||||||
"/":
|
"/":
|
||||||
protocol: "PLACEHOLDER"
|
|
||||||
ssl: false
|
ssl: false
|
||||||
servers:
|
servers:
|
||||||
- "192.168.1.10:8000"
|
- "192.168.1.10:8000"
|
||||||
@@ -43,14 +37,12 @@ upstreams:
|
|||||||
apt.netangels.net:
|
apt.netangels.net:
|
||||||
paths:
|
paths:
|
||||||
"/":
|
"/":
|
||||||
protocol: "PLACEHOLDER"
|
|
||||||
ssl: true
|
ssl: true
|
||||||
servers:
|
servers:
|
||||||
- "apt.netangels.net:443"
|
- "apt.netangels.net:443"
|
||||||
127.0.0.1:
|
127.0.0.1:
|
||||||
paths:
|
paths:
|
||||||
"/camerastatus":
|
"/camerastatus":
|
||||||
protocol: "PLACEHOLDER"
|
|
||||||
ssl: false
|
ssl: false
|
||||||
servers:
|
servers:
|
||||||
- "192.168.1.5:8080"
|
- "192.168.1.5:8080"
|
||||||
@@ -20,7 +20,7 @@ pub async fn hc2(upslist: Arc<UpstreamsDashMap>, fullist: Arc<UpstreamsDashMap>)
|
|||||||
let path = path_entry.key();
|
let path = path_entry.key();
|
||||||
let mut innervec= Vec::new();
|
let mut innervec= Vec::new();
|
||||||
for k in path_entry.value().0.iter().enumerate() {
|
for k in path_entry.value().0.iter().enumerate() {
|
||||||
let (ip, port, ssl, _proto) = k.1;
|
let (ip, port, ssl) = k.1;
|
||||||
let mut _pref = "";
|
let mut _pref = "";
|
||||||
match ssl {
|
match ssl {
|
||||||
true => _pref = "https://",
|
true => _pref = "https://",
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ struct HostConfig {
|
|||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
struct PathConfig {
|
struct PathConfig {
|
||||||
protocol: String,
|
|
||||||
ssl: bool,
|
ssl: bool,
|
||||||
servers: Vec<String>,
|
servers: Vec<String>,
|
||||||
}
|
}
|
||||||
@@ -57,7 +56,7 @@ pub fn load_yaml_to_dashmap(d: &str, kind: &str) -> Option<UpstreamsDashMap> {
|
|||||||
for server in path_config.servers {
|
for server in path_config.servers {
|
||||||
if let Some((ip, port_str)) = server.split_once(':') {
|
if let Some((ip, port_str)) = server.split_once(':') {
|
||||||
if let Ok(port) = port_str.parse::<u16>() {
|
if let Ok(port) = port_str.parse::<u16>() {
|
||||||
server_list.push((ip.to_string(), port, path_config.ssl, path_config.protocol.clone()));
|
server_list.push((ip.to_string(), port, path_config.ssl));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,14 +13,14 @@ pub fn print_upstreams(upstreams: &UpstreamsDashMap) {
|
|||||||
let path = path_entry.key();
|
let path = path_entry.key();
|
||||||
println!(" Path: {}", path);
|
println!(" Path: {}", path);
|
||||||
|
|
||||||
for (ip, port, ssl, proto) in path_entry.value().0.clone() {
|
for (ip, port, ssl) in path_entry.value().0.clone() {
|
||||||
println!(" ===> IP: {}, Port: {}, SSL: {}, Proto: {}", ip, port, ssl, proto);
|
println!(" ===> IP: {}, Port: {}, SSL: {}", ip, port, ssl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type UpstreamsDashMap = DashMap<String, DashMap<String, (Vec<(String, u16, bool, String)>, AtomicUsize)>>;
|
pub type UpstreamsDashMap = DashMap<String, DashMap<String, (Vec<(String, u16, bool)>, AtomicUsize)>>;
|
||||||
// pub type UpstreamMap = DashMap<String, (Vec<(String, u16)>, AtomicUsize)>;
|
// pub type UpstreamMap = DashMap<String, (Vec<(String, u16)>, AtomicUsize)>;
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
|||||||
@@ -84,17 +84,12 @@ impl BackgroundService for LB {
|
|||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
pub trait GetHost {
|
pub trait GetHost {
|
||||||
async fn get_host(&self, peer: &str, path: &str, upgrade: bool) -> Option<(String, u16, bool, String)>;
|
async fn get_host(&self, peer: &str, path: &str, upgrade: bool) -> Option<(String, u16, bool)>;
|
||||||
}
|
}
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl GetHost for LB {
|
impl GetHost for LB {
|
||||||
async fn get_host(&self, peer: &str, path: &str, _upgrade: bool) -> Option<(String, u16, bool, String)> {
|
async fn get_host(&self, peer: &str, path: &str, _upgrade: bool) -> Option<(String, u16, bool)> {
|
||||||
let _proto = "";
|
let _proto = "";
|
||||||
// if upgrade {
|
|
||||||
// _proto = "wsoc";
|
|
||||||
// } else {
|
|
||||||
// _proto = "http"
|
|
||||||
// }
|
|
||||||
let host_entry = self.ump_upst.get(peer);
|
let host_entry = self.ump_upst.get(peer);
|
||||||
match host_entry {
|
match host_entry {
|
||||||
Some(host_entry) => {
|
Some(host_entry) => {
|
||||||
@@ -127,7 +122,7 @@ impl ProxyHttp for LB {
|
|||||||
let header_host = host.to_str().unwrap().split(':').collect::<Vec<&str>>();
|
let header_host = host.to_str().unwrap().split(':').collect::<Vec<&str>>();
|
||||||
let ddr = self.get_host(header_host[0], session.req_header().uri.path(), session.is_upgrade_req());
|
let ddr = self.get_host(header_host[0], session.req_header().uri.path(), session.is_upgrade_req());
|
||||||
match ddr.await {
|
match ddr.await {
|
||||||
Some((host, port, ssl, _proto)) => {
|
Some((host, port, ssl)) => {
|
||||||
let peer = Box::new(HttpPeer::new((host, port), ssl, String::new()));
|
let peer = Box::new(HttpPeer::new((host, port), ssl, String::new()));
|
||||||
Ok(peer)
|
Ok(peer)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user