Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: hysteria draft #217

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

feat: hysteria draft #217

wants to merge 7 commits into from

Conversation

eauxxs
Copy link

@eauxxs eauxxs commented Dec 16, 2023

🤔 This is a ...

  • New feature

🔗 Related issue link

💡 Background and solution

📝 Changelog

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Changelog is provided or not needed

@@ -0,0 +1,43 @@
use std::sync::Arc;
Copy link
Member

Choose a reason for hiding this comment

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

you can put this under clash_lib/src/proxy/converters

Copy link
Author

Choose a reason for hiding this comment

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

ok

@eauxxs
Copy link
Author

eauxxs commented Dec 17, 2023

At present, hysteria2 can already perform tcp proxy, mainly udp proxy, brutal congestion, ports hopping has not been implemented, port hopping may be just a small problem.
In the process of implementing salamander, I encountered a very confusing problem. The obfuscation can be correctly encrypted and decrypted by both parties, and the quic connection can be established. But when sending h3 authentication, an error will occur. I don’t know if it’s a problem with the h3 library or the obfuscation algorithm itself or something else. I don’t know if you know more about quic and if you have any ideas.
@ibigbug @greenhat616 @xmh0511

@greenhat616
Copy link
Collaborator

I'm busy these days. while I am spare, I could take a look.

@eauxxs
Copy link
Author

eauxxs commented Dec 19, 2023

I'm busy these days. while I am spare, I could take a look.

thanks, salamander obfs have been fixed, it work now

@ibigbug
Copy link
Member

ibigbug commented Dec 25, 2023

Hey thank you guys.

I see that you've fixed the problem, is there anything left to be done for this PR?

@ibigbug
Copy link
Member

ibigbug commented Dec 25, 2023

@eauxxs the build is failed on Windows

@@ -60,5 +60,5 @@ proxies:
udp: true

rules:
- MATCH, ss
- MATCH, ss-01
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- MATCH, ss-01
- MATCH, ss


proxies:
- name: "local"
type: Hysteria2
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
type: Hysteria2
type: hysteria2

@@ -6,6 +6,7 @@ use serde::Serialize;
use tokio::sync::broadcast::Sender;

use tracing::debug;
use tracing::Level;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
use tracing::Level;

@@ -103,6 +104,11 @@ pub fn setup_logging(
)
.from_env_lossy();

// let trace = tracing_subscriber::filter::targets::Targets::new()
Copy link
Member

Choose a reason for hiding this comment

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

you can do something like this to enable the level RUST_LOG=h2=trace,clash=debug

@@ -53,6 +53,7 @@ pub enum OutboundProxyProtocol {
Trojan(OutboundTrojan),
#[serde(rename = "vmess")]
Vmess(OutboundVmess),
Hysteria2(OutboundHysteria2),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Hysteria2(OutboundHysteria2),
#[serde(rename = "hysteria2")]
Hysteria2(OutboundHysteria2),


use crate::proxy::converters::hysteria2::PortGenrateor;

pub struct UdpHop {
Copy link
Member

Choose a reason for hiding this comment

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

could you please add a short description for this struct, such as what part it plays in the protocol

Copy link
Author

Choose a reason for hiding this comment

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

}

println!("done");
// std::thread::sleep(std::time::Duration::from_secs(100000));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// std::thread::sleep(std::time::Duration::from_secs(100000));

@@ -368,3 +371,53 @@ impl TryFrom<HashMap<String, Value>> for OutboundProxyProviderDef {
.map_err(map_serde_error)
}
}

// #hysteria2
Copy link
Member

Choose a reason for hiding this comment

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

would be great if you can convert these into the standard doc comment https://doc.rust-lang.org/rust-by-example/meta/doc.html

so that we might use them in future to generate the API references


struct Burtal;

impl Controller for Burtal {
Copy link
Member

Choose a reason for hiding this comment

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

is this used any where?


use quinn_proto::congestion::{Bbr, BbrConfig, Controller, ControllerFactory};

pub struct DynCongestion;
Copy link
Member

Choose a reason for hiding this comment

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

is this file used at all?

Copy link
Author

Choose a reason for hiding this comment

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

The current protocol still needs to implement the congestion algorithm and udp proxy. I will fix this part of the code next week.

Choose a reason for hiding this comment

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

can not wait it

Copy link
Author

Choose a reason for hiding this comment

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

can not wait it

哥们尽快吧,主要是最近比较忙,还生病了。
另外rust的quinn拥塞算法接口和go的那边还不一样,go这边有现成的,rust没有,工作还比较多。

Copy link
Member

Choose a reason for hiding this comment

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

身体要紧。
如果有什么问题可以分享出来大家一起看。

Copy link
Author

Choose a reason for hiding this comment

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

谢谢关心。目前就是拥塞算法,对照着go版本hysteria的brutal拥塞算法,它那里是计算丢包个数再进行调整发送速率,quinn接口只有丢包字节数,我问一下这个issue,目前还在看,不知道是否有更好的方法

Copy link
Member

Choose a reason for hiding this comment

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

我看有回复,如果他的说法可行,提个PR?

Copy link

Choose a reason for hiding this comment

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

can not wait it

@eauxxs
Copy link
Author

eauxxs commented Dec 28, 2023

@eauxxs the build is failed on Windows

It looks like the problem is with borrowing-ssl, can we remove deps directory, and use boring crate directly, why it is necessary?

@ibigbug
Copy link
Member

ibigbug commented Dec 31, 2023

@eauxxs the build is failed on Windows

It looks like the problem is with borrowing-ssl, can we remove deps directory, and use boring crate directly, why it is necessary?

the forked boring added aes and this #240 removes it

@ibigbug ibigbug changed the title hysteria draft feat: hysteria draft May 10, 2024
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.

None yet

4 participants