domain

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addr

type Addr struct {
	Host string `json:"host"`
	Port Port   `json:"port"`
}

Addr contains ip and port.

func HTTPAddr

func HTTPAddr(host string) Addr

HTTPAddr create an Addr object that points to HTTP port.

func LocalAddr

func LocalAddr(port Port) Addr

LocalAddr create an Addr object that points to localhost.

func NewAddr

func NewAddr(host string, port Port) Addr

NewAddr creates a new Addr object.

func (*Addr) IsValid

func (a *Addr) IsValid() bool

IsValid returned true if the Addr object is valid.

func (*Addr) String

func (a *Addr) String() string

type Container

type Container struct {
	ID           string
	Name         string
	Platform     ContainerPlatform
	Labels       map[string]string
	Networks     []ContainerNetwork
	PortBindings map[Port][]Port
}

Container contains meta data of a container.

type ContainerEvent

type ContainerEvent struct {
	Type      ContainerEventType
	Container Container
	Error     error
}

ContainerEvent contains event type and subject container meta data.

type ContainerEventType

type ContainerEventType int

ContainerEventType represents container lifecycle events, such as "created".

const (
	ContainerEventCreated ContainerEventType = iota
	ContainerEventDestroyed
)

Enum values of ContainerEventType.

type ContainerNetwork

type ContainerNetwork struct {
	Name string
}

ContainerNetwork contains meta data of a container network.

type ContainerPlatform

type ContainerPlatform int

ContainerPlatform represents each container implementation, such as "docker".

const (
	ContainerPlatformUnknown ContainerPlatform = iota
	ContainerPlatformDocker
)

Enum values of ContainerPlatform.

func (ContainerPlatform) String

func (p ContainerPlatform) String() string

type ContainerRepository

type ContainerRepository interface {
	ListenEvent(context.Context) (<-chan ContainerEvent, <-chan error)
}

ContainerRepository is an interface for accessing containers.

type Mapping

type Mapping struct {
	Host        string      `json:"host"`
	PortAddrMap PortAddrMap `json:"map"`
}

Mapping represents <hostname>:<port> - <local IP>:<port> map.

func (*Mapping) Map

func (m *Mapping) Map(port Port) Addr

Map returns an Addr mapped on the given port.

type MappingEvent

type MappingEvent struct {
	Type MappingEventType
	Mapping
}

MappingEvent contains event type and subject mapping.

type MappingEventType

type MappingEventType int

MappingEventType represents mapping lifecycle events, such as "created".

const (
	MappingEventCreated MappingEventType = iota
	MappingEventDestroyed
)

Enum values of MappingEventType.

type MappingRepository

type MappingRepository interface {
	List(ctx context.Context) ([]*Mapping, error)
	HasHost(ctx context.Context, host string) (bool, error)
	MapAddr(ctx context.Context, addr Addr) (Addr, error)
	Create(ctx context.Context, mapping *Mapping) error
	DeleteByHost(ctx context.Context, host string) error
	ListenEvent(ctx context.Context) (<-chan MappingEvent, <-chan error)
}

MappingRepository is an interface for accessing <hostname>-<port> mappings.

type Port

type Port uint16

Port represents port number.

func PortFromString

func PortFromString(str string) (Port, error)

PortFromString returns a Port object from the given string.

type PortAddrMap

type PortAddrMap map[Port]Addr

PortAddrMap is mapping of ports and addresses.

Jump to

Keyboard shortcuts

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