util

package
v0.0.0-...-2e66602 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const MaxLen = 25 * 1024 * 1024

从中心化服务端取数据,最多取1024*1024*8 (8M字节数据)

Variables

This section is empty.

Functions

func CiphData

func CiphData(toCipher DefsV2) string

func GetBootnodesInfo

func GetBootnodesInfo(uri string) (bootnodes []string, reportAddress []string, err error)

func GetDataFromServer

func GetDataFromServer(url string) (data []byte, err error)

func SendDataToServers

func SendDataToServers(hosts []string, cmd string, timeout time.Duration, data []byte) error

Types

type Defs

type Defs struct {
	BootNodes  []string
	ReportAddr string
}

type DefsV2

type DefsV2 struct {
	BootNodes   []string
	ReportAddrs []string
}

func DecipherData

func DecipherData(cipherData string) (*DefsV2, error)

type HttpReader

type HttpReader struct {
	// contains filtered or unexported fields
}

func CreateHttpReader

func CreateHttpReader() *HttpReader

func (*HttpReader) GetChunkFromCentral

func (hr *HttpReader) GetChunkFromCentral(uri string, start int64, topHash []byte, r *http.Request) (result []byte, isEnd bool)

func (*HttpReader) GetDataFromCentralServer

func (s *HttpReader) GetDataFromCentralServer(uri string, r *http.Request, w http.ResponseWriter, hash []byte, onError OnError) (retrieved bool)

get data from server and write to response

func (*HttpReader) GetDataLenFromCenter

func (hr *HttpReader) GetDataLenFromCenter() int64

func (*HttpReader) SetCdnReporter

func (hr *HttpReader) SetCdnReporter(account string, serverUrls []string)

type OnError

type OnError func(http.ResponseWriter, *http.Request, string, int)

type ReportData

type ReportData map[time.Time]int64

func (*ReportData) DecodeRLP

func (rd *ReportData) DecodeRLP(s *rlp.Stream) error

func (*ReportData) EncodeRLP

func (r *ReportData) EncodeRLP(w io.Writer) error

type ReportFmt

type ReportFmt struct {
	Account [20]byte
	Hash    []byte
	Data    []byte
}

type RpData

type RpData struct {
	Stime   uint32
	MSec    uint32
	AmountH uint32
	AmountL uint32
}

Jump to

Keyboard shortcuts

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