Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions crates/ptrs/examples/README.md
Original file line number Diff line number Diff line change
@@ -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).
Original file line number Diff line number Diff line change
@@ -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 {}

Expand Down Expand Up @@ -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,
Expand All @@ -180,7 +189,7 @@ mod design_tests {
use std::time::Duration;

use super::{BuilderC, BuilderS, Passthrough};
use crate::{
use ptrs::{
ClientBuilder,
ClientTransport,
FutureResult,
Expand Down Expand Up @@ -827,3 +836,4 @@ mod design_tests {
Ok(())
}
}

3 changes: 3 additions & 0 deletions crates/ptrs/examples/split.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
todo!("example under construction");
}
3 changes: 3 additions & 0 deletions crates/ptrs/examples/udp.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
todo!("example under construction");
}
3 changes: 0 additions & 3 deletions crates/ptrs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,3 @@ pub(crate) type F<T, E> = FutureResult<T, E>;
pub type TcpStreamFut = Pin<FutureResult<tokio::net::TcpStream, std::io::Error>>;

pub type UdpSocketFut = Pin<FutureResult<tokio::net::UdpSocket, std::io::Error>>;

#[cfg(test)]
mod passthrough;