bootstrap

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2018 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Accepted = Code(iota + 1)
	Rejected
	Redirected
)

Variables

This section is empty.

Functions

func FindDiscovery

func FindDiscovery(cert core.Certificate, ref core.RecordRef) core.DiscoveryNode

func GenerateShortID

func GenerateShortID(keeper network.NodeKeeper, nodeID core.RecordRef) core.ShortNodeID

GenerateShortID correct ShortID of the node so it does not conflict with existing active node list

func RemoveOrigin

func RemoveOrigin(discoveryNodes []core.DiscoveryNode, origin core.RecordRef) ([]core.DiscoveryNode, error)

func Xor

func Xor(first, second []byte) []byte

Types

type AuthorizationController

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

AuthorizationController is intended

func NewAuthorizationController

func NewAuthorizationController(options *common.Options, transport network.InternalTransport, sessionManager *SessionManager) *AuthorizationController

func (*AuthorizationController) Authorize

func (ac *AuthorizationController) Authorize(ctx context.Context, discoveryNode *DiscoveryNode, certificate core.Certificate) (SessionID, error)

Authorize node on the discovery node (step 2 of the bootstrap process)

func (*AuthorizationController) Register

func (ac *AuthorizationController) Register(ctx context.Context, discoveryNode *DiscoveryNode, sessionID SessionID) error

Register node on the discovery node (step 4 of the bootstrap process)

func (*AuthorizationController) Start

func (ac *AuthorizationController) Start(networkCoordinator core.NetworkCoordinator, nodeKeeper network.NodeKeeper)

type AuthorizationRequest

type AuthorizationRequest struct {
	Certificate core.Certificate
}

AuthorizationRequest

type AuthorizationResponse

type AuthorizationResponse struct {
	Code      OperationCode
	Error     string
	SessionID SessionID
}

AuthorizationResponse

type Bootstrapper

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

func NewBootstrapper

func NewBootstrapper(options *common.Options, certificate core.Certificate, transport network.InternalTransport) *Bootstrapper

func (*Bootstrapper) Bootstrap

func (bc *Bootstrapper) Bootstrap(ctx context.Context) (*DiscoveryNode, error)

Bootstrap on the discovery node (step 1 of the bootstrap process)

func (*Bootstrapper) BootstrapDiscovery

func (bc *Bootstrapper) BootstrapDiscovery(ctx context.Context) error

func (*Bootstrapper) Start

func (bc *Bootstrapper) Start(keeper network.NodeKeeper)

type ChallengePayload

type ChallengePayload struct {
	// CurrentPulse  core.Pulse
	// State         core.NetworkState
	AssignShortID core.ShortNodeID
}

type ChallengeRequest

type ChallengeRequest struct {
	SessionID SessionID

	Nonce Nonce
}

type ChallengeResponse

type ChallengeResponse struct {
	Header  ChallengeResponseHeader
	Payload *ChallengePayload
}

type ChallengeResponseController

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

func NewChallengeResponseController

func NewChallengeResponseController(options *common.Options, transport network.InternalTransport,
	sessionManager *SessionManager) *ChallengeResponseController

func (*ChallengeResponseController) Execute

func (cr *ChallengeResponseController) Execute(ctx context.Context, discoveryNode *DiscoveryNode, sessionID SessionID) (*ChallengePayload, error)

Execute double challenge response between the node and the discovery node (step 3 of the bootstrap process)

func (*ChallengeResponseController) Start

type ChallengeResponseHeader

type ChallengeResponseHeader struct {
	Success bool
	Error   string
}

type Code

type Code uint8

type DiscoveryNode

type DiscoveryNode struct {
	Host *host.Host
	Node core.DiscoveryNode
}

type GenesisRequest

type GenesisRequest struct {
	Certificate core.Certificate
}

type GenesisResponse

type GenesisResponse struct {
	Discovery core.Node
	Error     string
}

type NetworkBootstrapper

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

func NewNetworkBootstrapper

func NewNetworkBootstrapper(options *common.Options, cert core.Certificate, transport network.InternalTransport) *NetworkBootstrapper

func (*NetworkBootstrapper) Bootstrap

func (nb *NetworkBootstrapper) Bootstrap(ctx context.Context) error

func (*NetworkBootstrapper) Start

func (nb *NetworkBootstrapper) Start(cryptographyService core.CryptographyService,
	networkCoordinator core.NetworkCoordinator, nodeKeeper network.NodeKeeper)

type NodeBootstrapRequest

type NodeBootstrapRequest struct{}

type NodeBootstrapResponse

type NodeBootstrapResponse struct {
	Code         Code
	RedirectHost string
	RejectReason string
}

type Nonce

type Nonce []byte

func GenerateNonce

func GenerateNonce() (Nonce, error)

type OperationCode

type OperationCode uint8
const (
	OpConfirmed OperationCode = iota + 1
	OpRejected
)

type RegistrationRequest

type RegistrationRequest struct {
	SessionID SessionID
	JoinClaim *packets.NodeJoinClaim
}

RegistrationRequest

type RegistrationResponse

type RegistrationResponse struct {
	Code  OperationCode
	Error string
}

RegistrationResponse

type Session

type Session struct {
	NodeID core.RecordRef
	Cert   core.Certificate
	State  SessionState

	DiscoveryNonce Nonce
}

type SessionID

type SessionID uint64

type SessionManager

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

func NewSessionManager

func NewSessionManager() *SessionManager

func (*SessionManager) ChallengePassed

func (sm *SessionManager) ChallengePassed(id SessionID) error

func (*SessionManager) CheckSession

func (sm *SessionManager) CheckSession(id SessionID, expected SessionState) error

func (*SessionManager) GetChallengeData

func (sm *SessionManager) GetChallengeData(id SessionID) (core.Certificate, Nonce, error)

func (*SessionManager) NewSession

func (sm *SessionManager) NewSession(ref core.RecordRef, cert core.Certificate) SessionID

func (*SessionManager) ReleaseSession

func (sm *SessionManager) ReleaseSession(id SessionID) (*Session, error)

func (*SessionManager) SetDiscoveryNonce

func (sm *SessionManager) SetDiscoveryNonce(id SessionID, discoveryNonce Nonce) error

type SessionState

type SessionState uint8
const (
	Authorized SessionState = iota + 1
	Challenge1
	Challenge2
)

func (SessionState) String

func (i SessionState) String() string

type SignedChallengePayload

type SignedChallengePayload struct {
	SignedNonce       SignedNonce
	XorDiscoveryNonce Nonce
	DiscoveryNonce    Nonce
}

type SignedChallengeRequest

type SignedChallengeRequest struct {
	SessionID SessionID

	SignedDiscoveryNonce SignedNonce
	XorNonce             Nonce
}

type SignedChallengeResponse

type SignedChallengeResponse struct {
	Header  ChallengeResponseHeader
	Payload *SignedChallengePayload
}

type SignedNonce

type SignedNonce []byte

type StartSessionRequest

type StartSessionRequest struct{}

type StartSessionResponse

type StartSessionResponse struct {
	SessionID SessionID
}

Jump to

Keyboard shortcuts

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