-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Uncle Jack <[email protected]>
- Loading branch information
1 parent
2761b8f
commit c7226d9
Showing
9 changed files
with
210 additions
and
37 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
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,28 @@ | ||
version = "v1" | ||
bind = "0.0.0.0" | ||
port = 6666 | ||
|
||
whitelist = [ | ||
"173.245.48.0/20", | ||
"103.21.244.0/22", | ||
"103.22.200.0/22", | ||
"103.31.4.0/22", | ||
"141.101.64.0/18", | ||
"108.162.192.0/18", | ||
"190.93.240.0/20", | ||
"188.114.96.0/20", | ||
"197.234.240.0/22", | ||
"198.41.128.0/17", | ||
"162.158.0.0/15", | ||
"104.16.0.0/13", | ||
"104.24.0.0/14", | ||
"172.64.0.0/13", | ||
"131.0.72.0/22", | ||
"2400:cb00::/32", | ||
"2606:4700::/32", | ||
"2803:f800::/32", | ||
"2405:b500::/32", | ||
"2405:8100::/32", | ||
"2a06:98c0::/29", | ||
"2c0f:f248::/32" | ||
] |
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,24 @@ | ||
use crate::proto::Version; | ||
use cidr::IpCidr; | ||
|
||
use std::net::IpAddr; | ||
|
||
use anyhow::{anyhow, Result}; | ||
use serde::Deserialize; | ||
|
||
#[derive(Deserialize)] | ||
pub struct Config { | ||
pub bind: IpAddr, | ||
pub port: u16, | ||
pub version: Version, | ||
pub whitelist: Vec<IpCidr>, | ||
} | ||
|
||
impl Config { | ||
pub fn new(config: &str) -> Result<Self> { | ||
match toml::from_str(config) { | ||
Ok(c) => Ok(c), | ||
Err(e) => Err(anyhow!("could not parse config file {}", e)), | ||
} | ||
} | ||
} |
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.