-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite to use custom udp routing & dispatch, bump to v1.0.0
- Remove `udp_stream` dependency - Rewrite to use custom udp adresses translation and dispatch system. - Add `first` parameter to obfuscation - Rename `servers.proxy` -> `servers.relay` - Rename `servers.downstream` -> `servers.upstream`
- Loading branch information
Showing
7 changed files
with
221 additions
and
133 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
[package] | ||
name = "dpimyass" | ||
version = "0.3.0" | ||
version = "1.0.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
tokio = { version = "1", features = ["full"] } | ||
serde = { version = "1", features = ["derive"] } | ||
serde_with = "3.5.0" | ||
toml = "0.8" | ||
udp-stream = "0.0.10" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
use std::{ | ||
net::SocketAddr, | ||
net::ToSocketAddrs, | ||
time::Duration | ||
}; | ||
|
||
use serde::Deserialize; | ||
use serde::de::Deserializer; | ||
use serde_with::DurationSeconds; | ||
use serde_with::serde_as; | ||
|
||
|
||
fn resolve_address<'de, D>(de: D) -> Result<SocketAddr, D::Error> | ||
where D: Deserializer<'de> { | ||
let addr = <String>::deserialize(de)?; | ||
|
||
addr.to_socket_addrs() | ||
.map_err(serde::de::Error::custom)? | ||
.next() | ||
.ok_or(serde::de::Error::custom("No address")) | ||
} | ||
|
||
#[derive(Deserialize, Debug)] | ||
pub struct Config { | ||
pub servers: Vec<ServerConfig> | ||
} | ||
|
||
#[derive(Deserialize, Debug)] | ||
pub struct ServerConfig { | ||
pub name: String, | ||
#[serde(flatten)] | ||
pub obfs: ObfsConfig, | ||
pub relay: EndpointConfig, | ||
pub upstream: EndpointConfig, | ||
} | ||
|
||
#[derive(Deserialize, Debug)] | ||
pub struct ObfsConfig { | ||
pub key: Vec<u8>, | ||
pub first: Option<usize>, | ||
} | ||
|
||
#[serde_as] | ||
#[derive(Deserialize, Debug)] | ||
pub struct EndpointConfig { | ||
#[serde(deserialize_with = "resolve_address")] | ||
pub address: SocketAddr, | ||
pub buffer: usize, | ||
#[serde_as(as = "DurationSeconds<u64>")] | ||
pub timeout: Duration, | ||
} |
Oops, something went wrong.