mirror of
https://github.com/smallnest/rpcx.git
synced 2025-10-28 02:11:27 +08:00
add 2 options to control httpinvoke and jsonrpc 2.0 services
This commit is contained in:
@@ -27,11 +27,17 @@ func (s *Server) startGateway(network string, ln net.Listener) net.Listener {
|
||||
m := cmux.New(ln)
|
||||
|
||||
rpcxLn := m.Match(rpcxPrefixByteMatcher())
|
||||
jsonrpc2Ln := m.Match(cmux.HTTP1HeaderField("X-JSONRPC-2.0", "true"))
|
||||
httpLn := m.Match(cmux.HTTP1Fast())
|
||||
|
||||
go s.startJSONRPC2(jsonrpc2Ln)
|
||||
go s.startHTTP1APIGateway(httpLn)
|
||||
if !s.DisableJSONRPC {
|
||||
jsonrpc2Ln := m.Match(cmux.HTTP1HeaderField("X-JSONRPC-2.0", "true"))
|
||||
go s.startJSONRPC2(jsonrpc2Ln)
|
||||
}
|
||||
|
||||
if !s.DisableHTTPGateway {
|
||||
httpLn := m.Match(cmux.HTTP1Fast())
|
||||
go s.startHTTP1APIGateway(httpLn)
|
||||
}
|
||||
|
||||
go m.Serve()
|
||||
|
||||
return rpcxLn
|
||||
|
||||
Reference in New Issue
Block a user