-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start to lay the structure of the forwarded code
- Loading branch information
Showing
7 changed files
with
59 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use super::Node; | ||
use crate::net::{address::Authority, Protocol}; | ||
|
||
pub struct ForwardedEntry { | ||
by_node: Option<Node>, | ||
for_node: Option<Node>, | ||
host: Option<Authority>, | ||
proto: Option<Protocol>, | ||
} |
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,22 @@ | ||
//! rama support for the "Forwarded HTTP Extension" | ||
//! | ||
//! RFC: <https://datatracker.ietf.org/doc/html/rfc7239> | ||
|
||
use super::{address::Authority, Protocol}; | ||
use std::net::IpAddr; | ||
|
||
mod obfuscated; | ||
#[doc(inline)] | ||
pub use obfuscated::ObfuscatedString; | ||
|
||
mod node; | ||
#[doc(inline)] | ||
pub use node::{Node, NodeName, NodePort}; | ||
|
||
mod entry; | ||
#[doc(inline)] | ||
pub use entry::ForwardedEntry; | ||
|
||
pub struct Forwarded { | ||
entries: Vec<ForwardedEntry>, | ||
} |
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,12 @@ | ||
mod name; | ||
#[doc(inline)] | ||
pub use name::NodeName; | ||
|
||
mod port; | ||
#[doc(inline)] | ||
pub use port::NodePort; | ||
|
||
pub struct Node { | ||
name: NodeName, | ||
port: Option<NodePort>, | ||
} |
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,8 @@ | ||
use crate::net::forwarded::ObfuscatedString; | ||
use std::net::IpAddr; | ||
|
||
pub enum NodeName { | ||
Unknown, | ||
Ip(IpAddr), | ||
ObfNode(ObfuscatedString), | ||
} |
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,6 @@ | ||
use crate::net::forwarded::ObfuscatedString; | ||
|
||
pub enum NodePort { | ||
Port(u16), | ||
ObfPort(ObfuscatedString), | ||
} |
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 @@ | ||
pub struct ObfuscatedString(String); |
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,6 +1,7 @@ | ||
//! protocol agnostic network modules | ||
|
||
pub mod address; | ||
pub mod forwarded; | ||
pub mod stream; | ||
pub mod user; | ||
|
||
|