2019-02-01 14:08:21 -05:00
|
|
|
// +build !confonly
|
|
|
|
|
2018-02-08 17:24:35 -05:00
|
|
|
package commander
|
|
|
|
|
|
|
|
import (
|
2020-11-19 12:57:31 -05:00
|
|
|
"context"
|
|
|
|
|
2018-02-08 17:24:35 -05:00
|
|
|
"google.golang.org/grpc"
|
2020-11-19 12:57:31 -05:00
|
|
|
"google.golang.org/grpc/reflection"
|
2021-02-16 15:31:50 -05:00
|
|
|
|
|
|
|
"github.com/v2fly/v2ray-core/v4/common"
|
2018-02-08 17:24:35 -05:00
|
|
|
)
|
|
|
|
|
2018-04-03 18:57:44 -04:00
|
|
|
// Service is a Commander service.
|
2018-02-08 17:24:35 -05:00
|
|
|
type Service interface {
|
2018-04-03 18:57:44 -04:00
|
|
|
// Register registers the service itself to a gRPC server.
|
2018-02-08 17:24:35 -05:00
|
|
|
Register(*grpc.Server)
|
|
|
|
}
|
2020-11-19 12:57:31 -05:00
|
|
|
|
|
|
|
type reflectionService struct{}
|
|
|
|
|
|
|
|
func (r reflectionService) Register(s *grpc.Server) {
|
|
|
|
reflection.Register(s)
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
common.Must(common.RegisterConfig((*ReflectionConfig)(nil), func(ctx context.Context, cfg interface{}) (interface{}, error) {
|
|
|
|
return reflectionService{}, nil
|
|
|
|
}))
|
|
|
|
}
|