Help us shape the future of Go! Take the 2026 Go Developer Survey

network

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToEnvironmentVariables

func ConvertToEnvironmentVariables(nets []*runtimev1.NetworkMapping) ([]string, error)

ConvertToEnvironmentVariables converts NetworkMapping to environment variables

func GetFreePorts

func GetFreePorts(n int) ([]int, error)

GetFreePorts returns a slice of n free ports

func ToEndpoint

func ToEndpoint(endpoint *corev1.Endpoint) *configurations.Endpoint

func ToUnique

func ToUnique(endpoint *corev1.Endpoint) string

Types

type Address

type Address struct {
	Host string
	Port int
}

type ApplicationEndpoint

type ApplicationEndpoint struct {
	Service     string
	Application string
	Namespace   string
	Endpoint    *corev1.Endpoint
	PortBinding string // something like 8080/tcp
}

An ApplicationEndpoint takes a service Endpoint and embed it so it can be used across the applications

func (ApplicationEndpoint) Clone

func (ApplicationEndpoint) Unique

func (e ApplicationEndpoint) Unique() string

type ApplicationEndpointInstance

type ApplicationEndpointInstance struct {
	ApplicationEndpoint ApplicationEndpoint
	Port                int
	Host                string
}

An ApplicationEndpointInstance is an instance of an ApplicationEndpoint

func (*ApplicationEndpointInstance) Address

func (m *ApplicationEndpointInstance) Address() string

func (*ApplicationEndpointInstance) Name

func (*ApplicationEndpointInstance) StringPort

func (m *ApplicationEndpointInstance) StringPort() string

type ApplicationEndpointInstances

type ApplicationEndpointInstances struct {
	ApplicationEndpointInstances []*ApplicationEndpointInstance
}

func (*ApplicationEndpointInstances) Address

func (pm *ApplicationEndpointInstances) Address(endpoint *corev1.Endpoint) *Address

func (*ApplicationEndpointInstances) First

type DNS

type DNS struct{}

func (DNS) Reserve

type FixedStrategy

type FixedStrategy struct{}

func (FixedStrategy) Reserve

type RandomStrategy

type RandomStrategy struct{}

func (RandomStrategy) Reserve

type ServiceManager

type ServiceManager struct {
	// contains filtered or unexported fields
}

A ServiceManager helps go from a service to applications endpoint instances

func NewServiceDnsManager

func NewServiceDnsManager(ctx context.Context, identity *servicev1.ServiceIdentity, endpoints ...*corev1.Endpoint) (*ServiceManager, error)

func NewServiceManager

func NewServiceManager(identity *servicev1.ServiceIdentity, endpoints ...*corev1.Endpoint) *ServiceManager

func NewServicePortManager

func NewServicePortManager(ctx context.Context, identity *servicev1.ServiceIdentity, endpoints ...*corev1.Endpoint) (*ServiceManager, error)

func (*ServiceManager) ApplicationEndpointInstance

func (pm *ServiceManager) ApplicationEndpointInstance(endpoint *corev1.Endpoint) (*ApplicationEndpointInstance, error)

func (*ServiceManager) ApplicationEndpointInstances

func (pm *ServiceManager) ApplicationEndpointInstances() []*ApplicationEndpointInstance

func (*ServiceManager) Bind

func (pm *ServiceManager) Bind(endpoint *corev1.Endpoint, portBinding string) error

func (*ServiceManager) Expose

func (pm *ServiceManager) Expose(endpoint *corev1.Endpoint) error

func (*ServiceManager) NetworkMapping

func (pm *ServiceManager) NetworkMapping() ([]*runtimev1.NetworkMapping, error)

NetworkMapping returns the network mapping for the service to be passed back to codefly

func (*ServiceManager) Port

func (pm *ServiceManager) Port(endpoint *corev1.Endpoint) (int, error)

func (*ServiceManager) Reserve

func (pm *ServiceManager) Reserve() error

type Strategy

type Strategy interface {
	Reserve(host string, endpoints []ApplicationEndpoint) (*ApplicationEndpointInstances, error)
}

Jump to

Keyboard shortcuts

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