1
1
mirror of https://github.com/go-gitea/gitea synced 2025-09-28 03:28:13 +00:00

chore(router): Add grpc and grep-web api

Using connect-go package

https://github.com/bufbuild/connect-go

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu
2022-08-13 11:48:14 +08:00
committed by Jason Song
parent 92d15afd18
commit 0e79fc556a
6 changed files with 303 additions and 203 deletions

View File

@@ -9,6 +9,9 @@ import (
"crypto/tls"
"net"
"net/http"
"golang.org/x/net/http2"
"golang.org/x/net/http2/h2c"
)
func newHTTPServer(network, address, name string, handler http.Handler) (*Server, ServeFunction) {
@@ -17,7 +20,7 @@ func newHTTPServer(network, address, name string, handler http.Handler) (*Server
ReadTimeout: DefaultReadTimeOut,
WriteTimeout: DefaultWriteTimeOut,
MaxHeaderBytes: DefaultMaxHeaderBytes,
Handler: handler,
Handler: h2c.NewHandler(handler, &http2.Server{}),
BaseContext: func(net.Listener) context.Context { return GetManager().HammerContext() },
}
server.OnShutdown = func() {