Documentation ¶
Index ¶
- Constants
- Variables
- func AddressToEndpoint(endpoint string) (string, error)
- func GetRandomBytes(len int) ([]byte, error)
- func GetRandomNonce() ([]byte, error)
- func NewDelimitedReader(r io2.Reader, maxSize int) io.ReadCloser
- type ConfigService
- type EndpointService
- type Metrics
- type MetricsReporter
- func (r *MetricsReporter) GetBandwidthByPeer() map[peer.ID]metrics.Stats
- func (r *MetricsReporter) GetBandwidthByProtocol() map[protocol.ID]metrics.Stats
- func (r *MetricsReporter) GetBandwidthForPeer(peer.ID) metrics.Stats
- func (r *MetricsReporter) GetBandwidthForProtocol(protocol.ID) metrics.Stats
- func (r *MetricsReporter) GetBandwidthTotals() metrics.Stats
- func (r *MetricsReporter) LogRecvMessage(int64)
- func (r *MetricsReporter) LogRecvMessageStream(size int64, proto protocol.ID, p peer.ID)
- func (r *MetricsReporter) LogSentMessage(int64)
- func (r *MetricsReporter) LogSentMessageStream(size int64, proto protocol.ID, p peer.ID)
- type Network
- type NetworkStreamSession
- type P2PNode
- func (p *P2PNode) DeleteSessions(sessionID string)
- func (p *P2PNode) Lookup(peerID string) (peer.AddrInfo, bool)
- func (p *P2PNode) MasterSession() (view.Session, error)
- func (p *P2PNode) NewSession(callerViewID string, contextID string, endpoint string, pkid []byte) (view.Session, error)
- func (p *P2PNode) NewSessionWithID(sessionID, contextID, endpoint string, pkid []byte, caller view.Identity, ...) (view.Session, error)
- func (p *P2PNode) Start(ctx context.Context)
- func (p *P2PNode) Stop()
- type PrivateKeyDispenser
- type PrivateKeyFromCryptoKey
- type PrivateKeyFromFile
- type Service
- func (s *Service) Addresses(id view2.Identity) ([]string, error)
- func (s *Service) DeleteSessions(sessionID string)
- func (s *Service) MasterSession() (view2.Session, error)
- func (s *Service) NewSession(caller string, contextID string, endpoint string, pkid []byte) (view2.Session, error)
- func (s *Service) NewSessionWithID(sessionID, contextID, endpoint string, pkid []byte, caller view2.Identity, ...) (view2.Session, error)
- func (s *Service) Start(ctx context.Context)
- func (s *Service) Stop()
- type ViewPacket
- func (*ViewPacket) Descriptor() ([]byte, []int)deprecated
- func (x *ViewPacket) GetCaller() string
- func (x *ViewPacket) GetContextID() string
- func (x *ViewPacket) GetPayload() []byte
- func (x *ViewPacket) GetSessionID() string
- func (x *ViewPacket) GetStatus() int32
- func (*ViewPacket) ProtoMessage()
- func (x *ViewPacket) ProtoReflect() protoreflect.Message
- func (x *ViewPacket) Reset()
- func (x *ViewPacket) String() string
Constants ¶
View Source
const ( PeerId = "peer" ProtocolId = "protocol" )
View Source
const (
// NonceSize is the default NonceSize
NonceSize = 24
)
Variables ¶
View Source
var File_messages_proto protoreflect.FileDescriptor
Functions ¶
func AddressToEndpoint ¶
func GetRandomBytes ¶
GetRandomBytes returns len random looking bytes
func GetRandomNonce ¶
GetRandomNonce returns a random byte array of length NonceSize
func NewDelimitedReader ¶
func NewDelimitedReader(r io2.Reader, maxSize int) io.ReadCloser
Types ¶
type ConfigService ¶
type EndpointService ¶
type Metrics ¶ added in v0.3.0
func NewMetrics ¶ added in v0.3.0
type MetricsReporter ¶ added in v0.3.0
type MetricsReporter struct {
// contains filtered or unexported fields
}
func NewReporter ¶ added in v0.3.0
func NewReporter(m *Metrics) *MetricsReporter
func (*MetricsReporter) GetBandwidthByPeer ¶ added in v0.3.0
func (r *MetricsReporter) GetBandwidthByPeer() map[peer.ID]metrics.Stats
func (*MetricsReporter) GetBandwidthByProtocol ¶ added in v0.3.0
func (r *MetricsReporter) GetBandwidthByProtocol() map[protocol.ID]metrics.Stats
func (*MetricsReporter) GetBandwidthForPeer ¶ added in v0.3.0
func (r *MetricsReporter) GetBandwidthForPeer(peer.ID) metrics.Stats
func (*MetricsReporter) GetBandwidthForProtocol ¶ added in v0.3.0
func (r *MetricsReporter) GetBandwidthForProtocol(protocol.ID) metrics.Stats
func (*MetricsReporter) GetBandwidthTotals ¶ added in v0.3.0
func (r *MetricsReporter) GetBandwidthTotals() metrics.Stats
func (*MetricsReporter) LogRecvMessage ¶ added in v0.3.0
func (r *MetricsReporter) LogRecvMessage(int64)
func (*MetricsReporter) LogRecvMessageStream ¶ added in v0.3.0
func (*MetricsReporter) LogSentMessage ¶ added in v0.3.0
func (r *MetricsReporter) LogSentMessage(int64)
func (*MetricsReporter) LogSentMessageStream ¶ added in v0.3.0
type NetworkStreamSession ¶
type NetworkStreamSession struct {
// contains filtered or unexported fields
}
NetworkStreamSession implements view.Session
func (*NetworkStreamSession) Close ¶
func (n *NetworkStreamSession) Close()
Close releases all the resources allocated by this session
func (*NetworkStreamSession) Info ¶
func (n *NetworkStreamSession) Info() view.SessionInfo
func (*NetworkStreamSession) Receive ¶
func (n *NetworkStreamSession) Receive() <-chan *view.Message
Receive returns a channel of messages received from the endpoint
func (*NetworkStreamSession) Send ¶
func (n *NetworkStreamSession) Send(payload []byte) error
Send sends the payload to the endpoint
func (*NetworkStreamSession) SendError ¶
func (n *NetworkStreamSession) SendError(payload []byte) error
SendError sends an error to the endpoint with the passed payload
type P2PNode ¶
type P2PNode struct {
// contains filtered or unexported fields
}
func NewBootstrapNode ¶
func NewBootstrapNode(ListenAddress string, keyDispenser PrivateKeyDispenser, metrics *Metrics) (*P2PNode, error)
func NewNode ¶
func NewNode(ListenAddress, BootstrapNode string, keyDispenser PrivateKeyDispenser, metrics *Metrics) (*P2PNode, error)
func (*P2PNode) DeleteSessions ¶
func (*P2PNode) NewSession ¶
func (*P2PNode) NewSessionWithID ¶
type PrivateKeyDispenser ¶
func GetPrivateKeyDispenser ¶
func GetPrivateKeyDispenser(sp view2.ServiceProvider) PrivateKeyDispenser
type PrivateKeyFromCryptoKey ¶
func (*PrivateKeyFromCryptoKey) PrivateKey ¶
func (p *PrivateKeyFromCryptoKey) PrivateKey() (crypto.PrivKey, error)
type PrivateKeyFromFile ¶
type PrivateKeyFromFile struct {
PrivateKeyFile string
}
func (*PrivateKeyFromFile) PrivateKey ¶
func (p *PrivateKeyFromFile) PrivateKey() (crypto.PrivKey, error)
type Service ¶
type Service struct { PrivateKeyDispenser PrivateKeyDispenser EndpointService EndpointService ConfigService ConfigService DefaultIdentity view2.Identity Metrics *Metrics Node *P2PNode NodeSync sync.RWMutex }
func NewService ¶
func NewService( privateKeyDispenser PrivateKeyDispenser, endpointService EndpointService, configService ConfigService, defaultIdentity view2.Identity, metrics *Metrics, ) (*Service, error)
func (*Service) DeleteSessions ¶
func (*Service) NewSession ¶
func (*Service) NewSessionWithID ¶
type ViewPacket ¶
type ViewPacket struct { SessionID string `protobuf:"bytes,1,opt,name=sessionID,proto3" json:"sessionID,omitempty"` ContextID string `protobuf:"bytes,2,opt,name=contextID,proto3" json:"contextID,omitempty"` Status int32 `protobuf:"varint,3,opt,name=status,proto3" json:"status,omitempty"` Payload []byte `protobuf:"bytes,4,opt,name=payload,proto3" json:"payload,omitempty"` Caller string `protobuf:"bytes,5,opt,name=caller,proto3" json:"caller,omitempty"` // contains filtered or unexported fields }
func (*ViewPacket) Descriptor
deprecated
func (*ViewPacket) Descriptor() ([]byte, []int)
Deprecated: Use ViewPacket.ProtoReflect.Descriptor instead.
func (*ViewPacket) GetCaller ¶
func (x *ViewPacket) GetCaller() string
func (*ViewPacket) GetContextID ¶
func (x *ViewPacket) GetContextID() string
func (*ViewPacket) GetPayload ¶
func (x *ViewPacket) GetPayload() []byte
func (*ViewPacket) GetSessionID ¶
func (x *ViewPacket) GetSessionID() string
func (*ViewPacket) GetStatus ¶
func (x *ViewPacket) GetStatus() int32
func (*ViewPacket) ProtoMessage ¶
func (*ViewPacket) ProtoMessage()
func (*ViewPacket) ProtoReflect ¶
func (x *ViewPacket) ProtoReflect() protoreflect.Message
func (*ViewPacket) Reset ¶
func (x *ViewPacket) Reset()
func (*ViewPacket) String ¶
func (x *ViewPacket) String() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.