Documentation ¶
Overview ¶
Package network is the basic libraries for network layer.
Index ¶
- Constants
- Variables
- func CheckBindIsOpen(network, bind string, timeout time.Duration) error
- func FetchBlockdataFromHTTP(ctx context.Context, item block.BlockdataMapItem) (io.ReadCloser, error)
- func FetchBlockdataFromRemote(ctx context.Context, item block.BlockdataMapItem) (io.ReadCloser, error)
- func FetchBlockdataThruChannel(handler BlockdataHandler, item block.BlockdataMapItem) (io.ReadCloser, error)
- func HTTPError(w http.ResponseWriter, statusCode int)
- func HTTPLogHandler(handler http.Handler, logger *zerolog.Logger) http.Handler
- func IsProblemFromResponse(res *http.Response) bool
- func IsValidHandoverSeal(local node.Local, sl HandoverSeal, networkID base.NetworkID) error
- func IsValidURL(u *url.URL) error
- func MergeError(err error) error
- func NormalizeURL(u *url.URL) *url.URL
- func NormalizeURLString(s string) (*url.URL, error)
- func ParseCombinedNodeURL(u *url.URL) (*url.URL, bool, error)
- func ParseURL(s string, allowEmpty bool) (*url.URL, error)
- func WritePoblem(w http.ResponseWriter, status int, pr Problem)
- func WriteProblemWithError(w http.ResponseWriter, status int, err error)
- type BlockdataHandler
- type BlockdataMapsHandler
- type Channel
- type ConnInfo
- type DummyChannel
- func (ch *DummyChannel) Blockdata(_ context.Context, item block.BlockdataMapItem) (io.ReadCloser, error)
- func (ch *DummyChannel) BlockdataMaps(_ context.Context, heights []base.Height) ([]block.BlockdataMap, error)
- func (ch *DummyChannel) ConnInfo() ConnInfo
- func (ch *DummyChannel) EndHandover(_ context.Context, sl EndHandoverSeal) (bool, error)
- func (*DummyChannel) Initialize() error
- func (ch *DummyChannel) NodeInfo(_ context.Context) (NodeInfo, error)
- func (ch *DummyChannel) PingHandover(_ context.Context, sl PingHandoverSeal) (bool, error)
- func (ch *DummyChannel) Proposal(_ context.Context, h valuehash.Hash) (base.Proposal, error)
- func (ch *DummyChannel) SendSeal(_ context.Context, _ ConnInfo, sl seal.Seal) error
- func (ch *DummyChannel) SetBlockdataHandler(f BlockdataHandler)
- func (ch *DummyChannel) SetBlockdataMapsHandler(f BlockdataMapsHandler)
- func (ch *DummyChannel) SetEndHandover(f EndHandoverHandler)
- func (ch *DummyChannel) SetGetStagedOperationsHandler(f GetStagedOperationsHandler)
- func (ch *DummyChannel) SetGetStateHandler(f GetStateHandler)
- func (ch *DummyChannel) SetNewSealHandler(f NewSealHandler)
- func (ch *DummyChannel) SetNodeInfoHandler(f NodeInfoHandler)
- func (ch *DummyChannel) SetPingHandover(f PingHandoverHandler)
- func (ch *DummyChannel) SetStartHandover(f StartHandoverHandler)
- func (ch *DummyChannel) StagedOperations(_ context.Context, h []valuehash.Hash) ([]operation.Operation, error)
- func (ch *DummyChannel) StartHandover(_ context.Context, sl StartHandoverSeal) (bool, error)
- func (ch *DummyChannel) State(_ context.Context, key string) (state.State, bool, error)
- type EndHandoverHandler
- type EndHandoverSeal
- type GetProposalHandler
- type GetStagedOperationsHandler
- type GetStateHandler
- type HTTPConnInfo
- func (conn HTTPConnInfo) Bytes() []byte
- func (conn HTTPConnInfo) Equal(b ConnInfo) bool
- func (conn HTTPConnInfo) Insecure() bool
- func (conn HTTPConnInfo) IsValid([]byte) error
- func (conn HTTPConnInfo) MarshalBSON() ([]byte, error)
- func (conn HTTPConnInfo) MarshalJSON() ([]byte, error)
- func (conn HTTPConnInfo) SetInsecure(i bool) HTTPConnInfo
- func (conn HTTPConnInfo) String() string
- func (conn HTTPConnInfo) URL() *url.URL
- func (conn *HTTPConnInfo) UnmarshalBSON(b []byte) error
- func (conn *HTTPConnInfo) UnmarshalJSON(b []byte) error
- type HTTPConnInfoPackerJSON
- type HTTPConnInfoUnpackerBSON
- type HTTPConnInfoUnpackerJSON
- type HTTPHandlerFunc
- type HandoverSeal
- type HandoverSealV0
- func (sl HandoverSealV0) Address() base.Address
- func (sl HandoverSealV0) BodyBytes() []byte
- func (sl HandoverSealV0) ConnInfo() ConnInfo
- func (sl HandoverSealV0) IsValid(networkID []byte) error
- func (sl HandoverSealV0) MarshalBSON() ([]byte, error)
- func (sl HandoverSealV0) MarshalJSON() ([]byte, error)
- func (sl *HandoverSealV0) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
- func (sl *HandoverSealV0) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
- type HandoverSealV0BSONUnpack
- type HandoverSealV0JSONPack
- type HandoverSealV0JSONUnpack
- type NewSealHandler
- type NilConnInfo
- func (NilConnInfo) Bytes() []byte
- func (conn NilConnInfo) Equal(b ConnInfo) bool
- func (NilConnInfo) Insecure() bool
- func (conn NilConnInfo) IsValid([]byte) error
- func (conn NilConnInfo) MarshalBSON() ([]byte, error)
- func (conn NilConnInfo) MarshalJSON() ([]byte, error)
- func (conn NilConnInfo) String() string
- func (NilConnInfo) URL() *url.URL
- func (conn *NilConnInfo) UnmarshalBSON(b []byte) error
- func (conn *NilConnInfo) UnmarshalJSON(b []byte) error
- type NilConnInfoPackerJSON
- type NilConnInfoUnpackerBSON
- type NilConnInfoUnpackerJSON
- type NodeInfo
- type NodeInfoChecker
- type NodeInfoHandler
- type NodeInfoV0
- func (ni NodeInfoV0) Address() base.Address
- func (NodeInfoV0) Bytes() []byte
- func (ni NodeInfoV0) ConnInfo() ConnInfo
- func (ni NodeInfoV0) IsValid([]byte) error
- func (ni NodeInfoV0) JSONPacker() NodeInfoV0PackerJSON
- func (ni NodeInfoV0) LastBlock() block.Manifest
- func (ni NodeInfoV0) MarshalBSON() ([]byte, error)
- func (ni NodeInfoV0) MarshalJSON() ([]byte, error)
- func (ni NodeInfoV0) NetworkID() base.NetworkID
- func (ni NodeInfoV0) Nodes() []RemoteNode
- func (ni NodeInfoV0) Policy() map[string]interface{}
- func (ni NodeInfoV0) Publickey() key.Publickey
- func (ni NodeInfoV0) State() base.State
- func (ni NodeInfoV0) String() string
- func (ni *NodeInfoV0) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
- func (ni *NodeInfoV0) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
- func (ni NodeInfoV0) Version() util.Version
- type NodeInfoV0PackerJSON
- type NodeInfoV0UnpackerBSON
- type NodeInfoV0UnpackerJSON
- type Nodepool
- func (np *Nodepool) Add(no base.Node, ch Channel) error
- func (np *Nodepool) Broadcast(ctx context.Context, sl seal.Seal, filter func(base.Node) bool) ([]error, error)
- func (np *Nodepool) Channel(addr base.Address) (Channel, bool)
- func (np *Nodepool) Exists(address base.Address) bool
- func (np *Nodepool) ExistsPassthrough(ci ConnInfo) bool
- func (np *Nodepool) Len() int
- func (np *Nodepool) LenRemoteAlives() int
- func (np *Nodepool) LocalChannel() Channel
- func (np *Nodepool) LocalNode() node.Local
- func (np *Nodepool) Node(address base.Address) (base.Node, Channel, bool)
- func (np *Nodepool) Passthroughs(ctx context.Context, sl PassthroughedSeal, callback func(seal.Seal, Channel)) error
- func (np *Nodepool) Remove(addrs ...base.Address) error
- func (np *Nodepool) RemovePassthrough(s string) error
- func (np *Nodepool) SetChannel(addr base.Address, ch Channel) error
- func (np *Nodepool) SetPassthrough(ch Channel, filter func(PassthroughedSeal) bool, expire time.Duration) error
- func (np *Nodepool) Traverse(callback func(base.Node, Channel) bool)
- func (np *Nodepool) TraverseAliveRemotes(callback func(base.Node, Channel) bool)
- func (np *Nodepool) TraverseRemotes(callback func(base.Node, Channel) bool)
- type PassthroughedSeal
- type PingHandoverHandler
- type PingHandoverSeal
- type Problem
- func (pr Problem) AddExtra(k string, v interface{}) Problem
- func (pr Problem) Detail() string
- func (pr Problem) Error() string
- func (pr Problem) Extra() map[string]interface{}
- func (pr Problem) MarshalJSON() ([]byte, error)
- func (pr Problem) SetDetail(detail string) Problem
- func (pr Problem) Title() string
- func (pr Problem) Type() string
- func (pr *Problem) UnmarshalJSON(b []byte) error
- type ProblemJSONPacker
- type RemoteNode
- type RemoteNodeUnpackBSON
- type RemoteNodeUnpackJSON
- type Response
- type Server
- type StartHandoverHandler
- type StartHandoverSeal
Constants ¶
View Source
const ( ProblemMimetype = "application/problem+json; charset=utf-8" ProblemNamespace = "https://github.com/spikeekips/mitum/problems" DefaultProblemType = "others" )
Variables ¶
View Source
var ( NilConnInfoType = hint.Type("nil-conninfo") NilConnInfoHint = hint.NewHint(NilConnInfoType, "v0.0.1") NilConnInfoHinter = NilConnInfo{BaseHinter: hint.NewBaseHinter(NilConnInfoHint)} HTTPConnInfoType = hint.Type("http-conninfo") HTTPConnInfoHint = hint.NewHint(HTTPConnInfoType, "v0.0.1") HTTPConnInfoHinter = HTTPConnInfo{BaseHinter: hint.NewBaseHinter(HTTPConnInfoHint)} )
View Source
var ( NetworkError = util.NewError("network error") HandoverRejectedError = util.NewError("handover failed") )
View Source
var ( StartHandoverSealV0Type = hint.Type("start-handover-seal") StartHandoverSealV0Hint = hint.NewHint(StartHandoverSealV0Type, "v0.0.1") StartHandoverSealV0Hinter = HandoverSealV0{BaseSeal: seal.NewBaseSealWithHint(StartHandoverSealV0Hint)} PingHandoverSealV0Type = hint.Type("ping-handover-seal") PingHandoverSealV0Hint = hint.NewHint(PingHandoverSealV0Type, "v0.0.1") PingHandoverSealV0Hinter = HandoverSealV0{BaseSeal: seal.NewBaseSealWithHint(PingHandoverSealV0Hint)} EndHandoverSealV0Type = hint.Type("end-handover-seal") EndHandoverSealV0Hint = hint.NewHint(EndHandoverSealV0Type, "v0.0.1") EndHandoverSealV0Hinter = HandoverSealV0{BaseSeal: seal.NewBaseSealWithHint(EndHandoverSealV0Hint)} )
View Source
var ( ChannelTimeoutSeal = time.Second * 2 ChannelTimeoutOperation = time.Second * 2 ChannelTimeoutSendSeal = time.Second * 2 ChannelTimeoutNodeInfo = time.Second * 2 ChannelTimeoutBlockdataMap = time.Second * 2 ChannelTimeoutBlockdata = time.Second * 30 ChannelTimeoutHandover = time.Second * 2 )
View Source
var ( NodeInfoType = hint.Type("node-info") NodeInfoV0Hint = hint.NewHint(NodeInfoType, "v0.0.1") NodeInfoV0Hinter = NodeInfoV0{BaseHinter: hint.NewBaseHinter(NodeInfoV0Hint)} )
View Source
var ( ProblemType = hint.Type("mitum-problem") ProblemHint = hint.NewHint(ProblemType, "v0.0.1") ProblemHinter = Problem{BaseHinter: hint.NewBaseHinter(ProblemHint)} )
View Source
var (
UnknownProblem = NewProblem(DefaultProblemType, "unknown problem occurred")
)
Functions ¶
func FetchBlockdataFromHTTP ¶
func FetchBlockdataFromHTTP(ctx context.Context, item block.BlockdataMapItem) (io.ReadCloser, error)
func FetchBlockdataFromRemote ¶
func FetchBlockdataFromRemote(ctx context.Context, item block.BlockdataMapItem) (io.ReadCloser, error)
func FetchBlockdataThruChannel ¶
func FetchBlockdataThruChannel(handler BlockdataHandler, item block.BlockdataMapItem) (io.ReadCloser, error)
func HTTPError ¶
func HTTPError(w http.ResponseWriter, statusCode int)
func HTTPLogHandler ¶
func IsProblemFromResponse ¶
func IsValidHandoverSeal ¶
func IsValidURL ¶
func MergeError ¶
func ParseCombinedNodeURL ¶
ParseCombinedNodeURL parses the combined url of node; it contains, - node publish url - tls insecure: "#insecure" "insecure" fragment will be removed.
func WritePoblem ¶
func WritePoblem(w http.ResponseWriter, status int, pr Problem)
func WriteProblemWithError ¶
func WriteProblemWithError(w http.ResponseWriter, status int, err error)
Types ¶
type BlockdataMapsHandler ¶
type BlockdataMapsHandler func([]base.Height) ([]block.BlockdataMap, error)
type Channel ¶
type Channel interface { util.Initializer ConnInfo() ConnInfo StagedOperations(context.Context, []valuehash.Hash) ([]operation.Operation, error) SendSeal(context.Context, ConnInfo, seal.Seal) error Proposal(context.Context, valuehash.Hash) (base.Proposal, error) NodeInfo(context.Context) (NodeInfo, error) BlockdataMaps(context.Context, []base.Height) ([]block.BlockdataMap, error) Blockdata(context.Context, block.BlockdataMapItem) (io.ReadCloser, error) StartHandover(context.Context, StartHandoverSeal) (bool, error) PingHandover(context.Context, PingHandoverSeal) (bool, error) EndHandover(context.Context, EndHandoverSeal) (bool, error) }
type DummyChannel ¶
type DummyChannel struct {
// contains filtered or unexported fields
}
func NewDummyChannel ¶
func NewDummyChannel(connInfo ConnInfo) *DummyChannel
func (*DummyChannel) Blockdata ¶
func (ch *DummyChannel) Blockdata(_ context.Context, item block.BlockdataMapItem) (io.ReadCloser, error)
func (*DummyChannel) BlockdataMaps ¶
func (ch *DummyChannel) BlockdataMaps(_ context.Context, heights []base.Height) ([]block.BlockdataMap, error)
func (*DummyChannel) ConnInfo ¶
func (ch *DummyChannel) ConnInfo() ConnInfo
func (*DummyChannel) EndHandover ¶
func (ch *DummyChannel) EndHandover(_ context.Context, sl EndHandoverSeal) (bool, error)
func (*DummyChannel) Initialize ¶
func (*DummyChannel) Initialize() error
func (*DummyChannel) NodeInfo ¶
func (ch *DummyChannel) NodeInfo(_ context.Context) (NodeInfo, error)
func (*DummyChannel) PingHandover ¶
func (ch *DummyChannel) PingHandover(_ context.Context, sl PingHandoverSeal) (bool, error)
func (*DummyChannel) SetBlockdataHandler ¶
func (ch *DummyChannel) SetBlockdataHandler(f BlockdataHandler)
func (*DummyChannel) SetBlockdataMapsHandler ¶
func (ch *DummyChannel) SetBlockdataMapsHandler(f BlockdataMapsHandler)
func (*DummyChannel) SetEndHandover ¶
func (ch *DummyChannel) SetEndHandover(f EndHandoverHandler)
func (*DummyChannel) SetGetStagedOperationsHandler ¶
func (ch *DummyChannel) SetGetStagedOperationsHandler(f GetStagedOperationsHandler)
func (*DummyChannel) SetGetStateHandler ¶
func (ch *DummyChannel) SetGetStateHandler(f GetStateHandler)
func (*DummyChannel) SetNewSealHandler ¶
func (ch *DummyChannel) SetNewSealHandler(f NewSealHandler)
func (*DummyChannel) SetNodeInfoHandler ¶
func (ch *DummyChannel) SetNodeInfoHandler(f NodeInfoHandler)
func (*DummyChannel) SetPingHandover ¶
func (ch *DummyChannel) SetPingHandover(f PingHandoverHandler)
func (*DummyChannel) SetStartHandover ¶
func (ch *DummyChannel) SetStartHandover(f StartHandoverHandler)
func (*DummyChannel) StagedOperations ¶
func (*DummyChannel) StartHandover ¶
func (ch *DummyChannel) StartHandover(_ context.Context, sl StartHandoverSeal) (bool, error)
type EndHandoverHandler ¶
type EndHandoverHandler func(EndHandoverSeal) (bool, error)
type EndHandoverSeal ¶
type EndHandoverSeal interface { HandoverSeal }
type HTTPConnInfo ¶
type HTTPConnInfo struct { hint.BaseHinter // contains filtered or unexported fields }
func NewHTTPConnInfo ¶
func NewHTTPConnInfo(u *url.URL, insecure bool) HTTPConnInfo
func NewHTTPConnInfoFromString ¶
func NewHTTPConnInfoFromString(s string, insecure bool) (HTTPConnInfo, error)
func (HTTPConnInfo) Bytes ¶
func (conn HTTPConnInfo) Bytes() []byte
func (HTTPConnInfo) Equal ¶
func (conn HTTPConnInfo) Equal(b ConnInfo) bool
func (HTTPConnInfo) Insecure ¶
func (conn HTTPConnInfo) Insecure() bool
func (HTTPConnInfo) IsValid ¶
func (conn HTTPConnInfo) IsValid([]byte) error
func (HTTPConnInfo) MarshalBSON ¶
func (conn HTTPConnInfo) MarshalBSON() ([]byte, error)
func (HTTPConnInfo) MarshalJSON ¶
func (conn HTTPConnInfo) MarshalJSON() ([]byte, error)
func (HTTPConnInfo) SetInsecure ¶
func (conn HTTPConnInfo) SetInsecure(i bool) HTTPConnInfo
func (HTTPConnInfo) String ¶
func (conn HTTPConnInfo) String() string
func (HTTPConnInfo) URL ¶
func (conn HTTPConnInfo) URL() *url.URL
func (*HTTPConnInfo) UnmarshalBSON ¶
func (conn *HTTPConnInfo) UnmarshalBSON(b []byte) error
func (*HTTPConnInfo) UnmarshalJSON ¶
func (conn *HTTPConnInfo) UnmarshalJSON(b []byte) error
type HTTPConnInfoPackerJSON ¶
type HTTPConnInfoPackerJSON struct { jsonenc.HintedHead U string `json:"url"` I bool `json:"insecure"` }
type HTTPHandlerFunc ¶
type HTTPHandlerFunc func(http.ResponseWriter, *http.Request)
type HandoverSeal ¶
type HandoverSealV0 ¶
func NewHandoverSealV0 ¶
func NewHandoverSealV0( ht hint.Hint, pk key.Privatekey, ad base.Address, ci ConnInfo, networkID []byte, ) (HandoverSealV0, error)
func (HandoverSealV0) Address ¶
func (sl HandoverSealV0) Address() base.Address
func (HandoverSealV0) BodyBytes ¶
func (sl HandoverSealV0) BodyBytes() []byte
func (HandoverSealV0) ConnInfo ¶
func (sl HandoverSealV0) ConnInfo() ConnInfo
func (HandoverSealV0) IsValid ¶
func (sl HandoverSealV0) IsValid(networkID []byte) error
func (HandoverSealV0) MarshalBSON ¶
func (sl HandoverSealV0) MarshalBSON() ([]byte, error)
func (HandoverSealV0) MarshalJSON ¶
func (sl HandoverSealV0) MarshalJSON() ([]byte, error)
func (*HandoverSealV0) UnpackBSON ¶
func (sl *HandoverSealV0) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
func (*HandoverSealV0) UnpackJSON ¶
func (sl *HandoverSealV0) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
type HandoverSealV0BSONUnpack ¶
type HandoverSealV0BSONUnpack struct { AD base.AddressDecoder `bson:"address"` CI bson.Raw `bson:"conninfo"` }
type HandoverSealV0JSONPack ¶
type HandoverSealV0JSONPack struct { *seal.BaseSealJSONPack AD base.Address `json:"address"` CI ConnInfo `json:"conninfo"` }
type HandoverSealV0JSONUnpack ¶
type HandoverSealV0JSONUnpack struct { AD base.AddressDecoder `json:"address"` CI json.RawMessage `json:"conninfo"` }
type NewSealHandler ¶
type NilConnInfo ¶
type NilConnInfo struct { hint.BaseHinter // contains filtered or unexported fields }
func NewNilConnInfo ¶
func NewNilConnInfo(name string) NilConnInfo
func (NilConnInfo) Bytes ¶
func (NilConnInfo) Bytes() []byte
func (NilConnInfo) Equal ¶
func (conn NilConnInfo) Equal(b ConnInfo) bool
func (NilConnInfo) Insecure ¶
func (NilConnInfo) Insecure() bool
func (NilConnInfo) IsValid ¶
func (conn NilConnInfo) IsValid([]byte) error
func (NilConnInfo) MarshalBSON ¶
func (conn NilConnInfo) MarshalBSON() ([]byte, error)
func (NilConnInfo) MarshalJSON ¶
func (conn NilConnInfo) MarshalJSON() ([]byte, error)
func (NilConnInfo) String ¶
func (conn NilConnInfo) String() string
func (NilConnInfo) URL ¶
func (NilConnInfo) URL() *url.URL
func (*NilConnInfo) UnmarshalBSON ¶
func (conn *NilConnInfo) UnmarshalBSON(b []byte) error
func (*NilConnInfo) UnmarshalJSON ¶
func (conn *NilConnInfo) UnmarshalJSON(b []byte) error
type NilConnInfoPackerJSON ¶
type NilConnInfoPackerJSON struct { jsonenc.HintedHead S string `json:"name"` }
type NilConnInfoUnpackerBSON ¶
type NilConnInfoUnpackerJSON ¶
type NilConnInfoUnpackerJSON struct {
S string `json:"name"`
}
type NodeInfoChecker ¶
type NodeInfoChecker struct { sync.RWMutex *logging.Logging *util.ContextDaemon // contains filtered or unexported fields }
func NewNodeInfoChecker ¶
func (*NodeInfoChecker) SetLogging ¶
func (nc *NodeInfoChecker) SetLogging(l *logging.Logging) *logging.Logging
type NodeInfoHandler ¶
type NodeInfoV0 ¶
type NodeInfoV0 struct { hint.BaseHinter // contains filtered or unexported fields }
func NewNodeInfoV0 ¶
func (NodeInfoV0) Address ¶
func (ni NodeInfoV0) Address() base.Address
func (NodeInfoV0) Bytes ¶
func (NodeInfoV0) Bytes() []byte
func (NodeInfoV0) ConnInfo ¶
func (ni NodeInfoV0) ConnInfo() ConnInfo
func (NodeInfoV0) IsValid ¶
func (ni NodeInfoV0) IsValid([]byte) error
func (NodeInfoV0) JSONPacker ¶
func (ni NodeInfoV0) JSONPacker() NodeInfoV0PackerJSON
func (NodeInfoV0) LastBlock ¶
func (ni NodeInfoV0) LastBlock() block.Manifest
func (NodeInfoV0) MarshalBSON ¶
func (ni NodeInfoV0) MarshalBSON() ([]byte, error)
func (NodeInfoV0) MarshalJSON ¶
func (ni NodeInfoV0) MarshalJSON() ([]byte, error)
func (NodeInfoV0) NetworkID ¶
func (ni NodeInfoV0) NetworkID() base.NetworkID
func (NodeInfoV0) Nodes ¶
func (ni NodeInfoV0) Nodes() []RemoteNode
func (NodeInfoV0) Policy ¶
func (ni NodeInfoV0) Policy() map[string]interface{}
func (NodeInfoV0) Publickey ¶
func (ni NodeInfoV0) Publickey() key.Publickey
func (NodeInfoV0) State ¶
func (ni NodeInfoV0) State() base.State
func (NodeInfoV0) String ¶
func (ni NodeInfoV0) String() string
func (*NodeInfoV0) UnpackBSON ¶
func (ni *NodeInfoV0) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
func (*NodeInfoV0) UnpackJSON ¶
func (ni *NodeInfoV0) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
func (NodeInfoV0) Version ¶
func (ni NodeInfoV0) Version() util.Version
type NodeInfoV0PackerJSON ¶
type NodeInfoV0PackerJSON struct { jsonenc.HintedHead ND base.Node `json:"node"` NID base.NetworkID `json:"network_id"` ST base.State `json:"state"` LB block.Manifest `json:"last_block"` VS util.Version `json:"version"` PO map[string]interface{} `json:"policy"` SF []RemoteNode `json:"suffrage"` CI ConnInfo `json:"conninfo"` }
type NodeInfoV0UnpackerBSON ¶
type NodeInfoV0UnpackerBSON struct { ND bson.Raw `bson:"node"` NID base.NetworkID `bson:"network_id"` ST base.State `bson:"state"` LB bson.Raw `bson:"last_block"` VS util.Version `bson:"version"` PO map[string]interface{} `bson:"policy"` SF []bson.Raw `bson:"suffrage"` CI bson.Raw `bson:"conninfo"` }
type NodeInfoV0UnpackerJSON ¶
type NodeInfoV0UnpackerJSON struct { ND json.RawMessage `json:"node"` NID base.NetworkID `json:"network_id"` ST base.State `json:"state"` LB json.RawMessage `json:"last_block"` VS util.Version `json:"version"` PO map[string]interface{} `json:"policy"` SF []json.RawMessage `json:"suffrage"` CI json.RawMessage `json:"conninfo"` }
type Nodepool ¶
Nodepool contains all the known nodes including local node.
func (*Nodepool) ExistsPassthrough ¶
func (*Nodepool) LenRemoteAlives ¶
func (*Nodepool) LocalChannel ¶
func (*Nodepool) Passthroughs ¶
func (*Nodepool) RemovePassthrough ¶
func (*Nodepool) SetPassthrough ¶
func (*Nodepool) TraverseAliveRemotes ¶
type PassthroughedSeal ¶
func NewPassthroughedSeal ¶
func NewPassthroughedSeal(sl seal.Seal, ci string) PassthroughedSeal
func NewPassthroughedSealFromConnInfo ¶
func NewPassthroughedSealFromConnInfo(sl seal.Seal, ci ConnInfo) PassthroughedSeal
func (PassthroughedSeal) FromConnInfo ¶
func (sl PassthroughedSeal) FromConnInfo() string
type PingHandoverHandler ¶
type PingHandoverHandler func(PingHandoverSeal) (bool, error)
type PingHandoverSeal ¶
type PingHandoverSeal interface { HandoverSeal }
type Problem ¶
type Problem struct { hint.BaseHinter // contains filtered or unexported fields }
Problem implements "Problem Details for HTTP APIs"<https://tools.ietf.org/html/rfc7807>.
func NewProblem ¶
func NewProblemFromError ¶
func (Problem) MarshalJSON ¶
func (*Problem) UnmarshalJSON ¶
type ProblemJSONPacker ¶
type RemoteNode ¶
type RemoteNode struct { Address base.Address Publickey key.Publickey // contains filtered or unexported fields }
func NewRemoteNode ¶
func NewRemoteNode(no base.Node, connInfo ConnInfo) RemoteNode
func NewRemoteNodeFromNodeInfo ¶
func NewRemoteNodeFromNodeInfo(ni NodeInfo) RemoteNode
func (RemoteNode) ConnInfo ¶
func (no RemoteNode) ConnInfo() ConnInfo
func (RemoteNode) MarshalBSON ¶
func (no RemoteNode) MarshalBSON() ([]byte, error)
func (RemoteNode) MarshalJSON ¶
func (no RemoteNode) MarshalJSON() ([]byte, error)
type RemoteNodeUnpackBSON ¶
type RemoteNodeUnpackBSON struct { A base.AddressDecoder `bson:"address"` P key.PublickeyDecoder `bson:"publickey"` CI bson.Raw `bson:"conninfo"` }
type RemoteNodeUnpackJSON ¶
type RemoteNodeUnpackJSON struct { A base.AddressDecoder `json:"address"` P key.PublickeyDecoder `json:"publickey"` CI json.RawMessage `json:"conninfo"` }
type Server ¶
type Server interface { util.Daemon util.Initializer SetNewSealHandler(NewSealHandler) SetGetStagedOperationsHandler(GetStagedOperationsHandler) SetGetProposalHandler(GetProposalHandler) NodeInfoHandler() NodeInfoHandler SetNodeInfoHandler(NodeInfoHandler) SetBlockdataMapsHandler(BlockdataMapsHandler) SetBlockdataHandler(BlockdataHandler) SetStartHandoverHandler(StartHandoverHandler) SetPingHandoverHandler(PingHandoverHandler) SetEndHandoverHandler(EndHandoverHandler) }
type StartHandoverHandler ¶
type StartHandoverHandler func(StartHandoverSeal) (bool, error)
type StartHandoverSeal ¶
type StartHandoverSeal interface { HandoverSeal }
Source Files ¶
- blockdata.go
- conn.go
- conn_bson.go
- conn_encode.go
- conn_json.go
- doc.go
- dummy_channel.go
- errors.go
- handover_seal.go
- handover_seal_bson.go
- handover_seal_encode.go
- handover_seal_json.go
- http.go
- network.go
- node_info.go
- node_info_bson.go
- node_info_checker.go
- node_info_encode.go
- node_info_json.go
- nodepool.go
- problem.go
- problem_json.go
- util.go
Directories ¶
Path | Synopsis |
---|---|
Package discovery supports suffrage nodes network.
|
Package discovery supports suffrage nodes network. |
memberlist
Package memberlist provides node discovery and failed nodes detection by hashicorp/memberlist.
|
Package memberlist provides node discovery and failed nodes detection by hashicorp/memberlist. |
Package channetwork provides the golang channel based network.
|
Package channetwork provides the golang channel based network. |
Package quicnetwork provides the quic based network.
|
Package quicnetwork provides the quic based network. |
Click to show internal directories.
Click to hide internal directories.