pub struct WMCore {Show 19 fields
pub option: ConfigOption,
pub center_client: Option<CenterClient>,
pub center_servers: Vec<CenterServer>,
pub proxy_accept: Option<TlsAcceptor>,
pub proxy_client: Option<Arc<ClientConfig>>,
pub client_listener: Option<TcpListener>,
pub center_listener: Option<TcpListener>,
pub map_http_listener: Option<TcpListener>,
pub map_https_listener: Option<TcpListener>,
pub map_tcp_listener: Option<TcpListener>,
pub map_proxy_listener: Option<TcpListener>,
pub map_accept: Option<TlsAcceptor>,
pub http_servers: Vec<Arc<ServerConfig>>,
pub http_accepts: Vec<Option<WrapTlsAccepter>>,
pub http_tlss: Vec<bool>,
pub http_listeners: Vec<TcpListener>,
pub stream_config: Option<Arc<Mutex<StreamConfig>>>,
pub stream_listeners: Vec<TcpListener>,
pub stream_udp_listeners: Vec<StreamUdp>,
/* private fields */
}
Expand description
核心处理类
Fields§
§option: ConfigOption
§center_client: Option<CenterClient>
§center_servers: Vec<CenterServer>
§proxy_accept: Option<TlsAcceptor>
§proxy_client: Option<Arc<ClientConfig>>
§client_listener: Option<TcpListener>
§center_listener: Option<TcpListener>
§map_http_listener: Option<TcpListener>
§map_https_listener: Option<TcpListener>
§map_tcp_listener: Option<TcpListener>
§map_proxy_listener: Option<TcpListener>
§map_accept: Option<TlsAcceptor>
§http_servers: Vec<Arc<ServerConfig>>
§http_accepts: Vec<Option<WrapTlsAccepter>>
§http_tlss: Vec<bool>
§http_listeners: Vec<TcpListener>
§stream_config: Option<Arc<Mutex<StreamConfig>>>
§stream_listeners: Vec<TcpListener>
§stream_udp_listeners: Vec<StreamUdp>
Implementations§
source§impl WMCore
impl WMCore
sourcepub fn new(option: ConfigOption) -> WMCore
pub fn new(option: ConfigOption) -> WMCore
Examples found in repository?
examples/proxy.rs (line 31)
26 27 28 29 30 31 32 33 34 35 36 37 38
async fn run_proxy(
proxy: ProxyConfig,
) -> ProxyResult<(SocketAddr, Sender<()>)> {
let option = ConfigOption::new_by_proxy(proxy);
let (sender_close, receiver_close) = channel::<()>(1);
let mut proxy = WMCore::new(option);
proxy.ready_serve().await.unwrap();
let addr = proxy.center_listener.as_ref().unwrap().local_addr()?;
tokio::spawn(async move {
let _ = proxy.run_serve(receiver_close, None).await;
});
Ok((addr, sender_close))
}
pub async fn do_start_health_check(&mut self) -> ProxyResult<()>
sourcepub async fn ready_serve(&mut self) -> ProxyResult<()>
pub async fn ready_serve(&mut self) -> ProxyResult<()>
Examples found in repository?
examples/proxy.rs (line 32)
26 27 28 29 30 31 32 33 34 35 36 37 38
async fn run_proxy(
proxy: ProxyConfig,
) -> ProxyResult<(SocketAddr, Sender<()>)> {
let option = ConfigOption::new_by_proxy(proxy);
let (sender_close, receiver_close) = channel::<()>(1);
let mut proxy = WMCore::new(option);
proxy.ready_serve().await.unwrap();
let addr = proxy.center_listener.as_ref().unwrap().local_addr()?;
tokio::spawn(async move {
let _ = proxy.run_serve(receiver_close, None).await;
});
Ok((addr, sender_close))
}
sourcepub async fn run_serve(
&mut self,
receiver_close: Receiver<()>,
sender_close: Option<Sender<()>>
) -> ProxyResult<()>
pub async fn run_serve( &mut self, receiver_close: Receiver<()>, sender_close: Option<Sender<()>> ) -> ProxyResult<()>
Examples found in repository?
examples/proxy.rs (line 35)
26 27 28 29 30 31 32 33 34 35 36 37 38
async fn run_proxy(
proxy: ProxyConfig,
) -> ProxyResult<(SocketAddr, Sender<()>)> {
let option = ConfigOption::new_by_proxy(proxy);
let (sender_close, receiver_close) = channel::<()>(1);
let mut proxy = WMCore::new(option);
proxy.ready_serve().await.unwrap();
let addr = proxy.center_listener.as_ref().unwrap().local_addr()?;
tokio::spawn(async move {
let _ = proxy.run_serve(receiver_close, None).await;
});
Ok((addr, sender_close))
}
pub async fn start_serve( &mut self, receiver_close: Receiver<()>, sender_close: Option<Sender<()>> ) -> ProxyResult<()>
pub fn clear_close_servers(&mut self)
pub async fn server_new_http( &mut self, stream: TcpStream, addr: SocketAddr ) -> ProxyResult<()>
pub async fn server_new_https( &mut self, stream: TcpStream, addr: SocketAddr, accept: TlsAcceptor ) -> ProxyResult<()>
pub async fn server_new_tcp( &mut self, stream: TcpStream, _addr: SocketAddr ) -> ProxyResult<()>
pub async fn server_new_proxy( &mut self, stream: TcpStream, _addr: SocketAddr ) -> ProxyResult<()>
Auto Trait Implementations§
impl !RefUnwindSafe for WMCore
impl Send for WMCore
impl Sync for WMCore
impl Unpin for WMCore
impl !UnwindSafe for WMCore
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more