|  | @@ -30,6 +30,8 @@ package server
 | 
	
		
			
				|  |  |  import (
 | 
	
		
			
				|  |  |  	"context"
 | 
	
		
			
				|  |  |  	"errors"
 | 
	
		
			
				|  |  | +	"net"
 | 
	
		
			
				|  |  | +	"strings"
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
 | 
	
		
			
				|  |  |  	"google.golang.org/grpc"
 | 
	
	
		
			
				|  | @@ -57,6 +59,15 @@ func New() *grpc.Server {
 | 
	
		
			
				|  |  |  	return s
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +//CreateListener creates a listener either on tcp://, or local listener, supporting unix:// for unix socket or npipe:// for named pipes on windows
 | 
	
		
			
				|  |  | +func CreateListener(address string) (net.Listener, error) {
 | 
	
		
			
				|  |  | +	if strings.HasPrefix(address, "tcp://") {
 | 
	
		
			
				|  |  | +		return net.Listen("tcp", strings.TrimPrefix(address, "tcp://"))
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +	return createLocalListener(address)
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  func unary(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {
 | 
	
		
			
				|  |  |  	return grpc_prometheus.UnaryServerInterceptor(ctx, req, info, handler)
 | 
	
		
			
				|  |  |  }
 |