github.com/v2fly/v2ray-core/v5@v5.16.2-0.20240507031116-8191faa6e095/app/commander/service.go (about) 1 package commander 2 3 import ( 4 "context" 5 6 "google.golang.org/grpc" 7 "google.golang.org/grpc/reflection" 8 9 "github.com/v2fly/v2ray-core/v5/common" 10 ) 11 12 // Service is a Commander service. 13 type Service interface { 14 // Register registers the service itself to a gRPC server. 15 Register(*grpc.Server) 16 } 17 18 type reflectionService struct{} 19 20 func (r reflectionService) Register(s *grpc.Server) { 21 reflection.Register(s) 22 } 23 24 func init() { 25 common.Must(common.RegisterConfig((*ReflectionConfig)(nil), func(ctx context.Context, cfg interface{}) (interface{}, error) { 26 return reflectionService{}, nil 27 })) 28 }