diff --git a/crates/ptrs/examples/README.md b/crates/ptrs/examples/README.md new file mode 100644 index 0000000..d6c4995 --- /dev/null +++ b/crates/ptrs/examples/README.md @@ -0,0 +1,16 @@ + +# Minimal Example Transports. + + +**Passthrough** - Does nothing but forward traffic. + + +**Split** - (TODO) There's no protocol obfuscation, no +encryption, but the link between the client and server uses *two* TCP +connections, both of which are unidirectional: one is used only for +upstream and the other is used only for downstream. The server listens +on two ports, and when the client connects, it connects to both ports. + + +**UDP** - (TODO) Demonstrate that the ptrs model works for transports wrapping +unreliable channels (if they are designed to be). diff --git a/crates/ptrs/src/passthrough.rs b/crates/ptrs/examples/passthrough/lib.rs similarity index 98% rename from crates/ptrs/src/passthrough.rs rename to crates/ptrs/examples/passthrough/lib.rs index 003b0e1..97ead65 100644 --- a/crates/ptrs/src/passthrough.rs +++ b/crates/ptrs/examples/passthrough/lib.rs @@ -1,4 +1,13 @@ -use super::*; +use ptrs::{ + args, ClientBuilder, ClientTransport, FutureResult as F, PluggableTransport, ServerBuilder, + ServerTransport, +}; + +use tokio::io::{AsyncRead, AsyncWrite}; +use tokio::time::Duration; + +use std::net::{SocketAddrV4, SocketAddrV6}; +use std::pin::Pin; pub struct Passthrough {} @@ -166,7 +175,7 @@ impl Passthrough { #[cfg(test)] mod design_tests { - use crate::info; + use ptrs::info; use tokio::{ io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}, net::TcpStream, @@ -180,7 +189,7 @@ mod design_tests { use std::time::Duration; use super::{BuilderC, BuilderS, Passthrough}; - use crate::{ + use ptrs::{ ClientBuilder, ClientTransport, FutureResult, @@ -827,3 +836,4 @@ mod design_tests { Ok(()) } } + diff --git a/crates/ptrs/examples/split.rs b/crates/ptrs/examples/split.rs new file mode 100644 index 0000000..26fd1b0 --- /dev/null +++ b/crates/ptrs/examples/split.rs @@ -0,0 +1,3 @@ +fn main() { + todo!("example under construction"); +} diff --git a/crates/ptrs/examples/udp.rs b/crates/ptrs/examples/udp.rs new file mode 100644 index 0000000..26fd1b0 --- /dev/null +++ b/crates/ptrs/examples/udp.rs @@ -0,0 +1,3 @@ +fn main() { + todo!("example under construction"); +} diff --git a/crates/ptrs/src/lib.rs b/crates/ptrs/src/lib.rs index e80cee8..7d55ca8 100644 --- a/crates/ptrs/src/lib.rs +++ b/crates/ptrs/src/lib.rs @@ -237,6 +237,3 @@ pub(crate) type F = FutureResult; pub type TcpStreamFut = Pin>; pub type UdpSocketFut = Pin>; - -#[cfg(test)] -mod passthrough;