Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureServer ¶
ConfigureServer configures srv to identify gRPC connections and send them to the returned net.Listener, suitable for passing to grpc.Server.Serve, while all other HTTP requests will be handled by srv.
ConfigureServer works with or without TLS enabled.
When TLS is enabled, ConfigureServer relies on ALPN. ConfigureServer internally calls http2.ConfigureServer(srv, conf) to configure HTTP/2 support, and defines an alternative srv.TLSNextProto "h2" handler. When using TLS, the gRPC listener returns secure connections; the gRPC server must not also be configured to wrap the connection with TLS.
When TLS is not enabled, ConfigureServer relies on h2c prior knowledge, wrapping srv.Handler. It is therefore necessary to set srv.Handler before calling ConfigureServer.
The returned listener will be closed when srv.Shutdown is called. The returned listener's Addr() method does not correspond to the configured HTTP server's listener(s) in any way, and cannot be relied upon for forming a connection URL.
Types ¶
This section is empty.