Crate mproxy_forward
source ·Expand description
Multicast Network Dispatcher and Proxy
MPROXY: Forwarding Proxy
Forward TLS/TCP, UDP, or Multicast endpoints to a downstream UDP socket address.
Use feature tls
to enable TLS provided by crate rustls
.
Quick Start
In Cargo.toml
[dependencies]
mproxy-forward = { version = "0.1", features = ["tls"] }
Example src/main.rs
use std::thread::JoinHandle;
use mproxy_forward::{forward_udp, proxy_tcp_udp};
let udp_listen_addr: String ="[ff02::1]:9920".into();
let udp_downstream_addrs = vec!["[::1]:9921".into(), "localhost:9922".into()];
let tcp_connect_addr: String = "localhost:9925".into();
let tee = true; // copy input to stdout
let mut threads: Vec<JoinHandle<()>> = vec![];
// spawn UDP socket listener and forward to downstream addresses
threads.push(forward_udp(udp_listen_addr.clone(), &udp_downstream_addrs, tee));
// connect to TCP upstream, and forward to UDP socket listener
threads.push(proxy_tcp_udp(tcp_connect_addr, udp_listen_addr));
for thread in threads {
thread.join().unwrap();
}
Command Line Interface
Install with cargo
cargo install mproxy-forward
MPROXY: Forwarding Proxy
Forward TLS/TCP, UDP, or Multicast endpoints to a downstream UDP socket address.
USAGE:
mproxy-forward [FLAGS] [OPTIONS]
OPTIONS:
--udp-listen-addr [HOSTNAME:PORT] UDP listening socket address. May be repeated
--udp-downstream-addr [HOSTNAME:PORT] UDP downstream socket address. May be repeated
--tcp-connect-addr [HOSTNAME:PORT] Connect to TCP host, forwarding stream. May be repeated
FLAGS:
-h, --help Prints help information
-t, --tee Copy input to stdout
EXAMPLE:
mproxy-forward --udp-listen-addr '0.0.0.0:9920' \
--udp-downstream-addr '[::1]:9921' \
--udp-downstream-addr 'localhost:9922' \
--tcp-connect-addr 'localhost:9925' \
--tee
See Also
Functions
- Forward UDP upstream
listen_addr
to downstream UDP socket addresses.listen_addr
may be a multicast address. - Wrapper for forward_udp listening on multiple upstream addresses
- Connect to TCP upstream server, and forward received bytes to a downstream UDP socket socket address. TLS can be enabled with feature
tls
(provided by craterustls
).