func (s *server) RegisterInterceptors(intercept map[string]Interceptor) error {
	if s.interceptors == nil {
		s.interceptors = make(map[string]Interceptor)
	}
	for method, i := range intercept {
		if _, ok := s.interceptors[method]; ok {
			return serverError("server already has a registered interceptor for '%s'", method)
		}
		s.interceptors[method] = i
	}
	return nil
}
RegisterInterceptors registers the given interveptors with the server.
package server
import (
	"context"
	"fmt"
	"net"
	"os"
	"os/user"
	"path/filepath"
	"strconv"
	"strings"
	"time"
	"google.golang.org/grpc"
	api "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
	"github.com/intel/cri-resource-manager/pkg/cri/resource-manager/sockets"
	"github.com/intel/cri-resource-manager/pkg/dump"
	logger "github.com/intel/cri-resource-manager/pkg/log"
	"github.com/intel/cri-resource-manager/pkg/utils"
	"github.com/intel/cri-resource-manager/pkg/instrumentation"
	"go.opencensus.io/trace"
)
type Options struct {
	Socket string
	User int
	Group int
	Mode os.FileMode
	QualifyReqFn func(interface{}) string
}
type Handler grpc.UnaryHandler
type Interceptor func(context.Context, string, interface{}, Handler) (interface{}, error)
type Server interface {
	RegisterImageService(api.ImageServiceServer) error
	RegisterRuntimeService(api.RuntimeServiceServer) error
	RegisterInterceptors(map[string]Interceptor) error
	SetBypassCheckFn(func() bool)
	Start() error
	Stop()
	Chmod(mode os.FileMode) error
	Chown(uid, gid int) error
}
type server struct {
	logger.Logger
	listener     net.Listener               
	server       *grpc.Server               
	options      Options                    
	interceptors map[string]Interceptor     
	chkBypassFn  func() bool                
	runtime      *api.RuntimeServiceServer  
	image        *api.ImageServiceServer    
}
func NewServer(options Options) (Server, error) {
	if !filepath.IsAbs(options.Socket) {
		return nil, serverError("invalid socket '%s', expecting absolute path",
			options.Socket)
	}
	s := &server{
		Logger:  logger.NewLogger("cri/server"),
		options: options,
	}
	return s, nil
}
func (s *server) RegisterImageService(service api.ImageServiceServer) error {
	if s.image != nil {
		return serverError("can't register image service, already registered")
	}
	if err := s.createGrpcServer(); err != nil {
		return err
	}
	is := service
	s.image = &is
	api.RegisterImageServiceServer(s.server, s)
	return nil
}
func (s *server) RegisterRuntimeService(service api.RuntimeServiceServer) error {
	if s.runtime != nil {
		return serverError("can't register runtime server, already registered")
	}
	if err := s.createGrpcServer(); err != nil {
		return err
	}
	rs := service
	s.runtime = &rs
	api.RegisterRuntimeServiceServer(s.server, s)
	return nil
}