Documentation ¶
Index ¶
- Constants
- Variables
- 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
- type AuthorizationRequest
- type AuthorizationResponse
- type Bootstrapper
- 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
- type SessionState
- type SignedChallengePayload
- type SignedChallengeRequest
- type SignedChallengeResponse
- type SignedNonce
- type StartSessionRequest
- type StartSessionResponse
Constants ¶
View Source
const ( Accepted = Code(iota + 1) Rejected Redirected ReconnectRequired )
Variables ¶
View Source
var (
ErrReconnectRequired = errors.New("Node should connect via consensus bootstrap")
)
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 interface { component.Initer Authorize(ctx context.Context, discoveryNode *DiscoveryNode, cert core.AuthorizationCertificate) (SessionID, error) Register(ctx context.Context, discoveryNode *DiscoveryNode, sessionID SessionID) error }
func NewAuthorizationController ¶
func NewAuthorizationController(options *common.Options, transport network.InternalTransport) AuthorizationController
type AuthorizationRequest ¶
type AuthorizationRequest struct {
Certificate []byte
}
AuthorizationRequest
type AuthorizationResponse ¶
type AuthorizationResponse struct { Code OperationCode Error string SessionID SessionID }
AuthorizationResponse
type Bootstrapper ¶
type Bootstrapper interface { component.Initer Bootstrap(ctx context.Context) (*network.BootstrapResult, *DiscoveryNode, error) BootstrapDiscovery(ctx context.Context) (*network.BootstrapResult, error) SetLastPulse(number core.PulseNumber) GetLastPulse() core.PulseNumber }
func NewBootstrapper ¶
func NewBootstrapper( options *common.Options, transport network.InternalTransport) Bootstrapper
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 interface { component.Initer Execute(ctx context.Context, discoveryNode *DiscoveryNode, sessionID SessionID) (*ChallengePayload, error) }
func NewChallengeResponseController ¶
func NewChallengeResponseController(options *common.Options, transport network.InternalTransport) ChallengeResponseController
type ChallengeResponseHeader ¶
type DiscoveryNode ¶
type DiscoveryNode struct { Host *host.Host Node core.DiscoveryNode }
type GenesisRequest ¶
type GenesisRequest struct { LastPulse core.PulseNumber Discovery *NodeStruct }
type GenesisResponse ¶
type GenesisResponse struct { Response GenesisRequest Error string }
type NetworkBootstrapper ¶
type NetworkBootstrapper interface { Bootstrap(ctx context.Context) (*network.BootstrapResult, error) SetLastPulse(number core.PulseNumber) GetLastPulse() core.PulseNumber }
func NewNetworkBootstrapper ¶
func NewNetworkBootstrapper() NetworkBootstrapper
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 interface { component.Starter component.Stopper NewSession(ref core.RecordRef, cert core.AuthorizationCertificate, ttl time.Duration) SessionID CheckSession(id SessionID, expected SessionState) error SetDiscoveryNonce(id SessionID, discoveryNonce Nonce) error GetChallengeData(id SessionID) (core.AuthorizationCertificate, Nonce, error) ChallengePassed(id SessionID) error ReleaseSession(id SessionID) (*Session, error) }
func NewSessionManager ¶
func NewSessionManager() SessionManager
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.