Skip to content

Conversation

@ssrlive
Copy link
Collaborator

@ssrlive ssrlive commented Feb 20, 2025

No description provided.

@ssrlive ssrlive force-pushed the main branch 2 times, most recently from b30366d to 4be8245 Compare February 21, 2025 04:00
@ssrlive ssrlive changed the title Refine code Refactor TCP logic Mar 3, 2025
@ssrlive
Copy link
Collaborator Author

ssrlive commented Mar 4, 2025

Refactoring is complete, please review it. @SajjadPourali

@ssrlive ssrlive force-pushed the main branch 2 times, most recently from 80e3fe5 to 25cd26c Compare March 9, 2025 09:10

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
dotenvy::dotenv().ok();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we use environment variables in this example?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we use .env file.

) -> Poll<std::io::Result<()>> {
fn poll_read(mut self: std::pin::Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut tokio::io::ReadBuf<'_>) -> Poll<std::io::Result<()>> {
loop {
if self.tcb.retransmission.is_some() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not exactly sure how retransmission is handled here. Is this one moved to the PacketStatus::RetransmissionRequest => {...} later in the same function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

tokio = { version = "1.43", default-features = false, features = [
"rt-multi-thread",
] }
tun = { version = "0.7.13", default-features = false, features = ["async"] }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also rename tun2.rs example to tun.rs if you wish

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@SajjadPourali SajjadPourali merged commit 585f9b2 into narrowlink:main Mar 10, 2025
2 checks passed
@SajjadPourali
Copy link
Collaborator

Thanks

@ssrlive
Copy link
Collaborator Author

ssrlive commented Mar 11, 2025

Please publish it.

@ssrlive
Copy link
Collaborator Author

ssrlive commented Mar 11, 2025

Now, the final problem of the crate is introducing congestion control.

@SajjadPourali
Copy link
Collaborator

SajjadPourali commented Mar 11, 2025

Please publish it.

I’m doing some benchmark tests and will publish it a bit later.

Now, the final problem of the crate is introducing congestion control.

Network congestion is unlikely under normal conditions for the intended use of this crate, but extreme system load or resource exhaustion may cause issues. Implementing a simple AIMD mechanism could enhance its stability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants