server

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2020 License: ISC Imports: 26 Imported by: 0

Documentation

Overview

Package server implements a DiceMix Light server for CoinShuffle++.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Joiner

type Joiner interface {
	Join(unmixed []byte, pid int) error
	ValidateUnmixed(unmixed []byte) error
}

Joiner is any data which can be joined with binary unmixed data of similar type. The pid describes the submitting peer ID for blame assignment. Joiner must be implemented by the Mixer when the server is used for CoinJoins.

type Mixer

type Mixer interface {
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler

	// Mix adds a mixed message.
	Mix(m []byte)

	// Confirm extracts signatures from confirm from a specific peer and
	// includes them in the Mixer.
	Confirm(confirm interface{}, pid int) error
}

Mixer is any binary-representable data which can add mixed messages and be confirmed with signatures.

type NewMixer

type NewMixer func(desc []byte) (Mixer, error)

NewMixer returns a Mixer to join data with described features. The result should contain no initial messages. If the BinaryMixer is also a Joiner, it will be joined with the unmixed data from a pairing request message.

type PublishMixer

type PublishMixer interface {
	PublishMix(ctx context.Context) error
}

PublishMixer is a Mixer which is capable of using the server to publish the data. If Mixer implements PublishMixer, the mix will be published (and blame may be assigned for bad submitted data if the publish fails).

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server implements pairing of clients performing compatible mixes, and coordinates a DiceMix Light session between paired clients.

func New

func New(msize int, newm NewMixer, epoch time.Duration) (*Server, error)

New creates a Server that will perform DiceMix Light with messages of length msize. When newm creates a CoinJoin transaction, this implements CoinShuffle++.

If the Mixer returned by newm implements the Joiner and Shuffler interfaces, these will be called to join and shuffle non-anonymous portions of a mix.

func (*Server) Run

func (s *Server) Run(ctx context.Context, lis net.Listener) error

Run executes the server, listening on lis for new client connections.

func (*Server) SetReportEncoder

func (s *Server) SetReportEncoder(enc *json.Encoder)

type Shuffler

type Shuffler interface {
	Shuffle()
}

Shuffler shuffles all values (including non-anonymous) of a mix. If a Mixer implements Shuffler, all values are shuffled before confirming. It is not necessary to implement Shuffler to provide mixed message anonymity.

Jump to

Keyboard shortcuts

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