flip

package
v0.0.0-...-66acf6f Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: BSD-3-Clause Imports: 24 Imported by: 0

README

go-flip

A way to flip coins with your friends

Documentation

Index

Constants

View Source
const MaxClockSkew = time.Hour * 1

Variables

View Source
var DefaultCommitmentCompleteWindowMsec int64 = 15 * 1000
View Source
var DefaultCommitmentWindowMsec int64 = 3 * 1000
View Source
var DefaultRevealWindowMsec int64 = 30 * 1000
View Source
var DefaultSlackMsec int64 = 1 * 1000
View Source
var ErrBadData = errors.New("rejecting bad data, likely due to a nil field")
View Source
var FlipTypeMap = map[string]FlipType{
	"BOOL":    1,
	"INT":     2,
	"BIG":     3,
	"SHUFFLE": 4,
}
View Source
var FlipTypeRevMap = map[FlipType]string{
	1: "BOOL",
	2: "INT",
	3: "BIG",
	4: "SHUFFLE",
}
View Source
var MessageTypeMap = map[string]MessageType{
	"START":               1,
	"COMMITMENT":          2,
	"COMMITMENT_COMPLETE": 3,
	"REVEAL":              4,
	"END":                 5,
}
View Source
var MessageTypeRevMap = map[MessageType]string{
	1: "START",
	2: "COMMITMENT",
	3: "COMMITMENT_COMPLETE",
	4: "REVEAL",
	5: "END",
}
View Source
var StageMap = map[string]Stage{
	"ROUND1": 1,
	"ROUND2": 2,
}
View Source
var StageRevMap = map[Stage]string{
	1: "ROUND1",
	2: "ROUND2",
}
View Source
var VersionMap = map[string]Version{
	"V1": 1,
}
View Source
var VersionRevMap = map[Version]string{
	1: "V1",
}

Functions

func FlipBool

func FlipBool(cp CommitmentPayload, players []PlayerState) (bool, error)

FlipOneBool takes all the completed PlayerStates, and checks them. If no error, then outputs one random bool. If there was an error in the game setup, then it will return false and the error.

func FlipInt

func FlipInt(cp CommitmentPayload, players []PlayerState, modulus int64) (int64, error)

FlipOneInt takes all the completed PlayerStates, and checks them. If no error, then outputs one random number between 0 and the given modulus, a signed 64-bit int. If there was an error in the game setup, then it will return 0 and the error.

func FlipOneBig

func FlipOneBig(cp CommitmentPayload, players []PlayerState, modulus *big.Int) (*big.Int, error)

FlipOneBig takes all the completed PlayerStates, and checks them. If no error, then outputs one random number between 0 and the given modulus, which is an arbitrarily big number. If there was an error in the game setup, then it will return nil and the error.

func FlipProtocol

func FlipProtocol(i FlipInterface) rpc.Protocol

func GenerateGameID

func GenerateGameID() chat1.FlipGameID

Types

type AbsenteesError

type AbsenteesError struct {
	Absentees []UserDevice
}

func (AbsenteesError) Error

func (l AbsenteesError) Error() string

type BadChannelError

type BadChannelError struct {
	G GameMetadata
	C chat1.ConversationID
}

func (BadChannelError) Error

func (b BadChannelError) Error() string

type BadCommitmentCompleteHashError

type BadCommitmentCompleteHashError struct {
	G GameMetadata
	U UserDevice
}

func (BadCommitmentCompleteHashError) Error

type BadFlipTypeError

type BadFlipTypeError struct {
	G GameMetadata
	T FlipType
}

func (BadFlipTypeError) Error

func (b BadFlipTypeError) Error() string

type BadGameIDError

type BadGameIDError struct {
	G GameMetadata
	I chat1.FlipGameID
}

func (BadGameIDError) Error

func (b BadGameIDError) Error() string

type BadLeaderClockError

type BadLeaderClockError struct {
	G GameMetadata
}

func (BadLeaderClockError) Error

func (b BadLeaderClockError) Error() string

type BadLocalClockError

type BadLocalClockError struct {
	G GameMetadata
}

func (BadLocalClockError) Error

func (b BadLocalClockError) Error() string

type BadMessageError

type BadMessageError struct {
	G GameMetadata
	T MessageType
}

func (BadMessageError) Error

func (b BadMessageError) Error() string

type BadMessageForStageError

type BadMessageForStageError struct {
	G           GameMetadata
	MessageType MessageType
	Stage       Stage
}

func (BadMessageForStageError) Error

func (b BadMessageForStageError) Error() string

type BadRevealError

type BadRevealError struct {
	G GameMetadata
	U UserDevice
}

func (BadRevealError) Error

func (b BadRevealError) Error() string

type BadUserDeviceError

type BadUserDeviceError struct {
	Expected UserDevice
	Actual   UserDevice
}

func (BadUserDeviceError) Error

func (b BadUserDeviceError) Error() string

type BadVersionError

type BadVersionError Version

func (BadVersionError) Error

func (b BadVersionError) Error() string

type Commitment

type Commitment [32]byte

func (Commitment) DeepCopy

func (o Commitment) DeepCopy() Commitment

func (Commitment) Eq

func (c Commitment) Eq(d Commitment) bool

func (Commitment) String

func (c Commitment) String() string

type CommitmentComplete

type CommitmentComplete struct {
	Players []UserDeviceCommitment `codec:"players" json:"players"`
}

func (CommitmentComplete) DeepCopy

type CommitmentCompleteSortError

type CommitmentCompleteSortError struct {
	G GameMetadata
}

func (CommitmentCompleteSortError) Error

type CommitmentMismatchError

type CommitmentMismatchError struct {
	G GameMetadata
	U UserDevice
}

func (CommitmentMismatchError) Error

func (c CommitmentMismatchError) Error() string

type CommitmentPayload

type CommitmentPayload struct {
	V Version              `codec:"v" json:"v"`
	U gregor1.UID          `codec:"u" json:"u"`
	D gregor1.DeviceID     `codec:"d" json:"d"`
	C chat1.ConversationID `codec:"c" json:"c"`
	G chat1.FlipGameID     `codec:"i" json:"i"`
	S Time                 `codec:"s" json:"s"`
	// contains filtered or unexported fields
}

type CommitmentUpdate

type CommitmentUpdate struct {
	User       UserDevice
	Commitment Commitment
}

type Dealer

type Dealer struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Dealer is a peristent process that runs in the chat client that deals out a game. It can have multiple games running at once.

func NewDealer

func NewDealer(dh DealersHelper) *Dealer

NewDealer makes a new Dealer with a given DealersHelper

func (*Dealer) HasActiveGames

func (d *Dealer) HasActiveGames(ctx context.Context) bool

func (*Dealer) InjectIncomingChat

func (d *Dealer) InjectIncomingChat(ctx context.Context, sender UserDevice,
	conversationID chat1.ConversationID, gameID chat1.FlipGameID, body GameMessageEncoded,
	firstInConversation bool) error

InjectIncomingChat should be called whenever a new flip game comes in that's relevant for flips. Call this with the sender's information, the channel information, and the body data that came in. The last bool is true only if this is the first message in the channel. The current model is that only one "game" is allowed for each chat channel. So any prior messages in the channel mean it might be replay. This is significantly less general than an earlier model, which is why we introduced the concept of a gameID, so it might be changed in the future.

func (*Dealer) IsGameActive

func (d *Dealer) IsGameActive(ctx context.Context, conversationID chat1.ConversationID, gameID chat1.FlipGameID) bool

func (*Dealer) Run

func (d *Dealer) Run(ctx context.Context) error

Run a dealer in a given context. It will run as long as it isn't shutdown.

func (*Dealer) StartFlip

func (d *Dealer) StartFlip(ctx context.Context, start Start, conversationID chat1.ConversationID) (err error)

StartFlip starts a new flip. Pass it some start parameters as well as a chat conversationID that it will take place in.

func (*Dealer) StartFlipWithGameID

func (d *Dealer) StartFlipWithGameID(ctx context.Context, start Start, conversationID chat1.ConversationID,
	gameID chat1.FlipGameID) (err error)

StartFlipWithGameID starts a new flip. Pass it some start parameters as well as a chat conversationID that it will take place in. Also takes a GameID

func (*Dealer) Stop

func (d *Dealer) Stop()

Stop a dealer on process shutdown.

func (*Dealer) UpdateCh

func (d *Dealer) UpdateCh() <-chan GameStateUpdateMessage

UpdateCh returns a channel that sends a sequence of GameStateUpdateMessages, each notifying the UI about changes to ongoing games.

type DealersHelper

type DealersHelper interface {
	ReplayHelper
	Clock() clockwork.Clock
	ServerTime(context.Context) (time.Time, error)
	SendChat(ctx context.Context, initiatorUID gregor1.UID, ch chat1.ConversationID, gameID chat1.FlipGameID, msg GameMessageEncoded) error
	Me() UserDevice
	ShouldCommit(ctx context.Context) bool // Whether to send new commitments for games.
}

DealersHelper is an interface that calling chat clients need to implement.

type DuplicateCommitmentCompleteError

type DuplicateCommitmentCompleteError struct {
	G GameMetadata
	U UserDevice
}

func (DuplicateCommitmentCompleteError) Error

type DuplicateCommitmentError

type DuplicateCommitmentError struct{}

func (DuplicateCommitmentError) Error

func (d DuplicateCommitmentError) Error() string

type DuplicateRegistrationError

type DuplicateRegistrationError struct {
	G GameMetadata
	U UserDevice
}

func (DuplicateRegistrationError) Error

type DuplicateRevealError

type DuplicateRevealError struct {
	G GameMetadata
	U UserDevice
}

func (DuplicateRevealError) Error

func (d DuplicateRevealError) Error() string

type Error

type Error struct {
	NoCommitments  []Player
	NoReveals      []Player
	BadCommitments []Player
	Duplicates     []Player
}

func (Error) Error

func (e Error) Error() string

func (Error) IsNil

func (e Error) IsNil() bool

type FlipClient

type FlipClient struct {
	Cli rpc.GenericClient
}

type FlipInterface

type FlipInterface interface {
}

type FlipParameters

type FlipParameters struct {
	T__       FlipType `codec:"t" json:"t"`
	Int__     *int64   `codec:"int,omitempty" json:"int,omitempty"`
	Big__     *[]byte  `codec:"big,omitempty" json:"big,omitempty"`
	Shuffle__ *int64   `codec:"shuffle,omitempty" json:"shuffle,omitempty"`
}

func NewFlipParametersWithBig

func NewFlipParametersWithBig(v []byte) FlipParameters

func NewFlipParametersWithBool

func NewFlipParametersWithBool() FlipParameters

func NewFlipParametersWithInt

func NewFlipParametersWithInt(v int64) FlipParameters

func NewFlipParametersWithShuffle

func NewFlipParametersWithShuffle(v int64) FlipParameters

func (FlipParameters) Big

func (o FlipParameters) Big() (res []byte)

func (FlipParameters) DeepCopy

func (o FlipParameters) DeepCopy() FlipParameters

func (FlipParameters) Int

func (o FlipParameters) Int() (res int64)

func (FlipParameters) Shuffle

func (o FlipParameters) Shuffle() (res int64)

func (FlipParameters) String

func (p FlipParameters) String() string

func (*FlipParameters) T

func (o *FlipParameters) T() (ret FlipType, err error)

type FlipType

type FlipType int
const (
	FlipType_BOOL    FlipType = 1
	FlipType_INT     FlipType = 2
	FlipType_BIG     FlipType = 3
	FlipType_SHUFFLE FlipType = 4
)

func (FlipType) DeepCopy

func (o FlipType) DeepCopy() FlipType

func (FlipType) String

func (e FlipType) String() string

type Game

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

func (*Game) CommitmentEndTime

func (g *Game) CommitmentEndTime() time.Time

func (*Game) GameMetadata

func (g *Game) GameMetadata() GameMetadata

func (*Game) RevealEndTime

func (g *Game) RevealEndTime() time.Time

type GameAbortedError

type GameAbortedError struct{}

func (GameAbortedError) Error

func (g GameAbortedError) Error() string

type GameAlreadyStartedError

type GameAlreadyStartedError struct {
	G GameMetadata
}

func (GameAlreadyStartedError) Error

func (g GameAlreadyStartedError) Error() string

type GameFinishedError

type GameFinishedError struct {
	G GameMetadata
}

func (GameFinishedError) Error

func (g GameFinishedError) Error() string

type GameHistory

type GameHistory []GameMessageReplayed

type GameHistoryPlayer

type GameHistoryPlayer struct {
	Device     UserDevice
	Commitment Commitment
	Reveal     *Secret
}

type GameIDKey

type GameIDKey string

func GameIDToKey

func GameIDToKey(g chat1.FlipGameID) GameIDKey

type GameKey

type GameKey string

type GameMessage

type GameMessage struct {
	V__  Version        `codec:"v" json:"v"`
	V1__ *GameMessageV1 `codec:"v1,omitempty" json:"v1,omitempty"`
}

func NewGameMessageDefault

func NewGameMessageDefault(v Version) GameMessage

func NewGameMessageWithV1

func NewGameMessageWithV1(v GameMessageV1) GameMessage

func (GameMessage) DeepCopy

func (o GameMessage) DeepCopy() GameMessage

func (*GameMessage) V

func (o *GameMessage) V() (ret Version, err error)

func (GameMessage) V1

func (o GameMessage) V1() (res GameMessageV1)

type GameMessageBody

type GameMessageBody struct {
	T__                  MessageType         `codec:"t" json:"t"`
	Start__              *Start              `codec:"start,omitempty" json:"start,omitempty"`
	Commitment__         *Commitment         `codec:"commitment,omitempty" json:"commitment,omitempty"`
	CommitmentComplete__ *CommitmentComplete `codec:"commitmentComplete,omitempty" json:"commitmentComplete,omitempty"`
	Reveal__             *Reveal             `codec:"reveal,omitempty" json:"reveal,omitempty"`
}

func NewGameMessageBodyWithCommitment

func NewGameMessageBodyWithCommitment(v Commitment) GameMessageBody

func NewGameMessageBodyWithCommitmentComplete

func NewGameMessageBodyWithCommitmentComplete(v CommitmentComplete) GameMessageBody

func NewGameMessageBodyWithEnd

func NewGameMessageBodyWithEnd() GameMessageBody

func NewGameMessageBodyWithReveal

func NewGameMessageBodyWithReveal(v Reveal) GameMessageBody

func NewGameMessageBodyWithStart

func NewGameMessageBodyWithStart(v Start) GameMessageBody

func (GameMessageBody) Commitment

func (o GameMessageBody) Commitment() (res Commitment)

func (GameMessageBody) CommitmentComplete

func (o GameMessageBody) CommitmentComplete() (res CommitmentComplete)

func (GameMessageBody) DeepCopy

func (o GameMessageBody) DeepCopy() GameMessageBody

func (GameMessageBody) Encode

func (GameMessageBody) Reveal

func (o GameMessageBody) Reveal() (res Reveal)

func (GameMessageBody) Start

func (o GameMessageBody) Start() (res Start)

func (GameMessageBody) String

func (m GameMessageBody) String() string

func (*GameMessageBody) T

func (o *GameMessageBody) T() (ret MessageType, err error)

type GameMessageEncoded

type GameMessageEncoded string

GameMessageEncoded is a game message that is shipped over the chat channel. Inside, it's a base64-encoded msgpack object (generated via AVDL->go compiler), but it's safe to think of it just as an opaque string.

func MakeGameMessageEncoded

func MakeGameMessageEncoded(s string) GameMessageEncoded

func (GameMessageEncoded) Decode

func (e GameMessageEncoded) Decode() (*GameMessageV1, error)

func (GameMessageEncoded) String

func (e GameMessageEncoded) String() string

type GameMessageReplayed

type GameMessageReplayed struct {
	GameMessageWrappedEncoded
	Time time.Time
}

type GameMessageV1

type GameMessageV1 struct {
	Md   GameMetadata    `codec:"md" json:"md"`
	Body GameMessageBody `codec:"body" json:"body"`
}

func (GameMessageV1) DeepCopy

func (o GameMessageV1) DeepCopy() GameMessageV1

func (GameMessageV1) Encode

func (v GameMessageV1) Encode() (GameMessageEncoded, error)

type GameMessageWrapped

type GameMessageWrapped struct {
	Sender              UserDevice
	Msg                 GameMessageV1
	Me                  *playerControl
	Forward             bool
	FirstInConversation bool
}

func (GameMessageWrapped) Encode

func (GameMessageWrapped) GameMetadata

func (m GameMessageWrapped) GameMetadata() GameMetadata

type GameMessageWrappedEncoded

type GameMessageWrappedEncoded struct {
	Sender              UserDevice
	GameID              chat1.FlipGameID   // the game ID of this game, also specified (encoded) in GameMessageEncoded
	Body                GameMessageEncoded // base64-encoded GameMessaageBody that comes in over chat
	FirstInConversation bool               // on if this is the first message in the conversation
}

GameMessageWrappedEncoded contains a sender, a gameID and a Body. The GameID should never be reused.

func (*GameMessageWrappedEncoded) Decode

type GameMetadata

type GameMetadata struct {
	Initiator      UserDevice           `codec:"initiator" json:"initiator"`
	ConversationID chat1.ConversationID `codec:"conversationID" json:"conversationID"`
	GameID         chat1.FlipGameID     `codec:"gameID" json:"gameID"`
}

func (GameMetadata) DeepCopy

func (o GameMetadata) DeepCopy() GameMetadata

func (GameMetadata) String

func (g GameMetadata) String() string

func (GameMetadata) ToKey

func (g GameMetadata) ToKey() GameKey

type GamePlayerState

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

type GameReplayError

type GameReplayError struct {
	G chat1.FlipGameID
}

func (GameReplayError) Error

func (g GameReplayError) Error() string

type GameShutdownError

type GameShutdownError struct {
	G GameMetadata
}

func (GameShutdownError) Error

func (g GameShutdownError) Error() string

type GameStateUpdateMessage

type GameStateUpdateMessage struct {
	Metadata GameMetadata
	// only one of the following will be non-nil
	Err                error
	Commitment         *CommitmentUpdate
	Reveal             *RevealUpdate
	CommitmentComplete *CommitmentComplete
	Result             *Result
}

GameStateUpdateMessage is sent from the game dealer out to the calling chat client, to update him on changes to game state that happened. All update messages are relative to the given GameMetadata. For each update, only one of Err, Commitment, Reveal, CommitmentComplete or Result will be non-nil.

type GameSummary

type GameSummary struct {
	Err     error
	Players []GameHistoryPlayer
	Result  Result
}

func Replay

func Replay(ctx context.Context, rh ReplayHelper, gh GameHistory) (*GameSummary, error)

type Hash

type Hash [32]byte

func (Hash) DeepCopy

func (o Hash) DeepCopy() Hash

func (Hash) Eq

func (h Hash) Eq(i Hash) bool

func (Hash) String

func (h Hash) String() string

type MessageType

type MessageType int
const (
	MessageType_START               MessageType = 1
	MessageType_COMMITMENT          MessageType = 2
	MessageType_COMMITMENT_COMPLETE MessageType = 3
	MessageType_REVEAL              MessageType = 4
	MessageType_END                 MessageType = 5
)

func (MessageType) DeepCopy

func (o MessageType) DeepCopy() MessageType

func (MessageType) String

func (e MessageType) String() string

type NoRevealError

type NoRevealError struct {
	G GameMetadata
	U UserDevice
}

func (NoRevealError) Error

func (n NoRevealError) Error() string

type PRNG

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

PRNG is based on AES-CTR. The input key is a 32-byte random secret (as generated by our commitment scheme). The output is a AES(k,1), AES(k,2), AES(k,3), etc... We are relying on the fact that AES is a PRP, which is pretty widely assumed.

func Flip

func Flip(cp CommitmentPayload, players []PlayerState) (*PRNG, error)

Flip takes all the completed PlayerStates from the game, makes sure they don't have an error, and if not, outputs a PRNG from which arbirarily many ints, or bools, can be deterministically plucked. If there's an error, PRNG will be nil.

func NewPRNG

func NewPRNG(s Secret) *PRNG

func (*PRNG) Big

func (p *PRNG) Big(modulus *big.Int) *big.Int

func (*PRNG) Bool

func (p *PRNG) Bool() bool

func (*PRNG) Int

func (p *PRNG) Int(modulus int64) int64

func (*PRNG) Permutation

func (p *PRNG) Permutation(n int) []int

Permutation runs the Fisher-Yates shuffle on the sequence [0,n). See: https://en.wikipedia.org/wiki/Fisher–Yates_shuffle Be careful for off-by-one errors in this implementation, as we have already witnessed one. We bounty bugs like these, so let us know!

func (*PRNG) Read

func (p *PRNG) Read(out []byte) int

type Player

type Player string

Player is an identifier for a player in the flip game. It can be anything, but must be unique for the game. You can use user IDs in hex here, for instance, or possibly (userid||deviceID) since each user in Keybase will likely enter a flip multiple times (if many if his devices are on).

type PlayerState

type PlayerState struct {
	Player     Player
	Commitment *Commitment
	Reveal     Secret
}

PlayerState refers to all state about a player in the game. It includes the Player's name, his commitment, and his revealed preimage.

type ReplayError

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

func NewReplayError

func NewReplayError(s string) ReplayError

func (ReplayError) Error

func (r ReplayError) Error() string

type ReplayHelper

type ReplayHelper interface {
	CLogf(ctx context.Context, fmt string, args ...interface{})
}

ReplayHelper contains hooks needed to replay a flip.

type Result

type Result struct {
	Shuffle []int
	Bool    *bool
	Int     *int64
	Big     *big.Int
}

type Reveal

type Reveal struct {
	Secret Secret `codec:"secret" json:"secret"`
	Cch    Hash   `codec:"cch" json:"cch"`
}

func (Reveal) DeepCopy

func (o Reveal) DeepCopy() Reveal

type RevealTooLateError

type RevealTooLateError struct {
	G GameMetadata
	U UserDevice
}

func (RevealTooLateError) Error

func (b RevealTooLateError) Error() string

type RevealUpdate

type RevealUpdate struct {
	User   UserDevice
	Reveal Secret
}

type Secret

type Secret [32]byte

func GenerateSecret

func GenerateSecret() Secret

func (Secret) DeepCopy

func (o Secret) DeepCopy() Secret

func (Secret) Eq

func (s Secret) Eq(t Secret) bool

func (Secret) Hash

func (s Secret) Hash() Secret

func (Secret) IsNil

func (s Secret) IsNil() bool

func (Secret) String

func (s Secret) String() string

func (*Secret) XOR

func (s *Secret) XOR(t Secret) *Secret

type Stage

type Stage int
const (
	Stage_ROUND1 Stage = 1
	Stage_ROUND2 Stage = 2
)

func (Stage) DeepCopy

func (o Stage) DeepCopy() Stage

func (Stage) String

func (e Stage) String() string

type Start

type Start struct {
	StartTime                    Time           `codec:"startTime" json:"startTime"`
	CommitmentWindowMsec         int64          `codec:"commitmentWindowMsec" json:"commitmentWindowMsec"`
	RevealWindowMsec             int64          `codec:"revealWindowMsec" json:"revealWindowMsec"`
	SlackMsec                    int64          `codec:"slackMsec" json:"slackMsec"`
	CommitmentCompleteWindowMsec int64          `codec:"commitmentCompleteWindowMsec" json:"commitmentCompleteWindowMsec"`
	Params                       FlipParameters `codec:"params" json:"params"`
}

func NewStartWithBigInt

func NewStartWithBigInt(now time.Time, mod *big.Int, nPlayers int) Start

NewStartWithBigInt makes new start parameters that yield a coinflip game that picks big int between 0 and mod.

func NewStartWithBool

func NewStartWithBool(now time.Time, nPlayers int) Start

NewStartWithBool makes new start parameters that yield a coinflip game.

func NewStartWithInt

func NewStartWithInt(now time.Time, mod int64, nPlayers int) Start

NewStartWithInt makes new start parameters that yield a coinflip game that picks an int between 0 and mod.

func NewStartWithShuffle

func NewStartWithShuffle(now time.Time, n int64, nPlayers int) Start

NewStartWithShuffle makes new start parameters for a coinflip that randomly permutes the numbers between 0 and n, exclusive. This can be used to shuffle an array of names.

func (Start) CommitmentWindowWithSlack

func (s Start) CommitmentWindowWithSlack(isLeader bool) time.Duration

func (Start) DeepCopy

func (o Start) DeepCopy() Start

func (Start) RevealWindowWithSlack

func (s Start) RevealWindowWithSlack() time.Duration

func (Start) String

func (s Start) String() string

Excludes `Params` from being logged.

type Time

type Time int64

func ToTime

func ToTime(t time.Time) Time

func (Time) DeepCopy

func (o Time) DeepCopy() Time

func (Time) Duration

func (t Time) Duration() time.Duration

func (Time) Time

func (t Time) Time() time.Time

type TimeoutError

type TimeoutError struct {
	G     GameMetadata
	Stage Stage
}

func (TimeoutError) Error

func (t TimeoutError) Error() string

type UnforwardableMessageError

type UnforwardableMessageError struct {
	G GameMetadata
}

func (UnforwardableMessageError) Error

type UserDevice

type UserDevice struct {
	D gregor1.DeviceID `codec:"d" json:"d"`
	U gregor1.UID      `codec:"u" json:"u"`
}

func (UserDevice) DeepCopy

func (o UserDevice) DeepCopy() UserDevice

func (UserDevice) Eq

func (u UserDevice) Eq(v UserDevice) bool

func (UserDevice) LessThan

func (u UserDevice) LessThan(v UserDevice) bool

func (UserDevice) ToKey

func (u UserDevice) ToKey() UserDeviceKey

type UserDeviceCommitment

type UserDeviceCommitment struct {
	Ud UserDevice `codec:"ud" json:"ud"`
	C  Commitment `codec:"c" json:"c"`
}

func (UserDeviceCommitment) DeepCopy

type UserDeviceKey

type UserDeviceKey string

type Version

type Version int
const (
	Version_V1 Version = 1
)

func (Version) DeepCopy

func (o Version) DeepCopy() Version

func (Version) String

func (e Version) String() string

type WrongSenderError

type WrongSenderError struct {
	G        GameMetadata
	Expected UserDevice
	Actual   UserDevice
}

func (WrongSenderError) Error

func (w WrongSenderError) Error() string

Jump to

Keyboard shortcuts

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