docks

package
v0.3.12 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2021 License: AGPL-3.0 Imports: 27 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	CraneMsgTypeEnd              = 0
	CraneMsgTypeInfo             = 1
	CraneMsgTypeRequestHubInfo   = 2
	CraneMsgTypeVerify           = 3
	CraneMsgTypeStartEncrypted   = 4
	CraneMsgTypeStartUnencrypted = 5
)
View Source
const (
	LaneLatencyTTL  = 1 * time.Hour
	LaneCapacityTTL = 1 * time.Hour
)
View Source
const (
	CapacityTestOpType = "capacity"
)
View Source
const ExpandOpType string = "expand"
View Source
const (
	LatencyTestOpType = "latency"
)
View Source
const (
	QOTD = "Privacy is not an option, and it shouldn't be the price we accept for just getting on the Internet.\nGary Kovacs\n"
)

Variables

View Source
var (
	CraneStatusStopped int8 = -1
	CraneStatusPrivate int8 = 0
	CraneStatusPublic  int8 = 1
)

Crane Status Options.

View Source
var (
	ErrDone = errors.New("crane is done")
)

Errors.

Functions

func AssignCrane

func AssignCrane(hubID string, crane *Crane)

func GetAllAssignedCranes added in v0.3.5

func GetAllAssignedCranes() map[string]*Crane

func ImportAndVerifyHubInfo added in v0.3.0

func ImportAndVerifyHubInfo(ctx context.Context, hubID string, announcementData, statusData []byte, mapName string, scope hub.Scope) (h *hub.Hub, forward bool, tErr *terminal.Error)

func RegisterCraneUpdateHook added in v0.3.0

func RegisterCraneUpdateHook(fn func(crane *Crane))

RegisterCraneUpdateHook allows the captain to hook into receiving updates for cranes.

Types

type BlockingSubmitQueue added in v0.3.0

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

func NewBlockingSubmitQueue added in v0.3.0

func NewBlockingSubmitQueue(size int) *BlockingSubmitQueue

type BlockingSubmitter added in v0.3.0

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

type CapacityTestOp added in v0.3.11

type CapacityTestOp struct {
	terminal.OpBase
	// contains filtered or unexported fields
}

func NewCapacityTestOp added in v0.3.11

func NewCapacityTestOp(t terminal.OpTerminal) (*CapacityTestOp, *terminal.Error)

func (*CapacityTestOp) Deliver added in v0.3.11

func (op *CapacityTestOp) Deliver(c *container.Container) *terminal.Error

func (*CapacityTestOp) End added in v0.3.11

func (op *CapacityTestOp) End(tErr *terminal.Error)

func (*CapacityTestOp) Result added in v0.3.11

func (op *CapacityTestOp) Result() <-chan *terminal.Error

func (*CapacityTestOp) Type added in v0.3.11

func (op *CapacityTestOp) Type() string

type CapacityTestOptions added in v0.3.11

type CapacityTestOptions struct {
	TestVolume int
}

type Crane

type Crane struct {
	// ID is the ID of the Crane.
	ID string

	// ConnectedHub is the identity of the remote Hub.
	ConnectedHub *hub.Hub

	// Controller is the Crane's Controller Terminal.
	Controller *CraneControllerTerminal
	// contains filtered or unexported fields
}

func GetAssignedCrane

func GetAssignedCrane(hubID string) *Crane

func NewCrane

func NewCrane(ctx context.Context, ship ships.Ship, connectedHub *hub.Hub, id *cabin.Identity) (*Crane, error)

func (*Crane) AbandonTerminal added in v0.3.0

func (crane *Crane) AbandonTerminal(id uint32, err *terminal.Error)

func (*Crane) EstablishNewTerminal added in v0.3.0

func (crane *Crane) EstablishNewTerminal(
	localTerm terminal.TerminalInterface,
	initData *container.Container,
) *terminal.Error

func (*Crane) GetLaneCapacity added in v0.3.11

func (crane *Crane) GetLaneCapacity() int

GetLaneCapacity returns the lane capacity. The capacity is measued in bit/s.

func (*Crane) GetLaneLatency added in v0.3.11

func (crane *Crane) GetLaneLatency() time.Duration

GetLaneLatency returns the lane latency.

func (*Crane) LaneCapacityExpiresAt added in v0.3.11

func (crane *Crane) LaneCapacityExpiresAt() time.Time

LaneCapacityExpiresAt returns when the lane capacity expires and should be updated.

func (*Crane) LaneLatencyExpiresAt added in v0.3.11

func (crane *Crane) LaneLatencyExpiresAt() time.Time

LaneLatencyExpiresAt returns when the lane latency expires and should be updated.

func (*Crane) LocalAddr added in v0.3.0

func (crane *Crane) LocalAddr() net.Addr

func (*Crane) NotifyUpdate added in v0.3.0

func (crane *Crane) NotifyUpdate()

NotifyUpdate calls the registers crane update hook function.

func (*Crane) Public added in v0.3.0

func (crane *Crane) Public() bool

func (*Crane) Publish added in v0.3.0

func (crane *Crane) Publish() error

func (*Crane) RemoteAddr added in v0.3.0

func (crane *Crane) RemoteAddr() net.Addr

func (*Crane) SetLaneCapacity added in v0.3.11

func (crane *Crane) SetLaneCapacity(capacity int)

SetLaneCapacity sets the lane capacity to the given value. The capacity is measued in bit/s.

func (*Crane) SetLaneLatency added in v0.3.11

func (crane *Crane) SetLaneLatency(latency time.Duration)

SetLaneLatency sets the lane latency to the given value.

func (*Crane) Start

func (crane *Crane) Start() error

func (*Crane) Stop

func (crane *Crane) Stop(err *terminal.Error)

func (*Crane) Stopped added in v0.3.11

func (crane *Crane) Stopped() bool

func (*Crane) String added in v0.3.0

func (crane *Crane) String() string

func (*Crane) Transport added in v0.3.7

func (crane *Crane) Transport() *hub.Transport

func (*Crane) VerifyConnectedHub added in v0.3.0

func (crane *Crane) VerifyConnectedHub() error

type CraneControllerTerminal added in v0.3.0

type CraneControllerTerminal struct {
	*terminal.TerminalBase
	*terminal.DuplexFlowQueue

	Crane *Crane
}

func NewLocalCraneControllerTerminal added in v0.3.0

func NewLocalCraneControllerTerminal(
	crane *Crane,
	initMsg *terminal.TerminalOpts,
) (*CraneControllerTerminal, *container.Container, *terminal.Error)

func NewRemoteCraneControllerTerminal added in v0.3.0

func NewRemoteCraneControllerTerminal(
	crane *Crane,
	initData *container.Container,
) (*CraneControllerTerminal, *terminal.TerminalOpts, *terminal.Error)

func (*CraneControllerTerminal) Abandon added in v0.3.0

func (controller *CraneControllerTerminal) Abandon(err *terminal.Error)

func (*CraneControllerTerminal) Deliver added in v0.3.0

func (controller *CraneControllerTerminal) Deliver(c *container.Container) *terminal.Error

func (*CraneControllerTerminal) Flush added in v0.3.11

func (controller *CraneControllerTerminal) Flush()

type CraneTerminal added in v0.3.0

type CraneTerminal struct {
	*terminal.TerminalBase
	*terminal.DuplexFlowQueue
	// contains filtered or unexported fields
}

func NewLocalCraneTerminal added in v0.3.0

func NewLocalCraneTerminal(
	crane *Crane,
	remoteHub *hub.Hub,
	initMsg *terminal.TerminalOpts,
	submitUpstream func(*container.Container),
) (*CraneTerminal, *container.Container, *terminal.Error)

func NewRemoteCraneTerminal added in v0.3.0

func NewRemoteCraneTerminal(
	crane *Crane,
	id uint32,
	initData *container.Container,
) (*CraneTerminal, *terminal.TerminalOpts, *terminal.Error)

func (*CraneTerminal) Abandon added in v0.3.0

func (t *CraneTerminal) Abandon(err *terminal.Error)

func (*CraneTerminal) Deliver added in v0.3.0

func (*CraneTerminal) Flush added in v0.3.11

func (t *CraneTerminal) Flush()

func (*CraneTerminal) IsAbandoned added in v0.3.0

func (t *CraneTerminal) IsAbandoned() bool

func (*CraneTerminal) LocalAddr added in v0.3.0

func (t *CraneTerminal) LocalAddr() net.Addr

func (*CraneTerminal) RemoteAddr added in v0.3.0

func (t *CraneTerminal) RemoteAddr() net.Addr

func (*CraneTerminal) Transport added in v0.3.7

func (t *CraneTerminal) Transport() *hub.Transport

type ExpandOp added in v0.3.0

type ExpandOp struct {
	terminal.OpBase

	*terminal.DuplexFlowQueue
	// contains filtered or unexported fields
}

func (*ExpandOp) Abandon added in v0.3.0

func (op *ExpandOp) Abandon(err *terminal.Error)

func (*ExpandOp) Ctx added in v0.3.0

func (op *ExpandOp) Ctx() context.Context

func (*ExpandOp) End added in v0.3.0

func (op *ExpandOp) End(err *terminal.Error)

func (*ExpandOp) FmtID added in v0.3.0

func (op *ExpandOp) FmtID() string

func (*ExpandOp) Type added in v0.3.0

func (op *ExpandOp) Type() string

type ExpansionRelayTerminal added in v0.3.0

type ExpansionRelayTerminal struct {
	*terminal.DuplexFlowQueue
	// contains filtered or unexported fields
}

func (*ExpansionRelayTerminal) Abandon added in v0.3.0

func (t *ExpansionRelayTerminal) Abandon(err *terminal.Error)

func (*ExpansionRelayTerminal) Ctx added in v0.3.0

func (*ExpansionRelayTerminal) FmtID added in v0.3.0

func (t *ExpansionRelayTerminal) FmtID() string

func (*ExpansionRelayTerminal) ID added in v0.3.0

type ExpansionTerminal added in v0.3.0

type ExpansionTerminal struct {
	*terminal.TerminalBase
	*terminal.DuplexFlowQueue
	// contains filtered or unexported fields
}

func ExpandTo added in v0.3.0

func ExpandTo(t terminal.OpTerminal, routeTo string, encryptFor *hub.Hub) (*ExpansionTerminal, *terminal.Error)

func (*ExpansionTerminal) Abandon added in v0.3.0

func (t *ExpansionTerminal) Abandon(err *terminal.Error)

func (*ExpansionTerminal) Deliver added in v0.3.0

func (*ExpansionTerminal) End added in v0.3.0

func (t *ExpansionTerminal) End(err *terminal.Error)

func (*ExpansionTerminal) Flush added in v0.3.11

func (t *ExpansionTerminal) Flush()

func (*ExpansionTerminal) FmtID added in v0.3.0

func (t *ExpansionTerminal) FmtID() string

func (*ExpansionTerminal) HasEnded added in v0.3.0

func (t *ExpansionTerminal) HasEnded(end bool) bool

func (*ExpansionTerminal) ID added in v0.3.0

func (t *ExpansionTerminal) ID() uint32

func (*ExpansionTerminal) IsAbandoned added in v0.3.0

func (t *ExpansionTerminal) IsAbandoned() bool

func (*ExpansionTerminal) SetChangeNotifyFunc added in v0.3.7

func (t *ExpansionTerminal) SetChangeNotifyFunc(f func())

func (*ExpansionTerminal) SetID added in v0.3.0

func (t *ExpansionTerminal) SetID(id uint32)

func (*ExpansionTerminal) Type added in v0.3.0

func (t *ExpansionTerminal) Type() string

type LatencyTestClientOp added in v0.3.11

type LatencyTestClientOp struct {
	LatencyTestOp
	// contains filtered or unexported fields
}

func NewLatencyTestOp added in v0.3.11

func NewLatencyTestOp(t terminal.OpTerminal) (*LatencyTestClientOp, *terminal.Error)

func (*LatencyTestClientOp) Deliver added in v0.3.11

func (*LatencyTestClientOp) End added in v0.3.11

func (op *LatencyTestClientOp) End(tErr *terminal.Error)

func (*LatencyTestClientOp) Result added in v0.3.11

func (op *LatencyTestClientOp) Result() <-chan *terminal.Error

type LatencyTestOp added in v0.3.11

type LatencyTestOp struct {
	terminal.OpBase
	// contains filtered or unexported fields
}

func (*LatencyTestOp) Deliver added in v0.3.11

func (op *LatencyTestOp) Deliver(c *container.Container) *terminal.Error

func (*LatencyTestOp) End added in v0.3.11

func (op *LatencyTestOp) End(tErr *terminal.Error)

func (*LatencyTestOp) Type added in v0.3.11

func (op *LatencyTestOp) Type() string

Jump to

Keyboard shortcuts

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