зеркало из https://github.com/github/vitess-gh.git
Also supporting RPCs to list available services.
This commit is contained in:
Родитель
f887c77a8f
Коммит
702ef6d6fc
|
@ -27,6 +27,8 @@ func Register(name string, rcvr interface{}) {
|
|||
} else {
|
||||
log.Infof("Not registering %v for SASL bsonrpc over vt port, enable it with bsonrpc-auth-vt-%v service_map parameter", name, name)
|
||||
}
|
||||
|
||||
// register the other guys
|
||||
socketFileRegister(name, rcvr)
|
||||
secureRegister(name, rcvr)
|
||||
}
|
||||
|
@ -35,10 +37,14 @@ func ServeRPC() {
|
|||
// rpc.HandleHTTP registers the default GOB handler at /_goRPC_
|
||||
// and the debug RPC service at /debug/rpc (it displays a list
|
||||
// of registered services and their methods).
|
||||
// So disabling this, but leaving a trace here so it's easy
|
||||
// to re-add for a quick test on which service is running.
|
||||
//
|
||||
// rpc.HandleHTTP()
|
||||
if ServiceMap["gob-vt"] {
|
||||
log.Infof("Registering GOB handler and /debug/rpc URL for vt port")
|
||||
rpc.HandleHTTP()
|
||||
}
|
||||
if ServiceMap["gob-auth-vt"] {
|
||||
log.Infof("Registering GOB handler and /debug/rpcs URL for SASL vt port")
|
||||
rpcwrap.AuthenticatedServer.HandleHTTP(rpc.DefaultRPCPath, rpc.DefaultDebugPath+"s")
|
||||
}
|
||||
|
||||
// if we have an authentication config, we register the authenticated
|
||||
// bsonrpc services.
|
||||
|
|
|
@ -15,6 +15,7 @@ import (
|
|||
log "github.com/golang/glog"
|
||||
"github.com/youtube/vitess/go/proc"
|
||||
"github.com/youtube/vitess/go/rpcplus"
|
||||
"github.com/youtube/vitess/go/rpcwrap"
|
||||
"github.com/youtube/vitess/go/rpcwrap/bsonrpc"
|
||||
)
|
||||
|
||||
|
@ -92,6 +93,18 @@ func ServeSecurePort(securePort int, certFile, keyFile, caCertFile string) {
|
|||
throttled := NewThrottledListener(l, *secureThrottle, *secureMaxBuffer)
|
||||
cl := proc.Published(throttled, "SecureConnections", "SecureAccepts")
|
||||
|
||||
// rpc.HandleHTTP registers the default GOB handler at /_goRPC_
|
||||
// and the debug RPC service at /debug/rpc (it displays a list
|
||||
// of registered services and their methods).
|
||||
if ServiceMap["gob-vts"] {
|
||||
log.Infof("Registering GOB handler and /debug/rpc URL for vts port")
|
||||
secureRpcServer.HandleHTTP(rpcwrap.GetRpcPath("gob", false), rpcplus.DefaultDebugPath)
|
||||
}
|
||||
if ServiceMap["gob-auth-vts"] {
|
||||
log.Infof("Registering GOB handler and /debug/rpcs URL for SASL vts port")
|
||||
authenticatedSecureRpcServer.HandleHTTP(rpcwrap.GetRpcPath("gob", true), rpcplus.DefaultDebugPath+"s")
|
||||
}
|
||||
|
||||
handler := http.NewServeMux()
|
||||
bsonrpc.ServeCustomRPC(handler, secureRpcServer, false)
|
||||
bsonrpc.ServeCustomRPC(handler, authenticatedSecureRpcServer, true)
|
||||
|
|
|
@ -12,6 +12,7 @@ import (
|
|||
|
||||
log "github.com/golang/glog"
|
||||
"github.com/youtube/vitess/go/rpcplus"
|
||||
"github.com/youtube/vitess/go/rpcwrap"
|
||||
"github.com/youtube/vitess/go/rpcwrap/bsonrpc"
|
||||
)
|
||||
|
||||
|
@ -62,6 +63,18 @@ func ServeSocketFile(name string) {
|
|||
}
|
||||
log.Infof("Listening on socket file %v", name)
|
||||
|
||||
// HandleHTTP registers the default GOB handler at /_goRPC_
|
||||
// and the debug RPC service at /debug/rpc (it displays a list
|
||||
// of registered services and their methods).
|
||||
if ServiceMap["gob-unix"] {
|
||||
log.Infof("Registering GOB handler and /debug/rpc URL for unix socket")
|
||||
socketFileRpcServer.HandleHTTP(rpcwrap.GetRpcPath("gob", false), rpcplus.DefaultDebugPath)
|
||||
}
|
||||
if ServiceMap["gob-auth-unix"] {
|
||||
log.Infof("Registering GOB handler and /debug/rpcs URL for SASL unix socket")
|
||||
authenticatedSocketFileRpcServer.HandleHTTP(rpcwrap.GetRpcPath("gob", true), rpcplus.DefaultDebugPath+"s")
|
||||
}
|
||||
|
||||
handler := http.NewServeMux()
|
||||
bsonrpc.ServeCustomRPC(handler, socketFileRpcServer, false)
|
||||
bsonrpc.ServeCustomRPC(handler, authenticatedSocketFileRpcServer, true)
|
||||
|
|
Загрузка…
Ссылка в новой задаче