Documentation ¶
Index ¶
- Constants
- func FindDiscovery(cert core.Certificate, ref core.RecordRef) core.DiscoveryNode
- func GenerateShortID(keeper network.NodeKeeper, nodeID core.RecordRef) core.ShortNodeID
- func RemoveOrigin(discoveryNodes []core.DiscoveryNode, origin core.RecordRef) ([]core.DiscoveryNode, error)
- func Xor(first, second []byte) []byte
- type AuthorizationController
- func (ac *AuthorizationController) Authorize(ctx context.Context, discoveryNode *DiscoveryNode, ...) (SessionID, error)
- func (ac *AuthorizationController) Register(ctx context.Context, discoveryNode *DiscoveryNode, sessionID SessionID) error
- func (ac *AuthorizationController) Start(networkCoordinator core.NetworkCoordinator, nodeKeeper network.NodeKeeper)
- type AuthorizationRequest
- type AuthorizationResponse
- type Bootstrapper
- func (bc *Bootstrapper) Bootstrap(ctx context.Context) (*DiscoveryNode, error)
- func (bc *Bootstrapper) BootstrapDiscovery(ctx context.Context) error
- func (bc *Bootstrapper) GetLastPulse() core.PulseNumber
- func (bc *Bootstrapper) SetLastPulse(number core.PulseNumber)
- func (bc *Bootstrapper) Start(keeper network.NodeKeeper)
- type ChallengePayload
- type ChallengeRequest
- type ChallengeResponse
- type ChallengeResponseController
- type ChallengeResponseHeader
- type Code
- type DiscoveryNode
- type GenesisRequest
- type GenesisResponse
- type NetworkBootstrapper
- type NodeBootstrapRequest
- type NodeBootstrapResponse
- type NodeStruct
- type Nonce
- type OperationCode
- type RegistrationRequest
- type RegistrationResponse
- type Session
- type SessionID
- type SessionManager
- func (sm *SessionManager) ChallengePassed(id SessionID) error
- func (sm *SessionManager) CheckSession(id SessionID, expected SessionState) error
- func (sm *SessionManager) GetChallengeData(id SessionID) (core.AuthorizationCertificate, Nonce, error)
- func (sm *SessionManager) NewSession(ref core.RecordRef, cert core.AuthorizationCertificate, ttl time.Duration) SessionID
- func (sm *SessionManager) ReleaseSession(id SessionID) (*Session, error)
- func (sm *SessionManager) SetDiscoveryNonce(id SessionID, discoveryNonce Nonce) error
- func (sm *SessionManager) Start(ctx context.Context) error
- func (sm *SessionManager) Stop(ctx context.Context) error
- type SessionState
- type SignedChallengePayload
- type SignedChallengeRequest
- type SignedChallengeResponse
- type SignedNonce
- type StartSessionRequest
- type StartSessionResponse
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)
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, cert core.AuthorizationCertificate) (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 []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 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 ¶
func (cr *ChallengeResponseController) Start(cryptoSrv core.CryptographyService, keeper network.NodeKeeper)
type ChallengeResponseHeader ¶
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 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 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 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 (sm *SessionManager) NewSession(ref core.RecordRef, cert core.AuthorizationCertificate, ttl time.Duration) 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
}
Click to show internal directories.
Click to hide internal directories.