github.com/xmplusdev/xray-core@v1.8.10/app/commander/service.go (about)

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