Documentation ¶
Index ¶
- Constants
- Variables
- func AddToDebugInfo(di *debug.Info)
- func ClientReady() bool
- func EstablishCrane(callerCtx context.Context, dst *hub.Hub) (*docks.Crane, error)
- func EstablishPublicLane(ctx context.Context, dst *hub.Hub) (*docks.Crane, *terminal.Error)
- func GetDNSExitHubPolicy() (endpoints.Endpoints, error)
- func IsExcepted(ip net.IP) bool
- func TriggerHubStatusMaintenance()
- type BootstrapFile
- type BootstrapFileEntry
- type GossipMsgType
- type GossipOp
- type GossipQueryOp
- type PublishOp
- type SPNStatus
- type SPNStatusName
Constants ¶
const GossipOpType string = "gossip"
GossipOpType is the type ID of the gossip operation.
const GossipQueryOpType string = "gossip/query"
GossipQueryOpType is the type ID of the gossip query operation.
const PublishOpType string = "publish"
PublishOpType is the type ID of the publish operation.
const SPNConnectedEvent = "spn connect"
SPNConnectedEvent is the name of the event that is fired when the SPN has connected and is ready.
Variables ¶
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" )
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") )
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
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
EstablishCrane establishes a crane to another Hub.
func EstablishPublicLane ¶ added in v0.3.0
EstablishPublicLane establishes a crane to another Hub and publishes it.
func GetDNSExitHubPolicy ¶ added in v0.4.3
GetDNSExitHubPolicy return the current DNS exit policy.
func IsExcepted ¶ added in v0.3.0
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) HandleStop ¶ added in v0.6.0
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.
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) HandleStop ¶ added in v0.6.0
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.
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.