github.com/v2fly/v2ray-core/v4@v4.45.2/app/commander/service.go (about)

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