Documentation ¶
Index ¶
- Constants
- Variables
- func NewHash(s string) (hash.Hash, error)
- func NewPrivateIdentity(name string, r io.Reader) (*Private, *Identity, error)
- func RegisterFileFetcher(ff FileFetcher)
- type Client
- type ClientMessage
- type DKG
- type Dispatcher
- type FileFetcher
- type GroupConfig
- type HttpFetcher
- type Identity
- type Leader
- type NonBlockingRouter
- type Object
- type ObjectHandler
- type PDkg
- type Private
- type Processor
- type ReliablePacket
- type ReliableType
- type Router
Constants ¶
const ( PROTOCOL_PDKG = iota PROTOCOL_RDKG = iota )
Variables ¶
var (
Blake2 = "blake2"
)
var ClientEncoder = network.NewSingleProtoEncoder(ClientMessage{})
encoder of the "application" message layer
var DefaultHash = Blake2
var ErrClosed = errors.New("stream: closed")
ErrClosed is returned when one call send() or receive() over a stream while the stream is closed
var ErrTimeout = errors.New("stream: timeout occured")
ErrTimeout is returned when a timeout has occured on a stream
var Group = edwards25519.NewAES128SHA256Ed25519()
var MaxIncorrectMessages = 100
how many incorrect messages do we allow before returning an error. This is necessary since anybody could join and spam any channel.
var ReliableMessageBuffer = 100
ReliableMessageBuffer indicates the maximum number of messages the reliable stream meachanism can hold in memory for the application layer to read
var ReliableReadTimeout = 1 * time.Minute
ReliableReadTimeout indicates how much time to wait for a "receive" operation using the reliable stream mechanism
var ReliableWaitRetry = 1 * time.Second
ReliableWaitRetry indicates the idle period between re-sending a packet to get an ACK
var ReliableWriteTimeout = 10 * time.Second
ReliableWriteTimeout indicates how much to wait for a "send" operation using the reliable stream meachanism
var SupportedHashes = []string{Blake2}
Functions ¶
func NewPrivateIdentity ¶
func RegisterFileFetcher ¶
func RegisterFileFetcher(ff FileFetcher)
Types ¶
type Client ¶
type Client struct { }
Client can performs all distributed operations such as: - generating a random distributed secret (rds) - with two rds, it can sign a message
- a self key signing process to be pgp compatible
- a regular signing process to sign any message in a pgp compatible way
type ClientMessage ¶
type Dispatcher ¶
type Dispatcher interface { RegisterProcessor(Processor) Dispatch(*Identity, *ClientMessage) }
Dispatcher receives messages, decode them and dispatch them to the registered processors. If multiple processors are registered, each message is dispatched to each processors.
type FileFetcher ¶
func FindFileFetcher ¶
func FindFileFetcher(url string) FileFetcher
FindFileFetcher returns a FileFetcher for this URL or nil if none accept this URL.
func NewHttpFetcher ¶
func NewHttpFetcher() FileFetcher
type GroupConfig ¶
type GroupConfig struct { Name string Email string Comment string // coefficients of the public polynomial Public []kyber.Point // list of node's identity participating Ids []Identity // threshold of the group T int PgpID uint64 PgpPublic string }
GroupConfig is the public configuration of a group using mulsigo. It is similar to a public pgp identity with a name, email and comment. It contains the additional public information on all the participants of the group.
type HttpFetcher ¶
type HttpFetcher struct {
// contains filtered or unexported fields
}
func (*HttpFetcher) Accept ¶
func (h *HttpFetcher) Accept(url string) bool
type Identity ¶
type Identity struct { Name string Key []byte CreatedAt int64 Signature []byte // reachable - usually empty if using a relay but if provided, will enable // one to make direct connection between a pair of peers. Address net.Address }
func (*Identity) PublicCurve25519 ¶
type Leader ¶
type Leader struct {
*Client
}
Leader is a Client that can performs the initial operations such as sending the first message containing the public informations of the pgp key (name, email etc), sending the file/text to sign.
type NonBlockingRouter ¶
type NonBlockingRouter struct {
Router
}
NonBlockingRouter is a middleware around Router that sends and broadcasts messages in a asynchornous way using goroutine. Each methods returns a channel that will dispatch any future error if any.
func NewNonBlockingRouter ¶
func NewNonBlockingRouter(r Router) *NonBlockingRouter
NewNonBlockingRouter returns a router that sends message asynchronously.
func (*NonBlockingRouter) Broadcast ¶
func (n *NonBlockingRouter) Broadcast(cm *ClientMessage, ids ...*Identity) chan error
func (*NonBlockingRouter) Send ¶
func (n *NonBlockingRouter) Send(id *Identity, cm *ClientMessage) chan error
Send use the underlying router's Send method to send the message in a goroutine. It returns a channel where the error will be dispatched.
type Object ¶
type Object struct { }
func NewLocalFileObject ¶
func NewRemoteFileObject ¶
func NewTextObject ¶
type ObjectHandler ¶
ObjectHandler is an interface allowing one to provide custom verification function on any object to be signed. A default impl. is provided which always accept to sign. Another one can be provided that ask to the user on the command line if it's OK or not etc... Implementations can use in conjunctions any FileGrabber implementation if the Object is a RemoteFile object.
type Private ¶
type Private struct { Public *Identity // contains filtered or unexported fields }
func (*Private) PrivateCurve25519 ¶
func (*Private) PublicCurve25519 ¶
type Processor ¶
type Processor interface {
Process(*Identity, *ClientMessage)
}
Processor receives a message from a dispatcher.
type ReliablePacket ¶
type ReliablePacket struct { Type ReliableType Sequence uint32 Data []byte `protobuf:"opt"` }
type ReliableType ¶
type ReliableType bool
const ( RELIABLE_DATA ReliableType = true RELIABLE_ACK ReliableType = false )
type Router ¶
type Router struct { // dispatcher used to dispatch message Dispatcher // global lock making one Send at a time // XXX would there be a way to remove that constraint... sync.Mutex // contains filtered or unexported fields }
Router is the main "network" entry point enabling one to send messages to a peer and to receive any messages. If it were an interface, it would look like:
type Router interface Dispatcher Send(*Identity, *ClientMessage) error Broadcast(cm *ClientMessage, ids ...*Identity) error Close() }
Originally, the router was an interface but then extracted the only generic behavior to streamFactory.
func NewRouter ¶
func NewRouter(factory streamFactory) *Router
NewRouter returns a router that handles streams connections and is the main public înterface to send / receive message