Documentation ¶
Index ¶
- Constants
- Variables
- func AssignCrane(hubID string, crane *Crane)
- func EstablishRoute(id *cabin.Identity, dst *hub.Hub)
- func GetAllControllers() map[string]*CraneController
- func LaunchShip(ctx context.Context, h *hub.Hub, transport *hub.Transport, ip net.IP) (ships.Ship, error)
- func RegisterCraneHooks(announcement, status, publish, discontinue craneHookFunc)
- func RetractCraneByDestination(hubID string)
- func RetractCraneByID(craneID string) (connectedHub *hub.Hub)
- type API
- func (portAPI *API) Echo(data []byte) ([]byte, error)
- func (portAPI *API) Hop(version int, dst *hub.Hub) (*API, error)
- func (portAPI *API) Info() (*info.Info, error)
- func (portAPI *API) PublicHubFeed() *api.Call
- func (portAPI *API) Tunnel(domain string, ip net.IP, protocol packet.IPProtocol, port uint16) (tunnel *api.Call, err error)
- func (portAPI *API) UserAuth(code *access.Code) error
- type Conveyor
- type ConveyorBase
- type ConveyorLine
- type Crane
- type CraneController
- func (cControl *CraneController) CheckAllLineSpaces()
- func (cControl *CraneController) Handle(c *container.Container) error
- func (cControl *CraneController) NewLine(version int) (*ConveyorLine, error)
- func (cControl *CraneController) PublishConnection() error
- func (cControl *CraneController) SendHubAnnouncement(msg []byte)
- func (cControl *CraneController) SendHubStatus(msg []byte)
- type EncryptionConveyor
- type HubRelay
- type LastConveyor
- type LastConveyorBase
- type SimpleConveyorLine
- type TunnelRequest
Constants ¶
const ( HubFeedAnnouncement = 1 HubFeedStatus = 2 HubFeedDistrust = 3 // TODO )
const ( // Informational MsgTypeInfo uint8 = 1 MsgTypeLoad uint8 = 2 MsgTypeStats uint8 = 3 MsgTypePublicHubFeed uint8 = 4 // Diagnostics MsgTypeEcho uint8 = 16 MsgTypeSpeedtest uint8 = 17 // User Access MsgTypeUserAuth uint8 = 32 // Tunneling MsgTypeHop uint8 = 40 MsgTypeTunnel uint8 = 41 MsgTypePing uint8 = 42 // Admin/Mod Access MsgTypeAdminAuth uint8 = 64 // Mgmt MsgTypeEstablishRoute uint8 = 72 MsgTypeShutdown uint8 = 73 )
Message type constants
const ( CONV_MONKEY uint8 = 0 CONV_MUX uint8 = 1 )
const ( CraneMsgTypeNewLine uint8 = 1 CraneMsgTypeDiscardLine uint8 = 2 CraneMsgTypeAddLineSpace uint8 = 3 CraneMsgTypeHubAnnouncement uint8 = 4 CraneMsgTypeHubStatus uint8 = 5 CraneMsgTypeVerification uint8 = 6 CraneMsgTypePublishConnection uint8 = 7 CraneMsgError uint8 = 8 CraneMsgClose uint8 = 9 )
const ( BackOffStart = 32 * time.Microsecond BackOffLimit = 100 * time.Millisecond )
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 ¶
var ( CraneStatusStopped int8 = -1 CraneStatusPrivate int8 = 0 CraneStatusPublishRequested int8 = 1 CraneStatusPublishVerifying int8 = 2 CraneStatusPublished int8 = 3 )
Crane Status Options
var (
ErrInternalError = errors.New("internal error")
)
Functions ¶
func AssignCrane ¶
func GetAllControllers ¶
func GetAllControllers() map[string]*CraneController
func LaunchShip ¶
func RegisterCraneHooks ¶
func RegisterCraneHooks(announcement, status, publish, discontinue craneHookFunc)
RegisterCraneHooks allows the manager to hook into important crane functions without creating an import loop
func RetractCraneByDestination ¶
func RetractCraneByDestination(hubID string)
func RetractCraneByID ¶
Types ¶
type API ¶
API provides the interface that nodes communicate with
func NewClient ¶
NewClient is used to create the initial hop to a node and returns a new Port17 API.
func (*API) Hop ¶
Hop creates a new connection from the connected node to another one and returns a new Port17 API instance for that node.
func (*API) PublicHubFeed ¶
type Conveyor ¶
type Conveyor interface { AttachConveyorBelts(lineID string, fromShip, toShip, fromShore, toShore chan *container.Container) Run() }
Conveyor transports and processes containers between the ship (with its crane) to the shore.
type ConveyorBase ¶
type ConveyorBase struct {
// contains filtered or unexported fields
}
ConveyorBase provides basic functionality for the Conveyor interface.
func (*ConveyorBase) AttachConveyorBelts ¶
func (cb *ConveyorBase) AttachConveyorBelts(lineID string, fromShip, toShip, fromShore, toShore chan *container.Container)
AttachConveyorBelts attaches the Conveyor to a line.
type ConveyorLine ¶
type ConveyorLine struct { ID uint32 // contains filtered or unexported fields }
func NewConveyorLine ¶
func NewConveyorLine(crane *Crane, lineID uint32) (*ConveyorLine, error)
func (*ConveyorLine) AddConveyor ¶
func (line *ConveyorLine) AddConveyor(conveyor Conveyor)
func (*ConveyorLine) AddLastConveyor ¶
func (line *ConveyorLine) AddLastConveyor(conveyor LastConveyor)
type Crane ¶
type Crane struct { ID string ConnectedHub *hub.Hub // controller Controller *CraneController // contains filtered or unexported fields }
func GetAssignedCrane ¶
type CraneController ¶
type CraneController struct { Crane *Crane ConnectedHubVerified *abool.AtomicBool Publishing *abool.AtomicBool // contains filtered or unexported fields }
func NewCraneController ¶
func NewCraneController(crane *Crane, send chan *container.Container) *CraneController
func (*CraneController) CheckAllLineSpaces ¶
func (cControl *CraneController) CheckAllLineSpaces()
func (*CraneController) Handle ¶
func (cControl *CraneController) Handle(c *container.Container) error
func (*CraneController) NewLine ¶
func (cControl *CraneController) NewLine(version int) (*ConveyorLine, error)
func (*CraneController) PublishConnection ¶
func (cControl *CraneController) PublishConnection() error
func (*CraneController) SendHubAnnouncement ¶
func (cControl *CraneController) SendHubAnnouncement(msg []byte)
func (*CraneController) SendHubStatus ¶
func (cControl *CraneController) SendHubStatus(msg []byte)
type EncryptionConveyor ¶
type EncryptionConveyor struct { ConveyorBase // contains filtered or unexported fields }
func NewEncryptionConveyor ¶
func (*EncryptionConveyor) Run ¶
func (ec *EncryptionConveyor) Run()
type HubRelay ¶
type HubRelay struct { LastConveyorBase // contains filtered or unexported fields }
type LastConveyor ¶
type LastConveyor interface { AttachConveyorBelts(lineID string, fromShip, toShip chan *container.Container) Run() }
LastConveyor is the last processing step to handle containers.
type LastConveyorBase ¶
type LastConveyorBase struct {
// contains filtered or unexported fields
}
LastConveyorBase provides basic functionality for the Conveyor interface.
func (*LastConveyorBase) AttachConveyorBelts ¶
func (cb *LastConveyorBase) AttachConveyorBelts(lineID string, fromShip, toShip chan *container.Container)
AttachConveyorBelts attaches the Conveyor to a line.
func (*LastConveyorBase) Run ¶
func (cb *LastConveyorBase) Run()
type SimpleConveyorLine ¶
type SimpleConveyorLine struct { ID string // contains filtered or unexported fields }
func NewSimpleConveyorLine ¶
func NewSimpleConveyorLine() *SimpleConveyorLine
func (*SimpleConveyorLine) AddConveyor ¶
func (line *SimpleConveyorLine) AddConveyor(conveyor Conveyor)
func (*SimpleConveyorLine) AddLastConveyor ¶
func (line *SimpleConveyorLine) AddLastConveyor(conveyor LastConveyor)
type TunnelRequest ¶
func (*TunnelRequest) Address ¶
func (request *TunnelRequest) Address() string
func (*TunnelRequest) Network ¶
func (request *TunnelRequest) Network() string
func (*TunnelRequest) String ¶
func (request *TunnelRequest) String() string