network

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2022 License: Unlicense Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AmountRequest added in v1.0.8

type AmountRequest struct {
	Address *string
}

func (*AmountRequest) IsInvalid added in v1.0.8

func (amountRequest *AmountRequest) IsInvalid() bool

type AmountResponse added in v1.0.8

type AmountResponse struct {
	Amount uint64
}

type BlockResponse added in v1.0.8

type BlockResponse struct {
	Timestamp           int64
	PreviousHash        [32]byte
	Transactions        []*TransactionResponse
	RegisteredAddresses []string
}

type IpFinder added in v1.0.8

type IpFinder interface {
	LookupIP(ip string) ([]net.IP, error)
	DialTimeout(network, address string, timeout time.Duration) (net.Conn, error)
}

type Neighbor

type Neighbor interface {
	Ip() string
	Port() uint16
	Target() string
	GetBlocks() (blockResponses []*BlockResponse, err error)
	SendTargets(request []TargetRequest) (err error)
	AddTransaction(request TransactionRequest) (err error)
	GetTransactions() (transactionResponses []TransactionResponse, err error)
	GetAmount(request AmountRequest) (amountResponse *AmountResponse, err error)
	Mine() (err error)
	StartMining() (err error)
	StopMining() error
}

type Synchronizer

type Synchronizer interface {
	AddTargets(requests []TargetRequest)
	Neighbors() []Neighbor
}

type TargetRequest added in v1.0.8

type TargetRequest struct {
	Ip   *string
	Port *uint16
}

type TransactionRequest added in v1.0.8

type TransactionRequest struct {
	RecipientAddress *string
	SenderAddress    *string
	SenderPublicKey  *string
	Signature        *string
	Timestamp        *int64
	Value            *uint64
	Fee              *uint64
}

func (*TransactionRequest) IsInvalid added in v1.0.8

func (transactionRequest *TransactionRequest) IsInvalid() bool

type TransactionResponse added in v1.0.8

type TransactionResponse struct {
	RecipientAddress string
	SenderAddress    string
	SenderPublicKey  string
	Signature        string
	Timestamp        int64
	Value            uint64
	Fee              uint64
}

Directories

Path Synopsis
p2p
net

Jump to

Keyboard shortcuts

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