-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add forward traffic to another HTTP proxy for the server (only for Lo…
…calProtocol::Tcp) (#326) * Add forward traffic to another HTTP proxy for the server (only for LocalProtocol::Tcp) * Update to the newest code: - Add `connect_with_http_proxy` to `TunnelConnector` * Remove unnecessary error checks * Resolve conflict again
- Loading branch information
Showing
6 changed files
with
138 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,24 @@ | ||
mod sock5; | ||
mod tcp; | ||
mod udp; | ||
use tokio::io::{AsyncRead, AsyncWrite}; | ||
use url::Url; | ||
|
||
pub use sock5::Socks5TunnelConnector; | ||
pub use tcp::TcpTunnelConnector; | ||
pub use udp::UdpTunnelConnector; | ||
|
||
use crate::tunnel::RemoteAddr; | ||
use tokio::io::{AsyncRead, AsyncWrite}; | ||
|
||
mod sock5; | ||
mod tcp; | ||
mod udp; | ||
|
||
pub trait TunnelConnector { | ||
type Reader: AsyncRead + Send + 'static; | ||
type Writer: AsyncWrite + Send + 'static; | ||
|
||
async fn connect(&self, remote: &Option<RemoteAddr>) -> anyhow::Result<(Self::Reader, Self::Writer)>; | ||
async fn connect_with_http_proxy( | ||
&self, | ||
proxy: &Url, | ||
remote: &Option<RemoteAddr>, | ||
) -> anyhow::Result<(Self::Reader, Self::Writer)>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters