Documentation ¶
Index ¶
Constants ¶
View Source
const ( // MaxOCRMsgLength is the maximum allowed length for a data payload in bytes // This is exported as serialization tests depend on it. // NOTE: This is slightly larger than 2x of the largest message we can // possibly send, assuming N=31. MaxOCRMsgLength = 10000 )
Variables ¶
This section is empty.
Functions ¶
func NewPeer ¶
func NewPeer(c PeerConfig) (*concretePeerV2, error)
Users are expected to create (using the OCR*Factory() methods) and close endpoints and bootstrappers before calling Close() on the peer itself.
Types ¶
type EndpointConfigV2 ¶
type EndpointConfigV2 struct { // IncomingMessageBufferSize is the per-remote number of incoming // messages to buffer. Any additional messages received on top of those // already in the queue will be dropped. IncomingMessageBufferSize int // OutgoingMessageBufferSize is the per-remote number of outgoing // messages to buffer. Any additional messages send on top of those // already in the queue will displace the oldest. // NOTE: OutgoingMessageBufferSize should be comfortably smaller than remote's // IncomingMessageBufferSize to give the remote enough space to process // them all in case we regained connection and now send a bunch at once OutgoingMessageBufferSize int }
type NewStreamArgs ¶
type NewStreamArgs interface {
// contains filtered or unexported methods
}
type NewStreamArgs1 ¶
type NewStreamArgs1 struct { StreamName string OutgoingBufferSize int // number of messages that fit in the outgoing buffer IncomingBufferSize int // number of messages that fit in the incoming buffer MaxMessageLength int MessagesLimit ragep2p.TokenBucketParams // rate limit for incoming messages BytesLimit ragep2p.TokenBucketParams // rate limit for incoming messages }
type PeerConfig ¶
type PeerConfig struct { PrivKey ed25519.PrivateKey Logger commontypes.Logger // V2ListenAddresses contains the addresses the peer will listen to on the network in <ip>:<port> form as // accepted by net.Listen. V2ListenAddresses []string // V2AnnounceAddresses contains the addresses the peer will advertise on the network in <ip>:<port> form as // accepted by net.Dial. The addresses should be reachable by peers of interest. // May be left unspecified, in which case the announce addresses are auto-detected based on V2ListenAddresses. V2AnnounceAddresses []string // Every V2DeltaReconcile a Reconcile message is sent to every peer. V2DeltaReconcile time.Duration // Dial attempts will be at least V2DeltaDial apart. V2DeltaDial time.Duration V2DiscovererDatabase nettypes.DiscovererDatabase V2EndpointConfig EndpointConfigV2 MetricsRegisterer prometheus.Registerer LatencyMetricsServiceConfigs []*rageping.LatencyMetricsServiceConfig }
type PeerGroup ¶
type PeerGroup interface { // See ragep2p.Host NewStream for details on the parameters. The stream will // be automatically closed upon closure of the peer group. The // streamName must be prefixed as dictated by the config digest prefix used // in NewPeerGroup. NewStream(remotePeerID string, newStreamArgs NewStreamArgs) (Stream, error) // Close closes all opened streams, and stops peer discovery for the group. // Future calls to NewStream will error. Close() error }
type PeerGroupFactory ¶
type PeerGroupFactory interface { // This call is necessary for peer discovery to work among the group // configured in the parameters. Once the peer group is closed, peer // discovery will cease, and all streams created under the peer group // will be automatically closed. For pure bootstrapping, it is expected to // invoke NewPeerGroup and never create any streams using NewStream. NewPeerGroup( configDigest ocr2types.ConfigDigest, peerIDs []string, bootstrappers []commontypes.BootstrapperLocator, ) (PeerGroup, error) }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.