common

package
v1.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2020 License: Apache-2.0 Imports: 15 Imported by: 17

Documentation

Index

Constants

View Source
const (
	// NsmServerSocketEnv is the name of the env variable to define NSM server socket
	NsmServerSocketEnv = "NSM_SERVER_SOCKET"
	// NsmClientSocketEnv is the name of the env variable to define NSM client socket
	NsmClientSocketEnv = "NSM_CLIENT_SOCKET"
	// WorkspaceEnv is the name of the env variable to define workspace directory
	WorkspaceEnv = "WORKSPACE"
)

Variables

This section is empty.

Functions

func GetNamespace

func GetNamespace() string

func Ip2int

func Ip2int(ip net.IP) uint32

Ip2int converts and IP address to 32-bit unsignet integer

func IsIPv6

func IsIPv6(address string) bool

IsIPv6 function to check whether an IP is IPv6 or IPv4

func NewMechanism

func NewMechanism(cls string, t string, name, description string) (*connection.Mechanism, error)

NewMechanism creates a new mechanism with passed type and description.

Types

type NSConfiguration

type NSConfiguration struct {
	NsmServerSocket        string
	NsmClientSocket        string
	Workspace              string
	EndpointNetworkService string
	ClientNetworkService   string
	EndpointLabels         string
	ClientLabels           string
	NscInterfaceName       string
	MechanismType          string
	IPAddress              string
	Routes                 []string
	PodName                string
	Namespace              string
}

NSConfiguration contains the full configuration used in the SDK

func FromEnv

func FromEnv() *NSConfiguration

FromEnv creates a new NSConfiguration and fills all unset options from the env variables

func FromNSUrl

func FromNSUrl(url *tools.NSUrl) *NSConfiguration

func (*NSConfiguration) FromEnv

func (configuration *NSConfiguration) FromEnv() *NSConfiguration

FromEnv fills all unset options from the env variables

func (*NSConfiguration) FromNSUrl

func (configuration *NSConfiguration) FromNSUrl(url *tools.NSUrl) *NSConfiguration

type NsmConnection

type NsmConnection struct {
	sync.RWMutex
	Context       context.Context
	Configuration *NSConfiguration
	GrpcClient    *grpc.ClientConn
	NsClient      networkservice.NetworkServiceClient
}

NsmConnection is a NSM manager connection

func NewNSMConnection

func NewNSMConnection(ctx context.Context, configuration *NSConfiguration) (*NsmConnection, error)

NewNSMConnection creates a NsmConnection

func (*NsmConnection) Close

func (nsmc *NsmConnection) Close() error

Close terminates the connection

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL