Skip to content

gRPC

[!NOTE] This document is partially generated by AI.

gRPC is a high-performance transport protocol based on HTTP/2 and Protocol Buffers. In yuhaiin, it is used to tunnel proxy traffic through bi-directional gRPC streams.

  • TCP: Supported (Stream-based).
  • UDP: Not supported. gRPC is inherently stream-oriented.

When used as an outbound transport, the grpc block uses the following simplified configuration:

  • tls: A nested TLS configuration block. gRPC requires a TLS layer for connection establishment.
    • enable (bool): (Required) Set to true.
    • servernames (string array): SNI for the gRPC server.

For an inbound gRPC server, the configuration is typically handled at the listener level.

  • The grpc Inbound does not have dedicated configuration fields in the grpc block itself; it relies on the underlying TLS and listener setup.
{
"grpc": {
"tls": {
"enable": true,
"servernames": ["grpc.example.com"]
}
}
}

yuhaiin implements a specific gRPC service that allows for streaming raw binary data (TCP/UDP) over HTTP/2 streams. This is often more resilient to detection in environments that already use heavy gRPC traffic.

Located in pkg/net/proxy/grpc. It utilizes the official google.golang.org/grpc library.