request

package
v0.0.0-...-83390d5 Latest Latest
Warning

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

Go to latest
Published: May 4, 2016 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Challenge

type Challenge struct {
	// It identifys the demand to be sure the request is not reused
	ID uint64
	// A random slice wich must be find by the requester
	ChallengeTarget []byte
	// To have the difficulty in the request to be able
	// to manage different difficultyes (it's in bits)
	Difficulty uint16
	// Expire define the time after what the challenge is set as unvalid (and removed from RAM tree)
	Expire time.Time

	Err error `json:"-"`
}

Challenge represent the server challenge

func BuildNewRequestChalange

func BuildNewRequestChalange(difficulty uint16, expire time.Time) (*Challenge, error)

BuildNewRequestChalange build a challenge object and save it in memory unsing a btree list

func (*Challenge) AsJSON

func (c *Challenge) AsJSON() []byte

AsJSON just return the slice of byte, it's the JSON representation of the struct.

func (Challenge) Less

func (c Challenge) Less(thanItem btree.Item) bool

Less implement the btree specification It is based on the ID (it's a big uint)

Jump to

Keyboard shortcuts

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