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 Captain
- 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 ¶
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 ¶
EstablishCrane establishes a crane to another Hub.
func EstablishPublicLane ¶
EstablishPublicLane establishes a crane to another Hub and publishes it.
func GetDNSExitHubPolicy ¶
GetDNSExitHubPolicy return the current DNS exit policy.
func IsExcepted ¶
IsExcepted checks if the given IP is currently excepted from the SPN.
func TriggerHubStatusMaintenance ¶
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 ¶
type BootstrapFileEntry struct {
Hubs []string
}
BootstrapFileEntry is the bootstrap data structure for one map.
type Captain ¶ added in v1.6.19
type Captain struct { EventSPNConnected *mgr.EventMgr[struct{}] // contains filtered or unexported fields }
Captain is the main module of the SPN.
type GossipMsgType ¶
type GossipMsgType uint8
GossipMsgType is the gossip message type.
const ( GossipHubAnnouncementMsg GossipMsgType = 1 GossipHubStatusMsg GossipMsgType = 2 )
Gossip Message Types.
func (GossipMsgType) String ¶
func (msgType GossipMsgType) String() string
type GossipOp ¶
type GossipOp struct { terminal.OperationBase // contains filtered or unexported fields }
GossipOp is used to gossip Hub messages.
func NewGossipOp ¶
func NewGossipOp(controller *docks.CraneControllerTerminal) (*GossipOp, *terminal.Error)
NewGossipOp start a new gossip operation.
func (*GossipOp) HandleStop ¶
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 ¶
type GossipQueryOp struct { terminal.OperationBase // contains filtered or unexported fields }
GossipQueryOp is used to query gossip messages.
func NewGossipQueryOp ¶
func NewGossipQueryOp(t terminal.Terminal) (*GossipQueryOp, *terminal.Error)
NewGossipQueryOp starts a new gossip query operation.
func (*GossipQueryOp) Deliver ¶
func (op *GossipQueryOp) Deliver(msg *terminal.Msg) *terminal.Error
Deliver delivers the message to the operation.
func (*GossipQueryOp) HandleStop ¶
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.
type PublishOp ¶
type PublishOp struct { terminal.OperationBase // contains filtered or unexported fields }
PublishOp is used to publish a connection.
func NewPublishOp ¶
func NewPublishOp(controller *docks.CraneControllerTerminal, identity *cabin.Identity) (*PublishOp, *terminal.Error)
NewPublishOp start a new publish operation.
func (*PublishOp) HandleStop ¶
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 ¶
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.
type SPNStatusName ¶
type SPNStatusName string
SPNStatusName is a SPN status.
const ( StatusFailed SPNStatusName = "failed" StatusDisabled SPNStatusName = "disabled" StatusConnecting SPNStatusName = "connecting" StatusConnected SPNStatusName = "connected" )
SPN Stati.