boot

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Copyright 2018 The MATRIX Authors as well as Copyright 2014-2017 The go-ethereum Authors This file is consisted of the MATRIX library and part of the go-ethereum library.

The MATRIX-ethereum library is free software: you can redistribute it and/or modify it under the terms of the MIT License.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject tothe following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISINGFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Package boot :net search

Copyright 2018 The MATRIX Authors as well as Copyright 2014-2017 The go-ethereum Authors This file is consisted of the MATRIX library and part of the go-ethereum library.

The MATRIX-ethereum library is free software: you can redistribute it and/or modify it under the terms of the MIT License.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject tothe following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISINGFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

View Source
const (
	// TimeOutLimit wait data time
	TimeOutLimit = 2 * time.Second
	//FindConnStatusInterval sleep time
	FindConnStatusInterval = 5
	// MinLiveBootCount min live boot count
	MinLiveBootCount = 12
	Module           = "BOOT"
	ChanSize         = 100
)
View Source
const (
	//Getheightreq gmaneightreq_code
	Getheightreq = 0x0001
	//Getheightrsp gmaneightrsp_code
	Getheightrsp = 0x0002
	//Getmainnodereq getmainnodersp_code
	Getmainnodereq = 0x0003
	//Getmainnodersp getmainnodersp_code
	Getmainnodersp = 0x0004
	// Getpingreq get ping req_code
	Getpingreq = 0x0005
	// Getpongrsp get ping rsq_code
	Getpongrsp = 0x0006
	//P2PBootCode p2pboot_code
	P2PBootCode = 1
)

Variables

This section is empty.

Functions

func GetIPFromID

func GetIPFromID(ID string) string

func SendData

func SendData(ReadySend []p2p.Custsend)

SendData send data from p2p

Types

type Boots

type Boots struct {
	ChanPing chan LocalPongInfo

	BootReturn REboot
	PublicSeq  uint64
	NeedAck    []uint64
	LocalID    string

	MyRecvChan    chan p2p.Custsend
	HandleMessage map[int]func(p2p.Custsend)
	// contains filtered or unexported fields
}

Boots HandleMessage and some channal

func New

func New(bc *core.BlockChain, nodeID string) *Boots

New new Boots

func (*Boots) CheckIPStatusAndCount

func (TBoot *Boots) CheckIPStatusAndCount(ListID []string) (int, []string)

CheckIPStatusAndCount Check IP Status And count

func (*Boots) DeleteIndex

func (TBoot *Boots) DeleteIndex(index uint64) int

DeleteIndex delete a index in []

func (*Boots) FindOneBootNode

func (TBoot *Boots) FindOneBootNode(ListID []string) bool

func (*Boots) GetPingPong

func (TBoot *Boots) GetPingPong(ListIDString []string) []LocalPongInfo

GetPingPong get specified ID pingpong

func (*Boots) HandleGetPingPongReq

func (TBoot *Boots) HandleGetPingPongReq(AnalyData p2p.Custsend)

HandleGetPingPongReq handle get pingpong req

func (*Boots) HandleGetPingPongRsp

func (TBoot *Boots) HandleGetPingPongRsp(AnalyData p2p.Custsend)

HandleGetPingPongRsp handle get pingpong rsp

func (*Boots) HandleP2PMessage

func (TBoot *Boots) HandleP2PMessage()

HandleP2PMessage :read mine recv chan

func (*Boots) IsBootNode

func (TBoot *Boots) IsBootNode(AimID string) (bool, []string)

IsBootNode check if it is boot node

func (*Boots) MakeSendMsg

func (TBoot *Boots) MakeSendMsg(fromip string, toip string, istcp bool, code uint64, Type uint64) p2p.Custsend

MakeSendMsg make send msg to p2p

func (*Boots) ReadRecvChanfromP2P

func (TBoot *Boots) ReadRecvChanfromP2P()

ReadRecvChanfromP2P read recv chan from p2p

func (*Boots) Run

func (TBoot *Boots) Run()

Run boot main function

type GetHeightReq

type GetHeightReq struct {
}

GetHeightReq get height req

type GetHeightRsp

type GetHeightRsp struct {
	BlockHeight uint64
}

GetHeightRsp get height rsp

type GetMainNodeReq

type GetMainNodeReq struct {
}

GetMainNodeReq get mainnode req

type GetMainNodeRsp

type GetMainNodeRsp struct {
}

GetMainNodeRsp get main node rsp

type GetPingReq

type GetPingReq struct {
}

GetPingReq get ping req

type GetPingRsp

type GetPingRsp struct {
	Msg uint64
}

GetPingRsp get ping rsp

type LocalHeightInfo

type LocalHeightInfo struct {
	IP  string
	Len uint64
}

LocalHeightInfo local height info

type LocalMainNodeList

type LocalMainNodeList struct {
	IP string
}

LocalMainNodeList local mainnode list

type LocalPongInfo

type LocalPongInfo struct {
	IP string
	// contains filtered or unexported fields
}

LocalPongInfo local pong info

type REboot

type REboot struct {
	NetFlag int
	Height  uint64
}

REboot return result

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL