Support for TLS/plaintext Port Unification
- Langage dominant
- Java
- Étoiles
- 12.1k
- Forks
- 4k
- Merge moyen
- 2 j 17 h
- PR mergées (30 j)
- 37
Description
### Is your feature request related to a problem?
While trying to work with TLS, I was scanning through the current server setup. The NettyServerBuilder configures the port to be TLS or plaintext based on the presence or absence of `SslContext`, correspondingly.
https://github.com/grpc/grpc-java/blob/012dbaf5be3fb0d532d977d288a0e42a58f30a7c/netty/src/main/java/io/grpc/netty/NettyServerBuilder.java#L352-L364
Resulting in a very little flexibility for the users to customize the port. Specifically, I was trying to see if we can accept both TLS & non-TLS connections on the same port without the need for creating a duplicate port. Netty demonstrates this through the [doc](https://netty.io/4.1/xref/io/netty/example/portunification/PortUnificationServerHandler.html#PortUnificationServerHandler).
### Describe the solution you'd like
**Approach1**
Explicit public interface in `NettyServerBuilder` for enabling/disabling/multiplexing TLS.
We could follow a [similar approach](https://netty.io/4.1/xref/io/netty/example/portunification/PortUnificationServerHandler.html#PortUnificationServerHandler) of spiffing the initial bytes & dynamically configuring TLS.
**Approach2**
A public interface for adding child handlers to customize the connections.
https://github.com/grpc/grpc-java/blob/012dbaf5be3fb0d532d977d288a0e42a58f30a7c/netty/src/main/java/io/grpc/netty/NettyServer.java#L228
### Additional context
Relevant thread in stackoverflow:
https://stackoverflow.com/questions/71484231/port-unification-in-grpc-java
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par NettyServerBuilder.java, au niveau de la configuration TLS/plaintext autour des lignes 352-364, puis examinez NettyServer.java autour de la ligne 228 ainsi que l’exemple Netty PortUnificationServerHandler lié. Comparez les deux interfaces publiques proposées et définissez comment un port doit accepter à la fois les connexions TLS et non-TLS sans nécessiter un port dupliqué.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java
- Domaine
- backend-api-design, networking
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- Calme
- Clarté
- Plutôt claire
- Accessibilité débutants
- 38/100