Documentation ¶
Index ¶
- Constants
- Variables
- func EdKeyPair(kp KeyPair) secrethandshake.EdKeyPair
- func EncodeKeyPairAsJSON(kp KeyPair, w io.Writer) error
- func FeedsWithSequnce(feedIndex multilog.MultiLog) (luigi.Source, error)
- func GetFeedRefFromAddr(addr net.Addr) (refs.FeedRef, error)
- func IsMessageUnusable(err error) bool
- func IsValidFeedFormat(r refs.FeedRef) error
- func SaveKeyPair(kp KeyPair, path string) error
- type Authorizer
- type BlobStore
- type BlobStoreBroadcaster
- type BlobStoreEmitter
- type BlobStoreNotification
- type BlobStoreOp
- type BlobWant
- type BlobWantsBroadcaster
- type BlobWantsEmitter
- type CancelFunc
- type ConnTracker
- type ContentNuller
- type DropContentRequest
- type EndpointStat
- type ErrMalfromedMsg
- type ErrOutOfReach
- type ErrWrongSequence
- type ErrWrongType
- type Getter
- type IndexState
- type IndexStates
- type Indexer
- type KeyPair
- type LegacyKeyPair
- type MultiLogGetter
- type Network
- type NetworkFrontier
- type Note
- type PeerStatus
- type Plugin
- type PluginManager
- type Publisher
- type ReplicateUpToResponse
- type ReplicationLister
- type Replicator
- type SimpleIndexGetter
- type Status
- type Statuser
- type StrFeedSet
- type WantManager
Constants ¶
const DropContentRequestType = "drop-content-request"
Variables ¶
var ErrShuttingDown = fmt.Errorf("ssb: shutting down now") // this is fine
var ErrUnuspportedFormat = fmt.Errorf("ssb: unsupported format")
var SecretPerms = os.FileMode(0600)
SecretPerms are the file permissions for holding SSB secrets. We expect the file to only be accessable by the owner.
Functions ¶
func EdKeyPair ¶ added in v0.2.1
func EdKeyPair(kp KeyPair) secrethandshake.EdKeyPair
func EncodeKeyPairAsJSON ¶
EncodeKeyPairAsJSON serializes the passed Keypair into the writer w
func FeedsWithSequnce ¶
FeedsWithSequnce returns a source that emits one ReplicateUpToResponse per stored feed in feedIndex TODO: make cancelable and with no RAM overhead when only partially used (iterate on demand)
func GetFeedRefFromAddr ¶
GetFeedRefFromAddr uses netwrap to get the secretstream address and then uses ParseFeedRef
func IsMessageUnusable ¶
func IsValidFeedFormat ¶
IsValidFeedFormat checks if the passed FeedRef is for one of the two supported formats, legacy/crapp or GabbyGrove.
func SaveKeyPair ¶
SaveKeyPair serializes the passed KeyPair to path. It errors if path already exists.
Types ¶
type Authorizer ¶
type BlobStore ¶
type BlobStore interface { // Get returns a reader of the blob with given ref. Get(ref refs.BlobRef) (io.ReadCloser, error) // Put stores the data in the reader in the blob store and returns the address. Put(blob io.Reader) (refs.BlobRef, error) // Delete deletes a blob from the blob store. Delete(ref refs.BlobRef) error // List returns a source of the refs of all stored blobs. List() luigi.Source // Size returns the size of the blob with given ref. Size(ref refs.BlobRef) (int64, error) // Register allows to get notified when the store changes BlobStoreBroadcaster }
BlobStore is the interface of our blob store
type BlobStoreBroadcaster ¶ added in v0.2.1
type BlobStoreBroadcaster interface {
Register(sink BlobStoreEmitter) CancelFunc
}
type BlobStoreEmitter ¶ added in v0.2.1
type BlobStoreEmitter interface { EmitBlob(BlobStoreNotification) error io.Closer }
type BlobStoreNotification ¶
type BlobStoreNotification struct { Op BlobStoreOp Ref refs.BlobRef Size int64 }
BlobStoreNotification contains info on a single change of the blob store. Op is either "rm" or "put".
func (BlobStoreNotification) String ¶
func (bn BlobStoreNotification) String() string
type BlobStoreOp ¶
type BlobStoreOp string
BlobStoreOp specifies the operation in a blob store notification.
const ( // BlobStoreOpPut is used in put notifications BlobStoreOpPut BlobStoreOp = "put" // BlobStoreOpRm is used in remove notifications BlobStoreOpRm BlobStoreOp = "rm" )
func (BlobStoreOp) String ¶
func (op BlobStoreOp) String() string
String returns the string representation of the operation.
type BlobWant ¶
type BlobWantsBroadcaster ¶ added in v0.2.1
type BlobWantsBroadcaster interface {
Register(sink BlobWantsEmitter) CancelFunc
}
type BlobWantsEmitter ¶ added in v0.2.1
type CancelFunc ¶ added in v0.2.1
type CancelFunc func()
type ConnTracker ¶
type ConnTracker interface { // Active returns true and since when a peer connection is active Active(net.Addr) (bool, time.Duration) // OnAccept receives a new connection as an argument. // If it decides to accept it, it returns true and a context that will be canceled once it should shut down // If it decides to deny it, it returns false (and a nil context) OnAccept(context.Context, net.Conn) (bool, context.Context) // OnClose notifies the tracker that a connection was closed OnClose(conn net.Conn) time.Duration // Count returns the number of open connections Count() uint // CloseAll closes all tracked connections CloseAll() }
ConnTracker decides if connections should be established and keeps track of them
type ContentNuller ¶
type DropContentRequest ¶ added in v0.2.1
type DropContentRequest struct { Type string `json:"type"` Sequence uint `json:"sequence"` Hash refs.MessageRef `json:"hash"` }
DropContentRequest has special meaning on a gabby-grove feed. It's signature verification allows ommiting the content. A feed author can ask other peers to drop a previous message of theirs with this. Sequence must be smaller then current, also the targeted message can't be a drop-content-request
func NewDropContentRequest ¶ added in v0.2.1
func NewDropContentRequest(seq uint, h refs.MessageRef) *DropContentRequest
type EndpointStat ¶
type EndpointStat struct { ID refs.FeedRef Addr net.Addr Since time.Duration Endpoint muxrpc.Endpoint }
EndpointStat gives some information about a connected peer
type ErrMalfromedMsg ¶
type ErrMalfromedMsg struct {
// contains filtered or unexported fields
}
func (ErrMalfromedMsg) Error ¶
func (emm ErrMalfromedMsg) Error() string
type ErrOutOfReach ¶
func (ErrOutOfReach) Error ¶
func (e ErrOutOfReach) Error() string
type ErrWrongSequence ¶
ErrWrongSequence is returned if there is a glitch on the current sequence number on the feed between in the offsetlog and the logical entry on the feed
func (ErrWrongSequence) Error ¶
func (e ErrWrongSequence) Error() string
type ErrWrongType ¶
type ErrWrongType struct {
// contains filtered or unexported fields
}
func (ErrWrongType) Error ¶
func (ewt ErrWrongType) Error() string
type IndexState ¶
type IndexStates ¶
type IndexStates []IndexState
type Indexer ¶
type Indexer interface { MultiLogGetter SimpleIndexGetter GetIndexNamesSimple() []string GetIndexNamesMultiLog() []string }
type KeyPair ¶
type KeyPair interface { ID() refs.FeedRef Secret() ed25519.PrivateKey }
func LoadKeyPair ¶
LoadKeyPair opens fname, ignores any line starting with # and passes it ParseKeyPair
func NewKeyPair ¶
NewKeyPair generates a fresh KeyPair using the passed io.Reader as a seed. Passing nil is fine and will use crypto/rand.
type LegacyKeyPair ¶ added in v0.2.1
type LegacyKeyPair struct { Feed refs.FeedRef Pair secrethandshake.EdKeyPair }
func (LegacyKeyPair) ID ¶ added in v0.2.1
func (lkp LegacyKeyPair) ID() refs.FeedRef
func (LegacyKeyPair) Secret ¶ added in v0.2.1
func (lkp LegacyKeyPair) Secret() ed25519.PrivateKey
type MultiLogGetter ¶
type Network ¶
type Network interface { Connect(ctx context.Context, addr net.Addr) error Serve(context.Context, ...muxrpc.HandlerWrapper) error GetListenAddr() net.Addr GetAllEndpoints() []EndpointStat GetEndpointFor(refs.FeedRef) (muxrpc.Endpoint, bool) GetConnTracker() ConnTracker DialViaRoom(portal, target refs.FeedRef) error // websock hack HandleHTTP(handler http.Handler) io.Closer }
type NetworkFrontier ¶
NetworkFrontier represents a set of feeds and their length The key is the canonical string representation (feed.Ref())
func (NetworkFrontier) String ¶
func (nf NetworkFrontier) String() string
func (*NetworkFrontier) UnmarshalJSON ¶
func (nf *NetworkFrontier) UnmarshalJSON(b []byte) error
type Note ¶
type Note struct { Seq int64 // Replicate (seq==-1) tells the peer that it doesn't want to hear about that feed Replicate bool // Receive controlls the eager push. // a peer might want to know if there are updates but not directly get the messages Receive bool }
Note informs about a feeds length and some control settings
func (Note) MarshalJSON ¶
type PeerStatus ¶
type Plugin ¶
type Plugin interface { // Name returns the name and version of the plugin. // format: name-1.0.2 Name() string // Method returns the preferred method of the call Method() muxrpc.Method // Handler returns the muxrpc handler for the plugin Handler() muxrpc.Handler }
type PluginManager ¶
type PluginManager interface { Register(Plugin) MakeHandler(conn net.Conn) (muxrpc.Handler, error) }
func NewPluginManager ¶
func NewPluginManager() PluginManager
type Publisher ¶
type Publisher interface { margaret.Log // Publish is a utility wrapper around append which returns the new message reference key Publish(content interface{}) (refs.MessageRef, error) }
type ReplicateUpToResponse ¶
this is one message of replicate.upto also handy to talk about the (latest) state of a single feed
func (ReplicateUpToResponse) Seq ¶
func (upto ReplicateUpToResponse) Seq() int64
type ReplicationLister ¶
type ReplicationLister interface { Authorizer ReplicationList() *StrFeedSet BlockList() *StrFeedSet }
ReplicationLister is used by the executing part to get the lists TODO: maybe only pass read-only/copies or slices down
type Replicator ¶
type Replicator interface { Replicate(refs.FeedRef) DontReplicate(refs.FeedRef) Block(refs.FeedRef) Unblock(refs.FeedRef) Lister() ReplicationLister }
Replicator is used to tell the bot which feeds to copy from other peers and which ones to block
type SimpleIndexGetter ¶
type Status ¶
type Status struct { PID int // process id of the bot Peers []PeerStatus Blobs []BlobWant Root int64 Indicies IndexStates }
type Statuser ¶
Statuser returns status information about the bot, like how many open connections it has (see type Status for more)
type StrFeedSet ¶
type StrFeedSet struct {
// contains filtered or unexported fields
}
func NewFeedSet ¶
func NewFeedSet(size int) *StrFeedSet
func (*StrFeedSet) Count ¶
func (fs *StrFeedSet) Count() int
type WantManager ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package blobstore implements the filesystem storage and simpathy/want managment for ssb-blobs.
|
Package blobstore implements the filesystem storage and simpathy/want managment for ssb-blobs. |
Package client is a a simple muxrpc interface to common ssb methods, similar to npm:ssb-client
|
Package client is a a simple muxrpc interface to common ssb methods, similar to npm:ssb-client |
cmd
|
|
go-sbot
go-sbot hosts the database and p2p server for replication.
|
go-sbot hosts the database and p2p server for replication. |
gossb-null-entry
usefull to eradicate entries in offsetlog by hand.
|
usefull to eradicate entries in offsetlog by hand. |
sbotcli
sbotcli implements a simple tool to query commands on another sbot
|
sbotcli implements a simple tool to query commands on another sbot |
ssb-drop-feed
ssb-drop-feed nulls entries of one particular feed from repo there is no warning or undo
|
ssb-drop-feed nulls entries of one particular feed from repo there is no warning or undo |
Package graph derives trust/block relations by consuming type:contact message and offers lookup APIs between two feeds.
|
Package graph derives trust/block relations by consuming type:contact message and offers lookup APIs between two feeds. |
Package indexes contains functions to create indexing for 'get(%ref) -> message'.
|
Package indexes contains functions to create indexing for 'get(%ref) -> message'. |
internal
|
|
aliases
Package aliases implements the validation and signing features of https://ssb-ngi-pointer.github.io/rooms2/#alias
|
Package aliases implements the validation and signing features of https://ssb-ngi-pointer.github.io/rooms2/#alias |
extra25519
Package extra25519 implements the key conversion from ed25519 to curve25519.
|
Package extra25519 implements the key conversion from ed25519 to curve25519. |
leakcheck
Package leakcheck contains functions to check leaked goroutines.
|
Package leakcheck contains functions to check leaked goroutines. |
mutil
Package mutil offers some margaret utilities.
|
Package mutil offers some margaret utilities. |
slp
Package slp implements "shallow length prefixed" data.
|
Package slp implements "shallow length prefixed" data. |
statematrix
Package statematrix stores and provides useful operations on an state matrix for the Epidemic Broadcast Tree protocol.
|
Package statematrix stores and provides useful operations on an state matrix for the Epidemic Broadcast Tree protocol. |
storedrefs
Package storedrefs provides methods to encode certain types as bytes, as used by the internal storage system.
|
Package storedrefs provides methods to encode certain types as bytes, as used by the internal storage system. |
tools
mainly used to install https://github.com/maxbrunsfeld/counterfeiter
|
mainly used to install https://github.com/maxbrunsfeld/counterfeiter |
Package invite contains functions for parsing invite codes and dialing a pub as a guest to redeem a token.
|
Package invite contains functions for parsing invite codes and dialing a pub as a guest to redeem a token. |
Package message contains abstract verification and publish helpers.
|
Package message contains abstract verification and publish helpers. |
legacy
Package legacy how to encode and verify the current ssb messages.
|
Package legacy how to encode and verify the current ssb messages. |
multimsg
Package multimsg implements a margaret codec to encode multiple kinds of messages to disk.
|
Package multimsg implements a margaret codec to encode multiple kinds of messages to disk. |
Package network implements utilities for dialing and listening to secret-handshake powered muxrpc connections.
|
Package network implements utilities for dialing and listening to secret-handshake powered muxrpc connections. |
plugins
|
|
blobs
Package blobs implements the muxrpc handlers for npm:ssb-blobs.
|
Package blobs implements the muxrpc handlers for npm:ssb-blobs. |
conn
Package conn offers muxrpc helpers to connect to remote peers.
|
Package conn offers muxrpc helpers to connect to remote peers. |
friends
Package friends supplies some of npm:ssb-friends, namly isFollowing, isBlocking and hops but not hopStream, onEdge or createLayer.
|
Package friends supplies some of npm:ssb-friends, namly isFollowing, isBlocking and hops but not hopStream, onEdge or createLayer. |
get
Package get is just a muxrpc wrapper around sbot.Get
|
Package get is just a muxrpc wrapper around sbot.Get |
gossip
Package gossip implements the createHistoryStream muxrpc call.
|
Package gossip implements the createHistoryStream muxrpc call. |
groups
Package groups supplies muxprc handlers for group managment.
|
Package groups supplies muxprc handlers for group managment. |
legacyinvites
Package legacyinvites supplies the follow-back sub protocol for new users.
|
Package legacyinvites supplies the follow-back sub protocol for new users. |
partial
Package partial is a helper module for ssb-browser-core, enabling to fetch subsets of feeds.
|
Package partial is a helper module for ssb-browser-core, enabling to fetch subsets of feeds. |
private
Package private suuplies an about to be deprecated way of accessing private messages.
|
Package private suuplies an about to be deprecated way of accessing private messages. |
publish
Package publish is just a muxrpc wrapper around sbot.PublishLog.Publish.
|
Package publish is just a muxrpc wrapper around sbot.PublishLog.Publish. |
replicate
Package replicate roughly translates to npm:ssb-replicate and only selects which feeds to block and fetch.
|
Package replicate roughly translates to npm:ssb-replicate and only selects which feeds to block and fetch. |
Package query holds the first version of a generic query engine for go-ssb.
|
Package query holds the first version of a generic query engine for go-ssb. |
Package repo contains utility modules to open offset logs and create different kinds of indexes.
|
Package repo contains utility modules to open offset logs and create different kinds of indexes. |
Package sbot ties together network, repo and plugins like graph and blobs into a large server that offers data-access APIs and background replication.
|
Package sbot ties together network, repo and plugins like graph and blobs into a large server that offers data-access APIs and background replication. |