Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrOverflowLength = errors.New("Overflow string length")
)
peermessage errors
Functions ¶
This section is empty.
Types ¶
type ConnectInfo ¶
type ConnectInfo struct { Address string Hash string PingTime time.Duration PingScoreBoard *ScoreBoardMap }
ConnectInfo is a structure of connection information that includes ping time and score board.
func NewConnectInfo ¶
func NewConnectInfo(addr string, hash string, t time.Duration) ConnectInfo
NewConnectInfo is creator of ConnectInfo
func (*ConnectInfo) ReadFrom ¶
func (ci *ConnectInfo) ReadFrom(r io.Reader) (int64, error)
ReadFrom is a deserialization function
func (*ConnectInfo) Score ¶
func (ci *ConnectInfo) Score() (score int64)
Score is calculated and returned based on the ping time.
type ScoreBoardMap ¶
type ScoreBoardMap struct {
// contains filtered or unexported fields
}
ScoreBoardMap is the structure that stores the ping time of each peer.
func (*ScoreBoardMap) Delete ¶
func (n *ScoreBoardMap) Delete(key string)
Delete deletes the value for a key.
func (*ScoreBoardMap) Load ¶
func (n *ScoreBoardMap) Load(key string) (time.Duration, bool)
Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.
Click to show internal directories.
Click to hide internal directories.