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

implement grpc for trojan and vmess #203

Merged
merged 22 commits into from
Dec 6, 2023
Merged

implement grpc for trojan and vmess #203

merged 22 commits into from
Dec 6, 2023

Conversation

ibigbug
Copy link
Member

@ibigbug ibigbug commented Dec 2, 2023

@ibigbug ibigbug mentioned this pull request Dec 2, 2023
@ibigbug ibigbug added the help wanted Extra attention is needed label Dec 4, 2023
@ibigbug
Copy link
Member Author

ibigbug commented Dec 4, 2023

it wouldn't send more data after the init request is done for some reason

image

@greenhat616
Copy link
Collaborator

greenhat616 commented Dec 5, 2023

Seems they have impl gRPC transport in their another project: https://github.com/Qv2ray/v2ray-rust/blob/dev/src/proxy/grpc/mod.rs

I am backport this to this project to have a test

EDIT: This impl is not work yet ...... 😅
image
image

@ibigbug
Copy link
Member Author

ibigbug commented Dec 5, 2023

Yeah I think there’s something wrong in how they handle the array boundry.

Another thing can be done is maybe to try the grpc with Trojan (I’ve put it in too in this PR) and see if it’s actually the problem of our grpc impl or only grpc with vmesd is the issue

@greenhat616
Copy link
Collaborator

greenhat616 commented Dec 5, 2023

Yeah I think there’s something wrong in how they handle the array boundry.

Another thing can be done is maybe to try the grpc with Trojan (I’ve put it in too in this PR) and see if it’s actually the problem of our grpc impl or only grpc with vmesd is the issue

I test currect pr in trojan with gRPC( xray is the backend), using the config:

{
  "log": {
    "loglevel": "debug" // Level of log
  },
  "inbounds": [
    {
      "port": 12312,
      "protocol": "trojan",
      "settings": {
        "clients": [
          {
            "password": "password",
            "email": "love@xray.com",
            "level": 0
          }
        ],
        "fallbacks": [
          {
            "dest": 80
          }
        ]
      },
      "streamSettings": {
        "network": "grpc",
        "grpcSettings": {
          "serviceName": "abc"
        },
        "security": "none"
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {}
    }
  ]
}

It seems small page, such as www.baidu.com can get a response immediately. and huge page like www.aliyun.com, www.google.com, or a pure huge http page http://www.galgamez.me/bbs/, could get a buffer out of range error:

split_to out of bounds: 4096 <= 4054
  2023-12-05T14:58:06.236309Z ERROR clash_lib: panic hook: PanicInfo { payload: Any { .. }, message: Some(split_to out of bounds: 4096 <= 4054), location: Location { file: "C:\\Users\\a632079\\.cargo\\registry\\src\\rsproxy.cn-0dccff568467c15b\\bytes-1.5.0\\src\\bytes_mut.r

image

@ibigbug
Copy link
Member Author

ibigbug commented Dec 5, 2023

Ok nice we are making progresses. 👍

I'll take a look later. Thanks!

@ibigbug ibigbug marked this pull request as ready for review December 6, 2023 16:25
@ibigbug ibigbug changed the title grpc implement grpc for trojan and vmess Dec 6, 2023
@ibigbug ibigbug added enhancement New feature or request core and removed help wanted Extra attention is needed labels Dec 6, 2023
@ibigbug
Copy link
Member Author

ibigbug commented Dec 6, 2023

@greenhat616 i think it's working now. feel free to give it a try on master branch

@ibigbug ibigbug merged commit f99e92a into master Dec 6, 2023
5 checks passed
@ibigbug ibigbug deleted the grpc branch December 6, 2023 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants