Documentation ¶
Index ¶
- Variables
- type NetworkConfig
- func (*NetworkConfig) Descriptor() ([]byte, []int)
- func (m *NetworkConfig) GetLastUpdated() *types.Timestamp
- func (m *NetworkConfig) GetNetworkState() NetworkState
- func (m *NetworkConfig) GetParticipants() map[string]*PeerAddrs
- func (m *NetworkConfig) GetSignature() *crypto.Signature
- func (c *NetworkConfig) LoadFromFile(ctx context.Context, path string, signerID peer.ID) (err error)
- func (m *NetworkConfig) Marshal() (dAtA []byte, err error)
- func (m *NetworkConfig) MarshalTo(dAtA []byte) (int, error)
- func (*NetworkConfig) ProtoMessage()
- func (m *NetworkConfig) Reset()
- func (c *NetworkConfig) Sign(ctx context.Context, privKey crypto.PrivKey) error
- func (m *NetworkConfig) Size() (n int)
- func (m *NetworkConfig) String() string
- func (m *NetworkConfig) Unmarshal(dAtA []byte) error
- func (c *NetworkConfig) ValidateContent(ctx context.Context) error
- func (c *NetworkConfig) ValidateSignature(ctx context.Context, peerID peer.ID) bool
- func (m *NetworkConfig) XXX_DiscardUnknown()
- func (m *NetworkConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *NetworkConfig) XXX_Merge(src proto.Message)
- func (m *NetworkConfig) XXX_Size() int
- func (m *NetworkConfig) XXX_Unmarshal(b []byte) error
- type NetworkState
- type PeerAddrs
- func (*PeerAddrs) Descriptor() ([]byte, []int)
- func (m *PeerAddrs) GetAddresses() []string
- func (m *PeerAddrs) Marshal() (dAtA []byte, err error)
- func (m *PeerAddrs) MarshalTo(dAtA []byte) (int, error)
- func (*PeerAddrs) ProtoMessage()
- func (m *PeerAddrs) Reset()
- func (m *PeerAddrs) Size() (n int)
- func (m *PeerAddrs) String() string
- func (m *PeerAddrs) Unmarshal(dAtA []byte) error
- func (m *PeerAddrs) XXX_DiscardUnknown()
- func (m *PeerAddrs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *PeerAddrs) XXX_Merge(src proto.Message)
- func (m *PeerAddrs) XXX_Size() int
- func (m *PeerAddrs) XXX_Unmarshal(b []byte) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidConfig = errors.New("invalid configuration file") ErrInvalidSignature = errors.New("invalid configuration signature") ErrInvalidNetworkState = errors.New("invalid network state") ErrInvalidPeerID = errors.New("invalid peer ID") ErrMissingPeerAddrs = errors.New("missing peer addresses") ErrInvalidPeerAddr = errors.New("invalid peer address") ErrMissingLastUpdated = errors.New("missing last updated timestamp") ErrInvalidLastUpdated = errors.New("invalid last updated (maybe outdated)") )
Errors used by the NetworkConfig.
View Source
var ( ErrInvalidLengthProtector = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowProtector = fmt.Errorf("proto: integer overflow") )
View Source
var NetworkState_name = map[int32]string{
0: "BOOTSTRAP",
1: "PROTECTED",
}
View Source
var NetworkState_value = map[string]int32{
"BOOTSTRAP": 0,
"PROTECTED": 1,
}
Functions ¶
This section is empty.
Types ¶
type NetworkConfig ¶
type NetworkConfig struct { NetworkState NetworkState `` /* 145-byte string literal not displayed */ Participants map[string]*PeerAddrs `` /* 151-byte string literal not displayed */ LastUpdated *types.Timestamp `protobuf:"bytes,3,opt,name=last_updated,json=lastUpdated" json:"last_updated,omitempty"` Signature *crypto.Signature `protobuf:"bytes,10,opt,name=signature" json:"signature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
The NetworkConfig message contains the network state and its participants (signed by a trusted node).
func NewNetworkConfig ¶
func NewNetworkConfig(networkState NetworkState) *NetworkConfig
NewNetworkConfig creates a NetworkConfig.
func (*NetworkConfig) Descriptor ¶
func (*NetworkConfig) Descriptor() ([]byte, []int)
func (*NetworkConfig) GetLastUpdated ¶
func (m *NetworkConfig) GetLastUpdated() *types.Timestamp
func (*NetworkConfig) GetNetworkState ¶
func (m *NetworkConfig) GetNetworkState() NetworkState
func (*NetworkConfig) GetParticipants ¶
func (m *NetworkConfig) GetParticipants() map[string]*PeerAddrs
func (*NetworkConfig) GetSignature ¶
func (m *NetworkConfig) GetSignature() *crypto.Signature
func (*NetworkConfig) LoadFromFile ¶
func (c *NetworkConfig) LoadFromFile(ctx context.Context, path string, signerID peer.ID) (err error)
LoadFromFile loads the given configuration and validates it.
func (*NetworkConfig) Marshal ¶
func (m *NetworkConfig) Marshal() (dAtA []byte, err error)
func (*NetworkConfig) ProtoMessage ¶
func (*NetworkConfig) ProtoMessage()
func (*NetworkConfig) Reset ¶
func (m *NetworkConfig) Reset()
func (*NetworkConfig) Sign ¶
func (c *NetworkConfig) Sign(ctx context.Context, privKey crypto.PrivKey) error
Sign signs the current configuration data.
func (*NetworkConfig) Size ¶
func (m *NetworkConfig) Size() (n int)
func (*NetworkConfig) String ¶
func (m *NetworkConfig) String() string
func (*NetworkConfig) Unmarshal ¶
func (m *NetworkConfig) Unmarshal(dAtA []byte) error
func (*NetworkConfig) ValidateContent ¶
func (c *NetworkConfig) ValidateContent(ctx context.Context) error
ValidateContent validates that the contents of the configuration is correctly typed (peerIDs, addresses, etc).
func (*NetworkConfig) ValidateSignature ¶
func (c *NetworkConfig) ValidateSignature(ctx context.Context, peerID peer.ID) bool
ValidateSignature verifies that the network configuration was signed by a given peer.
func (*NetworkConfig) XXX_DiscardUnknown ¶
func (m *NetworkConfig) XXX_DiscardUnknown()
func (*NetworkConfig) XXX_Marshal ¶
func (m *NetworkConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*NetworkConfig) XXX_Merge ¶
func (dst *NetworkConfig) XXX_Merge(src proto.Message)
func (*NetworkConfig) XXX_Size ¶
func (m *NetworkConfig) XXX_Size() int
func (*NetworkConfig) XXX_Unmarshal ¶
func (m *NetworkConfig) XXX_Unmarshal(b []byte) error
type NetworkState ¶
type NetworkState int32
const ( // The network is in the bootstrap phase (not fully private yet). NetworkState_BOOTSTRAP NetworkState = 0 // The network bootstrap phase is complete and the network is now protected. NetworkState_PROTECTED NetworkState = 1 )
func (NetworkState) EnumDescriptor ¶
func (NetworkState) EnumDescriptor() ([]byte, []int)
func (NetworkState) String ¶
func (x NetworkState) String() string
type PeerAddrs ¶
type PeerAddrs struct { Addresses []string `protobuf:"bytes,1,rep,name=addresses" json:"addresses,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
A list of multiaddresses.
func (*PeerAddrs) Descriptor ¶
func (*PeerAddrs) GetAddresses ¶
func (*PeerAddrs) ProtoMessage ¶
func (*PeerAddrs) ProtoMessage()
func (*PeerAddrs) XXX_DiscardUnknown ¶
func (m *PeerAddrs) XXX_DiscardUnknown()
func (*PeerAddrs) XXX_Marshal ¶
func (*PeerAddrs) XXX_Unmarshal ¶
Click to show internal directories.
Click to hide internal directories.