captain

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: AGPL-3.0 Imports: 48 Imported by: 3

Documentation

Index

Constants

View Source
const GossipOpType string = "gossip"

GossipOpType is the type ID of the gossip operation.

View Source
const GossipQueryOpType string = "gossip/query"

GossipQueryOpType is the type ID of the gossip query operation.

View Source
const PublishOpType string = "publish"

PublishOpType is the type ID of the publish operation.

View Source
const SPNConnectedEvent = "spn connect"

SPNConnectedEvent is the name of the event that is fired when the SPN has connected and is ready.

Variables

View Source
var (
	// CfgOptionEnableSPNKey is the configuration key for the SPN module.
	CfgOptionEnableSPNKey = "spn/enable"

	// CfgOptionHomeHubPolicyKey is the configuration key for the SPN home policy.
	CfgOptionHomeHubPolicyKey = "spn/homePolicy"

	// CfgOptionDNSExitHubPolicyKey is the configuration key for the SPN DNS exit policy.
	CfgOptionDNSExitHubPolicyKey = "spn/dnsExitPolicy"

	// CfgOptionUseCommunityNodesKey is the configuration key for whether to use community nodes.
	CfgOptionUseCommunityNodesKey = "spn/useCommunityNodes"

	// NonCommunityVerifiedOwners holds a list of verified owners that are not
	// considered "community".
	NonCommunityVerifiedOwners = []string{"Safing"}

	// CfgOptionTrustNodeNodesKey is the configuration key for whether additional trusted nodes.
	CfgOptionTrustNodeNodesKey = "spn/trustNodes"
)
View Source
var (
	// ErrAllHomeHubsExcluded is returned when all available home hubs were excluded.
	ErrAllHomeHubsExcluded = errors.New("all home hubs are excluded")

	// ErrReInitSPNSuggested is returned when no home hub can be found, even without rules.
	ErrReInitSPNSuggested = errors.New("SPN re-init suggested")
)
View Source
var DisableAccount bool

DisableAccount disables using any account related SPN functionality. Attempts to use the same will result in errors.

Functions

func AddToDebugInfo added in v0.4.4

func AddToDebugInfo(di *debug.Info)

AddToDebugInfo adds the SPN status to the given debug.Info.

func ClientReady

func ClientReady() bool

ClientReady signifies if the SPN client is fully ready to handle connections.

func EstablishCrane added in v0.3.0

func EstablishCrane(callerCtx context.Context, dst *hub.Hub) (*docks.Crane, error)

EstablishCrane establishes a crane to another Hub.

func EstablishPublicLane added in v0.3.0

func EstablishPublicLane(ctx context.Context, dst *hub.Hub) (*docks.Crane, *terminal.Error)

EstablishPublicLane establishes a crane to another Hub and publishes it.

func GetDNSExitHubPolicy added in v0.4.3

func GetDNSExitHubPolicy() (endpoints.Endpoints, error)

GetDNSExitHubPolicy return the current DNS exit policy.

func IsExcepted added in v0.3.0

func IsExcepted(ip net.IP) bool

IsExcepted checks if the given IP is currently excepted from the SPN.

func TriggerHubStatusMaintenance added in v0.6.1

func TriggerHubStatusMaintenance()

TriggerHubStatusMaintenance queues the Hub status update task to be executed.

Types

type BootstrapFile

type BootstrapFile struct {
	Main BootstrapFileEntry
}

BootstrapFile is used for sideloading bootstrap data.

type BootstrapFileEntry added in v0.3.0

type BootstrapFileEntry struct {
	Hubs []string
}

BootstrapFileEntry is the bootstrap data structure for one map.

type GossipMsgType added in v0.3.0

type GossipMsgType uint8

GossipMsgType is the gossip message type.

const (
	GossipHubAnnouncementMsg GossipMsgType = 1
	GossipHubStatusMsg       GossipMsgType = 2
)

Gossip Message Types.

func (GossipMsgType) String added in v0.3.0

func (msgType GossipMsgType) String() string

type GossipOp added in v0.3.0

type GossipOp struct {
	terminal.OperationBase
	// contains filtered or unexported fields
}

GossipOp is used to gossip Hub messages.

func NewGossipOp added in v0.3.0

func NewGossipOp(controller *docks.CraneControllerTerminal) (*GossipOp, *terminal.Error)

NewGossipOp start a new gossip operation.

func (*GossipOp) Deliver added in v0.3.0

func (op *GossipOp) Deliver(msg *terminal.Msg) *terminal.Error

Deliver delivers a message to the operation.

func (*GossipOp) HandleStop added in v0.6.0

func (op *GossipOp) HandleStop(err *terminal.Error) (errorToSend *terminal.Error)

HandleStop gives the operation the ability to cleanly shut down. The returned error is the error to send to the other side. Should never be called directly. Call Stop() instead.

func (*GossipOp) Type added in v0.3.0

func (op *GossipOp) Type() string

Type returns the type ID.

type GossipQueryOp added in v0.3.0

type GossipQueryOp struct {
	terminal.OperationBase
	// contains filtered or unexported fields
}

GossipQueryOp is used to query gossip messages.

func NewGossipQueryOp added in v0.3.0

func NewGossipQueryOp(t terminal.Terminal) (*GossipQueryOp, *terminal.Error)

NewGossipQueryOp starts a new gossip query operation.

func (*GossipQueryOp) Deliver added in v0.3.0

func (op *GossipQueryOp) Deliver(msg *terminal.Msg) *terminal.Error

Deliver delivers the message to the operation.

func (*GossipQueryOp) HandleStop added in v0.6.0

func (op *GossipQueryOp) HandleStop(err *terminal.Error) (errorToSend *terminal.Error)

HandleStop gives the operation the ability to cleanly shut down. The returned error is the error to send to the other side. Should never be called directly. Call Stop() instead.

func (*GossipQueryOp) Type added in v0.3.0

func (op *GossipQueryOp) Type() string

Type returns the type ID.

type PublishOp added in v0.3.0

type PublishOp struct {
	terminal.OperationBase
	// contains filtered or unexported fields
}

PublishOp is used to publish a connection.

func NewPublishOp added in v0.3.0

func NewPublishOp(controller *docks.CraneControllerTerminal, identity *cabin.Identity) (*PublishOp, *terminal.Error)

NewPublishOp start a new publish operation.

func (*PublishOp) Deliver added in v0.3.0

func (op *PublishOp) Deliver(msg *terminal.Msg) *terminal.Error

Deliver delivers a message to the operation.

func (*PublishOp) HandleStop added in v0.6.0

func (op *PublishOp) HandleStop(tErr *terminal.Error) (errorToSend *terminal.Error)

HandleStop gives the operation the ability to cleanly shut down. The returned error is the error to send to the other side. Should never be called directly. Call Stop() instead.

func (*PublishOp) Result added in v0.3.0

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

Result returns the result (end error) of the operation.

func (*PublishOp) Type added in v0.3.0

func (op *PublishOp) Type() string

Type returns the type ID.

type SPNStatus added in v0.3.7

type SPNStatus struct {
	record.Base
	sync.Mutex

	Status             SPNStatusName
	HomeHubID          string
	HomeHubName        string
	ConnectedIP        string
	ConnectedTransport string
	ConnectedCountry   *geoip.CountryInfo
	ConnectedSince     *time.Time
}

SPNStatus holds SPN status information.

func GetSPNStatus added in v0.4.12

func GetSPNStatus() *SPNStatus

GetSPNStatus returns the current SPN status.

type SPNStatusName added in v0.3.7

type SPNStatusName string

SPNStatusName is a SPN status.

const (
	StatusFailed     SPNStatusName = "failed"
	StatusDisabled   SPNStatusName = "disabled"
	StatusConnecting SPNStatusName = "connecting"
	StatusConnected  SPNStatusName = "connected"
)

SPN Stati.

Jump to

Keyboard shortcuts

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