core

package
v0.0.0-...-f5aa18a Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2017 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JoinMsgID = iota
	JoinAckID
	SubReqID
	ChunkHaveID
	ChunkReqID
	ChunkReqAckID
	TranscodeMsgID
	HaveMsgID
)

Variables

View Source
var LivepeerProtocol = protocol.ID("/livepeer")

var P_LIVEPEER = 422

Functions

func RandomStreamID

func RandomStreamID() string

Types

type ChunkHaveMsg

type ChunkHaveMsg struct {
	ChunkName string
	StreamID  string
	PeerID    string
	Addr      string
}

type ChunkReqAckMsg

type ChunkReqAckMsg struct {
	ChunkName string
	StreamID  string
	Data      string //hex encoded
}

type ChunkReqMsg

type ChunkReqMsg struct {
	ChunkName string
	StreamID  string
	Peer      string
}

type ChunkSubscriber

type ChunkSubscriber struct {
	Buffer *stream.HLSBuffer
	Node   *LivepeerNode
}

func NewChunkSubscriber

func NewChunkSubscriber(buf *stream.HLSBuffer, n *LivepeerNode) *ChunkSubscriber

func (*ChunkSubscriber) WriteSegment

func (cs *ChunkSubscriber) WriteSegment(seqNo uint64, name string, duration float64, s []byte) error

type JoinMsg

type JoinMsg struct {
	ID   string
	Addr string
}

type LivepeerNode

type LivepeerNode struct {
	// Self
	Identity  peer.ID             // the local node's identity
	Peerstore ps.Peerstore        // storage for other Peer instances
	Routing   routing.IpfsRouting // the routing system. recommend ipfs-dht
	Priv      crypto.PrivKey
	Pub       crypto.PubKey

	PeerHost    p2phost.Host             // the network host (server+client)
	StreamPeers map[string][]ps.PeerInfo // the network host (server+client)
	HLSBuf      *lpmsStream.HLSBuffer
}

func NewNode

func NewNode(listenPort int, priv crypto.PrivKey, pub crypto.PubKey) (*LivepeerNode, error)

NewNode creates a new Livepeerd node.

func (*LivepeerNode) SendChunkReq

func (n *LivepeerNode) SendChunkReq(peer ps.PeerInfo, cn, strmID string)

func (*LivepeerNode) SendChunkReqAck

func (n *LivepeerNode) SendChunkReqAck(peer ps.PeerInfo, cn, strmID string, data []byte)

func (*LivepeerNode) SendHaveChunk

func (n *LivepeerNode) SendHaveChunk(name, strmID string)

Takes a HLS stream and sends HAVE messages for each chunk to known peers

func (*LivepeerNode) SendJoin

func (n *LivepeerNode) SendJoin(pid peer.ID)

func (*LivepeerNode) SendJoinAck

func (n *LivepeerNode) SendJoinAck(pid peer.ID)

func (*LivepeerNode) SendSubscribeReq

func (n *LivepeerNode) SendSubscribeReq(strmID StreamID)

type Message

type Message struct {
	Msg  int
	Data interface{}
}

type StreamID

type StreamID string

func MakeStreamID

func MakeStreamID(nodeID peer.ID, id string) StreamID

func (*StreamID) SplitComponents

func (self *StreamID) SplitComponents() (peer.ID, string)

Given a stream ID, return it's origin nodeID and the unique stream ID

func (*StreamID) String

func (self *StreamID) String() string

type SubReqMsg

type SubReqMsg struct {
	ID   string
	Addr string
	SID  string
}

type Transcode

type Transcode struct {
	StrmID string
}

type WrappedStream

type WrappedStream struct {
	Stream net.Stream
	Enc    multicodec.Encoder
	Dec    multicodec.Decoder
	Writer *bufio.Writer
	Reader *bufio.Reader
}

func WrapStream

func WrapStream(s net.Stream) *WrappedStream

Jump to

Keyboard shortcuts

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