Compare commits
2 commits
161a006ebe
...
d34159b4b6
Author | SHA1 | Date | |
---|---|---|---|
Filip Znachor | d34159b4b6 | ||
Filip Znachor | 912871f833 |
16
README.md
Normal file → Executable file
16
README.md
Normal file → Executable file
|
@ -1,3 +1,17 @@
|
||||||
# odproxy
|
# odproxy
|
||||||
|
|
||||||
Simple HTTP reverse proxy that dynamically manages backend services based on demand.
|
Simple HTTP reverse proxy that dynamically manages backend services based on demand.
|
||||||
|
|
||||||
|
Find yourself ever in a situation where you don't have a lot of resources and you run a lot of different services on your server that nobody uses most of the time? Then odproxy is for you!
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- configurable **listening address** and **port**
|
||||||
|
- **multiple** configured **hosts** with **multiple hostnames**
|
||||||
|
- automatic process **spawning** based on demand
|
||||||
|
- **logging** cases of **unknown hostnames**
|
||||||
|
|
||||||
|
### In future releases
|
||||||
|
|
||||||
|
- listening on socket
|
||||||
|
- start and stop command mode
|
33
services.rs
33
services.rs
|
@ -90,26 +90,19 @@ fn stop_service(name: &String) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn wait_for_service(proxy: &ProxyConf) {
|
async fn wait_for_service(proxy: &ProxyConf) {
|
||||||
if proxy.socket {
|
if proxy.socket {
|
||||||
|
let path = Path::new(&proxy.target);
|
||||||
let path = Path::new(&proxy.target);
|
while !path.exists() {
|
||||||
while !path.exists() {
|
sleep(Duration::from_millis(100)).await;
|
||||||
sleep(Duration::from_millis(100)).await;
|
}
|
||||||
}
|
} else {
|
||||||
|
while target_to_address(&proxy.target)
|
||||||
} else {
|
.map(|address| TcpStream::connect(address).is_err())
|
||||||
|
.unwrap_or(true)
|
||||||
if let Some(address) = target_to_address(&proxy.target) {
|
{
|
||||||
loop {
|
sleep(Duration::from_millis(100)).await;
|
||||||
sleep(Duration::from_millis(100)).await;
|
}
|
||||||
match TcpStream::connect(address) {
|
}
|
||||||
Ok(_) => break,
|
|
||||||
Err(_) => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn prepare_services() {
|
pub async fn prepare_services() {
|
||||||
|
|
Loading…
Reference in a new issue