bootstrap

package
v0.7.1-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2019 License: Apache-2.0, BSD-3-Clause-Clear Imports: 25 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

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 []byte
}

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) GetLastPulse added in v0.7.5

func (bc *Bootstrapper) GetLastPulse() core.PulseNumber

func (*Bootstrapper) SetLastPulse added in v0.7.5

func (bc *Bootstrapper) SetLastPulse(number core.PulseNumber)

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 []byte
	LastPulse   core.PulseNumber
}

type GenesisResponse

type GenesisResponse struct {
	Discovery *NodeStruct
	LastPulse core.PulseNumber
	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) GetLastPulse added in v0.7.5

func (nb *NetworkBootstrapper) GetLastPulse() core.PulseNumber

func (*NetworkBootstrapper) SetLastPulse added in v0.7.5

func (nb *NetworkBootstrapper) SetLastPulse(number core.PulseNumber)

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 NodeStruct added in v0.7.5

type NodeStruct struct {
	ID      core.RecordRef
	SID     core.ShortNodeID
	Role    core.StaticRole
	PK      []byte
	Address string
	Version 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.AuthorizationCertificate
	State  SessionState

	DiscoveryNonce Nonce

	Time time.Time
	TTL  time.Duration
}

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.AuthorizationCertificate, Nonce, error)

func (*SessionManager) NewSession

func (*SessionManager) ReleaseSession

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

func (*SessionManager) SetDiscoveryNonce

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

func (*SessionManager) Start

func (sm *SessionManager) Start(ctx context.Context) error

func (*SessionManager) Stop

func (sm *SessionManager) Stop(ctx context.Context) 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