network

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIInt added in v0.1.20

func APIInt(api string) int

func ExtractEndpointEnvironmentVariables added in v0.1.18

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

ExtractEndpointEnvironmentVariables converts NetworkMapping endpoint data to environment variables

func ExtractRestRoutesEnvironmentVariables added in v0.1.18

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

ExtractRestRoutesEnvironmentVariables converts NetworkMapping endpoint REST data to environment variables

func GetAllLocalIPs added in v0.1.20

func GetAllLocalIPs() ([]string, error)

func HashInt added in v0.1.20

func HashInt(s string, low, high int) int

func LocalizeMapping added in v0.0.91

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

func LocalizeMappings added in v0.0.91

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

func MappingAsString added in v0.0.81

func MappingAsString(mapping *basev0.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 ToPort added in v0.1.20

func ToPort(app string, svc string, api string) int

ToPort strategy: APP-SVC-API Between 1100(0) and 4999(9) First 11 -> 49: hash app Next 0 -> 99: hash svc Last Digit: API 0: TCP 1: HTTP/ REST 2: gRPC

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 []*basev0.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 []*basev0.NetworkMapping) MappingSummary

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) ([]*basev0.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