Documentation ¶
Index ¶
- Constants
- func CloneArgsClientInterceptor(uci grpc.UnaryClientInterceptor) grpc.UnaryClientInterceptor
- func CloneArgsServerInterceptor(usi grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor
- func DialContext(ctx context.Context, addr net.Addr, opts ...grpc.DialOption) (*grpc.ClientConn, error)
- func DialContextTCP(ctx context.Context, address string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
- func DialContextUnix(ctx context.Context, path string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
- func DialTCP(address string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
- func DialTCPInsecure(address string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
- func DialUnix(path string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
- func DialUnixInsecure(path string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
- func GetCurrentNS() (string, error)
- func GetCurrentPodNameFromHostname() (string, error)
- func InitConfig(c DialConfig)
- func IsInsecure() (bool, error)
- func NewAddr(network, addr string) net.Addr
- func NewOSSignalChannel() chan os.Signal
- func NewServer(ctx context.Context, opts ...grpc.ServerOption) *grpc.Server
- func NewServerInsecure(opts ...grpc.ServerOption) *grpc.Server
- func OpenTracingDialOptions() []grpc.DialOption
- func ParseKVStringToMap(input, sep, kvsep string) map[string]string
- func ReadEnvBool(env string, value bool) (bool, error)
- func SocketCleanup(listenEndpoint string) error
- func WaitForPortAvailable(ctx context.Context, protoType, registryAddress string, ...) error
- type DialConfig
- type NSUrl
- type SocketPath
Constants ¶
const (
// InsecureEnv environment variable, if "true" NSM will work in insecure mode
InsecureEnv = "INSECURE"
)
const (
// MaxSymLink is maximum length of Symbolic Link
MaxSymLink = 8192
)
Variables ¶
This section is empty.
Functions ¶
func CloneArgsClientInterceptor ¶
func CloneArgsClientInterceptor(uci grpc.UnaryClientInterceptor) grpc.UnaryClientInterceptor
func CloneArgsServerInterceptor ¶
func CloneArgsServerInterceptor(usi grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor
func DialContext ¶
func DialContext(ctx context.Context, addr net.Addr, opts ...grpc.DialOption) (*grpc.ClientConn, error)
DialContext allows to call DialContext using net.Addr
func DialContextTCP ¶
func DialContextTCP(ctx context.Context, address string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
DialContextTCP establish TCP connection with address
func DialContextUnix ¶
func DialContextUnix(ctx context.Context, path string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
DialContextUnix establish connection with passed unix socket
func DialTCP ¶
func DialTCP(address string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
DialTCP establish TCP connection with address and set default timeout
func DialTCPInsecure ¶
func DialTCPInsecure(address string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
DialTCPInsecure establish TCP connection with address in insecure mode and set default timeout
func DialUnix ¶
func DialUnix(path string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
DialUnix establish connection with passed unix socket and set default timeout
func DialUnixInsecure ¶
func DialUnixInsecure(path string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
DialUnixInsecure establish connection with passed unix socket in insecure mode and set default timeout
func GetCurrentNS ¶
GetCurrentNS discovers the namespace of a running process and returns in a string.
func GetCurrentPodNameFromHostname ¶
GetCurrentPodNameFromHostname returns pod name a container is running in Note: Pod name is read from `/etc/hostname`. The same approach is used in kubelet implementation. There is risk that host name may be overwritten and in that case this should be considered when referring to pod name
func InitConfig ¶
func InitConfig(c DialConfig)
InitConfig allows init global DialConfig, should be called before any GetConfig(), otherwise do nothing
func NewOSSignalChannel ¶
func NewServer ¶
NewServer checks DialConfig and calls grpc.NewServer with certain grpc.ServerOption
func NewServerInsecure ¶
func NewServerInsecure(opts ...grpc.ServerOption) *grpc.Server
func OpenTracingDialOptions ¶
func OpenTracingDialOptions() []grpc.DialOption
OpenTracingDialOptions returns array of grpc.DialOption that should be passed to grpc.Dial to enable opentracing
func ParseKVStringToMap ¶
ParseKVStringToMap parses the input string
func ReadEnvBool ¶
ReadEnvBool reads environment variable and treat it as bool
func SocketCleanup ¶
SocketCleanup check for the presence of a stale socket and if it finds it, removes it.
Types ¶
type DialConfig ¶
DialConfig represents configuration of grpc connection, one per instance
type NSUrl ¶
func ParseAnnotationValue ¶
type SocketPath ¶
type SocketPath string
Unix socket file path.
func (SocketPath) Network ¶
func (socket SocketPath) Network() string
func (SocketPath) String ¶
func (socket SocketPath) String() string