network

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractEndpointEnvironmentVariables added in v0.1.18

func ExtractEndpointEnvironmentVariables(ctx context.Context, nets []*runtimev0.NetworkMapping) ([]string, error)

ExtractEndpointEnvironmentVariables converts NetworkMapping endpoint data to environment variables

func ExtractRestRoutesEnvironmentVariables added in v0.1.18

func ExtractRestRoutesEnvironmentVariables(ctx context.Context, nets []*runtimev0.NetworkMapping) ([]string, error)

ExtractRestRoutesEnvironmentVariables converts NetworkMapping endpoint REST data to environment variables

func GetFreePorts

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

GetFreePorts returns a slice of n free ports

func LocalizeMapping added in v0.0.91

func LocalizeMapping(mapping *runtimev0.NetworkMapping, local string) *runtimev0.NetworkMapping

func LocalizeMappings added in v0.0.91

func LocalizeMappings(nm []*runtimev0.NetworkMapping, local string) []*runtimev0.NetworkMapping

func MappingAsString added in v0.0.81

func MappingAsString(mapping *runtimev0.NetworkMapping) string

func ToDNS added in v0.0.51

func ToDNS(e *basev0.Endpoint) string

func ToEndpoint

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

func ToUnique

func ToUnique(endpoint *basev0.Endpoint) string

Types

type Address

type Address struct {
	Host string
	Port int
}

type ApplicationEndpoint

type ApplicationEndpoint struct {
	Service     string
	Application string
	Namespace   string
	Endpoint    *basev0.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 *basev0.Endpoint) *Address

func (*ApplicationEndpointInstances) First

type DNS

type DNS struct{}

type FixedStrategy

type FixedStrategy struct{}

func (FixedStrategy) Reserve

type MappingInstance added in v0.1.16

type MappingInstance struct {
	Address string
	Port    int
}

func Instance added in v0.1.16

func Instance(mappings []*runtimev0.NetworkMapping) (*MappingInstance, error)

type MappingSummary added in v0.0.81

type MappingSummary struct {
	Count    int
	Mappings []string
}

func MakeNetworkMappingSummary added in v0.0.81

func MakeNetworkMappingSummary(mappings []*runtimev0.NetworkMapping) MappingSummary

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 added in v0.0.51

func NewServiceDNSManager(_ context.Context, endpoints ...*basev0.Endpoint) (*ServiceManager, error)

func NewServiceManager

func NewServiceManager(endpoints ...*basev0.Endpoint) *ServiceManager

func NewServicePortManager

func NewServicePortManager(_ context.Context) (*ServiceManager, error)

func (*ServiceManager) ApplicationEndpointInstance

func (pm *ServiceManager) ApplicationEndpointInstance(ctx context.Context, endpoint *basev0.Endpoint) (*ApplicationEndpointInstance, error)

func (*ServiceManager) ApplicationEndpointInstances

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

func (*ServiceManager) Bind

func (pm *ServiceManager) Bind(ctx context.Context, endpoint *basev0.Endpoint, portBinding string) error

func (*ServiceManager) Expose

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

func (*ServiceManager) NetworkMapping

func (pm *ServiceManager) NetworkMapping(context.Context) ([]*runtimev0.NetworkMapping, error)

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

func (*ServiceManager) Port

func (pm *ServiceManager) Port(ctx context.Context, endpoint *basev0.Endpoint) (int, error)

func (*ServiceManager) Reserve

func (pm *ServiceManager) Reserve(ctx context.Context) error

type Strategy

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

Jump to

Keyboard shortcuts

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