-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #350 from ramajd/features/proxy-support
Features/proxy support
- Loading branch information
Showing
17 changed files
with
229 additions
and
28 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Proxy | ||
|
||
## `[proxy]` Section | ||
|
||
Example | ||
|
||
```toml | ||
[proxy] | ||
type = "socks5" | ||
host = "<string>" | ||
port = <integer> | ||
``` | ||
|
||
| Key | Description | Default | | ||
| :--------- | :------------------------------------------------ | :---------- | | ||
| `type` | Proxy type. Only `socks5` is currently supported. | `""` | | ||
| `host` | Proxy host to connect to | `""` | | ||
| `port` | Proxy port to connect on | `""` | | ||
| `username` | Proxy username, optional | `""` | | ||
| `password` | Proxy password, optional | `""` | |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use serde::Deserialize; | ||
|
||
#[derive(Debug, Clone, Deserialize)] | ||
#[serde(rename_all = "kebab-case")] | ||
pub enum Kind { | ||
Socks5, | ||
} | ||
|
||
#[derive(Debug, Clone, Deserialize)] | ||
pub struct Proxy { | ||
#[serde(rename = "type")] | ||
pub kind: Kind, | ||
pub host: String, | ||
pub port: u16, | ||
pub username: Option<String>, | ||
pub password: Option<String>, | ||
} | ||
|
||
impl From<Proxy> for irc::connection::Proxy { | ||
fn from(proxy: Proxy) -> irc::connection::Proxy { | ||
match proxy.kind { | ||
Kind::Socks5 => irc::connection::Proxy::Socks5 { | ||
host: proxy.host, | ||
port: proxy.port, | ||
username: proxy.username, | ||
password: proxy.password, | ||
}, | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.