core

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DataInfoVersion1, _ = ParseVersion("v0.0.1")

DataInfoVersion1 ...

Functions

func DummyEmpty

func DummyEmpty() interface{}

DummyEmpty ...

Types

type API

type API interface {
	Ping(ctx context.Context, req *PingReq) (*PingResp, error)
	ID(ctx context.Context, req *IDReq) (*IDResp, error)
	Add(ctx context.Context, req *AddReq) (*AddResp, error)
	NodeAPI() NodeAPI
	DataStoreAPI() DataStoreAPI
}

API ...

type AddReq

type AddReq struct {
	//Setting options.UnixfsAddSettings
	Type  AddType
	JSNFO string
	Data  []byte
	Hash  string
}

AddReq ...

type AddResp

type AddResp struct {
	IsSuccess bool
	Hash      string
}

AddResp ...

type AddType

type AddType int

AddType ...

const (
	// AddNone ...
	AddNone AddType = iota
	// AddOnlyInfo ...
	AddOnlyInfo
	// AddOnlyFile ...
	AddOnlyFile
	// AddBoth ...
	AddBoth
)
const AddTypePeer AddType = 0x01

AddTypePeer ...

type AddrInfo

type AddrInfo struct {
	ID        string                `json:"id"`
	PublicKey string                `json:"public_key"`
	Addrs     map[ma.Multiaddr]bool `json:"addrs"`
	DataStore DataStoreInfo         `json:"data_store"`
}

AddrInfo ...

func NewAddrInfo

func NewAddrInfo(id string, addrs ...string) *AddrInfo

NewAddrInfo ...

func (*AddrInfo) AppendAddr

func (info *AddrInfo) AppendAddr(multiaddr ma.Multiaddr)

AppendAddr ...

func (*AddrInfo) GetAddrs

func (info *AddrInfo) GetAddrs() (addrs []ma.Multiaddr)

GetAddrs ...

func (AddrInfo) MarshalJSON

func (info AddrInfo) MarshalJSON() ([]byte, error)

MarshalJSON ...

func (*AddrInfo) SetDataStoreInfo

func (info *AddrInfo) SetDataStoreInfo(dataStoreInfo DataStoreInfo)

SetDataStoreInfo ...

func (*AddrInfo) SetID

func (info *AddrInfo) SetID(id string)

SetID ...

func (*AddrInfo) UnmarshalJSON

func (info *AddrInfo) UnmarshalJSON(bytes []byte) error

UnmarshalJSON ...

type AddrReq

type AddrReq struct {
	ID string
}

AddrReq ...

type AddrResp

type AddrResp struct {
	AddrInfo AddrInfo
}

AddrResp ...

type Clique

type Clique struct {
	Epoch  int64 `json:"epoch"`
	Period int64 `json:"period"`
}

Clique ...

type Config

type Config struct {
	ByzantiumBlock      int64  `json:"byzantiumBlock"`
	ChainID             int64  `json:"chainId"`
	Clique              Clique `json:"clique"`
	ConstantinopleBlock int64  `json:"constantinopleBlock"`
	Eip150Block         int64  `json:"eip150Block"`
	Eip150Hash          string `json:"eip150Hash"`
	Eip155Block         int64  `json:"eip155Block"`
	Eip158Block         int64  `json:"eip158Block"`
	HomesteadBlock      int64  `json:"homesteadBlock"`
}

Config ...

type ConnectToReq

type ConnectToReq struct {
}

ConnectToReq ...

type ConnectToResp

type ConnectToResp struct {
	Node
}

ConnectToResp ...

type ContractInfo

type ContractInfo struct {
	Enode      string    `json:"enode"`
	Enr        string    `json:"enr"`
	ID         string    `json:"id"`
	IP         string    `json:"ip"`
	ListenAddr string    `json:"listenAddr"`
	Name       string    `json:"name"`
	Ports      Ports     `json:"ports"`
	Protocols  Protocols `json:"protocols"`
}

ContractInfo ...

type ControllerService

type ControllerService interface {
	Start() error
	Stop() error
	Initialize() error
	IsReady() bool
	MessageHandle(func(s string))
}

ControllerService ...

type DataHashEncoder

type DataHashEncoder interface {
	Hash() string
	Verify(s string) bool
}

DataHashEncoder ...

type DataInfoV1

type DataInfoV1 struct {
	RootHash   string    `xorm:"root_hash" json:"root_hash"`     //源信息
	MediaInfo  MediaInfo `xorm:"media_info" json:"media_info"`   //媒体信息
	MediaURI   string    `xorm:"media_uri" json:"media_uri"`     //入口地址
	MediaHash  string    `xorm:"media_hash" json:"media_hash"`   //入口HASH
	MediaIndex string    `xorm:"media_index" json:"media_index"` //入口名称
	Info       Info      `xorm:"info" json:"info"`               //补充信息
	InfoURI    string    `xorm:"info_uri" json:"info_uri"`       //补充信息地址
	Security   Security  `xorm:"security" json:"security"`       //安全验证
	LastUpdate int64     `xorm:"last_update" json:"last_update"` //最后更新时间
	Version    Version   `xorm:"version" json:"version"`         //版本
}

DataInfoV1 ...

func (*DataInfoV1) Hash

func (v *DataInfoV1) Hash() string

Hash ...

func (*DataInfoV1) JSON

func (v *DataInfoV1) JSON() string

JSON ...

func (*DataInfoV1) Marshal

func (v *DataInfoV1) Marshal() ([]byte, error)

Marshal ...

func (*DataInfoV1) Root

func (v *DataInfoV1) Root() string

Root ...

func (*DataInfoV1) Unmarshal

func (v *DataInfoV1) Unmarshal(b []byte) error

Unmarshal ...

func (*DataInfoV1) Verify

func (v *DataInfoV1) Verify(hash string) bool

Verify ...

func (*DataInfoV1) VerifyVersion

func (v *DataInfoV1) VerifyVersion() bool

VerifyVersion ...

type DataJSONer

type DataJSONer interface {
	JSON() string
}

DataJSONer ...

type DataRooter

type DataRooter interface {
	Root() string
}

DataRooter ...

type DataStoreAPI

type DataStoreAPI interface {
	PinLs(ctx context.Context, req *DataStoreReq) (*DataStoreResp, error)
	UploadFile(ctx context.Context, req *UploadReq) (*UploadResp, error)
}

DataStoreAPI ...

type DataStoreInfo

type DataStoreInfo struct {
	ID              string   `json:"ID"`
	PublicKey       string   `json:"PublicKey"`
	Addresses       []string `json:"Addresses"`
	AgentVersion    string   `json:"AgentVersion"`
	ProtocolVersion string   `json:"ProtocolVersion"`
}

DataStoreInfo ...

type DataStoreReq

type DataStoreReq struct {
}

DataStoreReq ...

type DataStoreResp

type DataStoreResp struct {
	Pins []string
}

DataStoreResp ...

type Empty

type Empty struct {
}

Empty ...

type Eth

type Eth struct {
	Config     Config `json:"config"`
	Difficulty int64  `json:"difficulty"`
	Genesis    string `json:"genesis"`
	Head       string `json:"head"`
	Network    int64  `json:"network"`
}

Eth ...

type GetReq

type GetReq struct {
}

GetReq ...

type GetResp

type GetResp struct {
}

GetResp ...

type IDReq

type IDReq struct {
}

IDReq ...

type IDResp

type IDResp struct {
	ID        string
	PublicKey string
	Addrs     []string
	DataStore DataStoreInfo
}

IDResp ...

type Info

type Info struct {
	ThumbHash  string `xorm:"thumb_hash" json:"thumb_hash"`   //缩略图
	ThumbURI   string `xorm:"thumb_uri" json:"thumb_uri"`     //缩略图
	PosterHash string `xorm:"poster_hash" json:"poster_hash"` //海报地址
	PosterURI  string `xorm:"poster_uri" json:"poster_uri"`   //缩略图
}

Info ...

type JSONer

type JSONer interface {
	Marshaler
	Unmarshaler
}

JSONer ...

type Listener

type Listener interface {
	Listen() error
	Stop() error
}

Listener ...

type LocalData

type LocalData struct {
	Initialized bool
	Node        NodeInfo
	Nodes       map[string]NodeInfo //readonly or change by update
	LDs         map[string]uint8    //readonly or change by update:ipfs linked data
	Addrs       []string
	LastUpdate  int64
}

LocalData ...

func DefaultLocalData

func DefaultLocalData() *LocalData

DefaultLocalData ...

func (LocalData) Safe

func (l LocalData) Safe() SafeLocalData

Safe ...

type Marshaler

type Marshaler interface {
	Marshal() ([]byte, error)
}

Marshaler ...

type MediaInfo

type MediaInfo struct {
	No           string   `json:"no"`            //编号
	Intro        string   `json:"intro"`         //简介
	Alias        []string `json:"alias"`         //别名,片名
	Role         []string `json:"role"`          //主演
	Director     string   `json:"director"`      //导演
	Systematics  string   `json:"systematics"`   //分级
	Season       string   `json:"season"`        //季
	TotalEpisode string   `json:"total_episode"` //总集数
	Episode      string   `json:"episode"`       //集数
	Producer     string   `json:"producer"`      //生产商
	Publisher    string   `json:"publisher"`     //发行商
	Type         string   `json:"type"`          //类型:film,FanDrama
	Format       string   `json:"format"`        //输出格式:3D,2D,VR(VR格式:Half-SBS:左右半宽,Half-OU:上下半高,SBS:左右全宽)
	Language     string   `json:"language"`      //语言
	Caption      string   `json:"caption"`       //字幕
	Group        string   `json:"group"`         //分组
	Index        string   `json:"index"`         //索引
	Date         string   `json:"date"`          //发行日期
	Sharpness    string   `json:"sharpness"`     //清晰度
	Series       string   `json:"series"`        //系列
	Tags         []string `json:"tags"`          //标签
	Length       string   `json:"length"`        //时长
	Sample       []string `json:"sample"`        //样板图
	Uncensored   bool     `json:"uncensored"`    //有码,无码
}

MediaInfo ...

type Node

type Node interface {
	ID() string
	Ping() (string, error)
	Addrs() []ma.Multiaddr
	DataStoreInfo() (DataStoreInfo, error)
	GetInfo() (NodeInfo, error)
	Close() (err error)
	IsClosed() bool
	AppendAddr(addrs ...ma.Multiaddr)
	SendClose()
	Peers() ([]NodeInfo, error)
	SendConnected() error
	LDs() ([]string, error)
}

Node ...

type NodeAPI

type NodeAPI interface {
	Add(ctx context.Context, req *AddReq) (*AddResp, error)
	Link(ctx context.Context, req *NodeLinkReq) (*NodeLinkResp, error)
	Unlink(ctx context.Context, req *NodeUnlinkReq) (*NodeUnlinkResp, error)
	List(ctx context.Context, req *NodeListReq) (*NodeListResp, error)
	NodeAddrInfo(ctx context.Context, req *AddrReq) (*AddrResp, error)
}

NodeAPI ...

type NodeInfo

type NodeInfo struct {
	AddrInfo
	AgentVersion    string
	ProtocolVersion string
}

NodeInfo ...

func (*NodeInfo) JSON

func (i *NodeInfo) JSON() string

JSON ...

func (NodeInfo) Marshal

func (i NodeInfo) Marshal() ([]byte, error)

Marshal ...

func (*NodeInfo) Unmarshal

func (i *NodeInfo) Unmarshal(bytes []byte) error

Unmarshal ...

type NodeLinkReq

type NodeLinkReq struct {
	ByID    bool
	Names   []string
	Addrs   []string
	Timeout time.Duration
}

NodeLinkReq ...

type NodeLinkResp

type NodeLinkResp struct {
	Err       error
	NodeInfos []NodeInfo
}

NodeLinkResp ...

type NodeListReq

type NodeListReq struct {
}

NodeListReq ...

type NodeListResp

type NodeListResp struct {
	Nodes map[string]NodeInfo
}

NodeListResp ...

type NodeManager

type NodeManager interface {
	NodeAPI() NodeAPI
	Local() SafeLocalData
	Close()
	Push(n Node)
	Range(f func(key string, node Node) bool)
	Conn(c net.Conn) (Node, error)
	SaveNode() error
	LoadNode() error

	//RegisterLDRequest(func() ([]string, error))
	RegisterAddrCallback(f func(info peer.AddrInfo) error)
	ConnRemoteFromHash(hash string) error
}

NodeManager ...

type NodeType

type NodeType int

NodeType ...

const (
	// NodeUndefined ...
	NodeUndefined NodeType = 0x00
	// NodeAccount ...
	NodeAccount NodeType = 0x01
	// NodeAccelerate ...
	NodeAccelerate NodeType = 0x02
	// NodeRoute ...
	NodeRoute NodeType = 0x03
)

func (NodeType) CompareInt

func (t NodeType) CompareInt(i int) bool

CompareInt ...

type NodeUnlinkReq

type NodeUnlinkReq struct {
	Peers []string
}

NodeUnlinkReq ...

type NodeUnlinkResp

type NodeUnlinkResp struct {
}

NodeUnlinkResp ...

type PayReq

type PayReq struct {
}

PayReq ...

type PayResp

type PayResp struct {
}

PayResp ...

type PingReq

type PingReq struct {
}

PingReq ...

type PingResp

type PingResp struct {
	Data string
}

PingResp ...

type Ports

type Ports struct {
	Discovery int64 `json:"discovery"`
	Listener  int64 `json:"listener"`
}

Ports ...

type Protocols

type Protocols struct {
	Eth Eth `json:"eth"`
}

Protocols ...

type RecvCBFunc

type RecvCBFunc func(id string, v interface{}) ([]byte, error)

RecvCBFunc ...

type RequestTag

type RequestTag int

RequestTag ...

const RequestTagLink RequestTag = iota

RequestTagLink ...

type SafeLocalData

type SafeLocalData interface {
	JSONer
	JSON() string
	Update(f func(data *LocalData))
	Data() (data LocalData)
}

SafeLocalData ...

type Security

type Security struct {
	Key string `xorm:"key" json:"key"`
}

Security ...

type Serializable

type Serializable interface {
	JSONer
	DataRooter
	DataHashEncoder
	DataJSONer
}

Serializable ...

type Unmarshaler

type Unmarshaler interface {
	Unmarshal([]byte) error
}

Unmarshaler ...

type UploadReq

type UploadReq struct {
	Path string
}

UploadReq ...

type UploadResp

type UploadResp struct {
	Hash string
}

UploadResp ...

type Version

type Version [4]byte

Version ...

func ParseVersion

func ParseVersion(s string) (Version, error)

ParseVersion ...

func (Version) Compare

func (v Version) Compare(version Version) int

Compare ...

func (Version) String

func (v Version) String() string

String ...

Jump to

Keyboard shortcuts

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