panda

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2015 License: BSD-3-Clause Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ShutdownErr = errors.New("panda: shutdown requested")

Functions

func IsAcceptableSecretString

func IsAcceptableSecretString(s string) bool

IsAcceptableSecretString returns true if s should be accepted as a secret string. The only strings that will be rejected are those that start with generatedSecretStringPrefix but don't have a matching checksum.

func NewSecretString

func NewSecretString(rand io.Reader) string

NewSecretString generates a random, human readable string with a special form that includes a checksum which allows typos to be rejected (so long as the typo isn't in the first two letters).

Types

type Card

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

Card represents a playing card (except for the jokers).

func ParseCard

func ParseCard(s string) (card Card, ok bool)

ParseCard parses a card from a simple, two or three character string representation where the first character specifies the face value as one of "a23456789jqk" and the second the suit as one of "shdc". Case is ignored. The 10 is the exception and takes three charactors.

func (Card) IsRed

func (c Card) IsRed() bool

func (Card) Number

func (c Card) Number() int

func (Card) String

func (c Card) String() string

String converts a Card to a two-glyph, string representation where the second glyph is a code-point for the suit.

type CardStack

type CardStack struct {
	NumDecks int
	// contains filtered or unexported fields
}

func (*CardStack) Add

func (cs *CardStack) Add(c Card) bool

func (*CardStack) Canonicalise

func (cs *CardStack) Canonicalise() *CardStack

func (*CardStack) MinimumDecks

func (cs *CardStack) MinimumDecks() int

func (*CardStack) Remove

func (cs *CardStack) Remove(c Card) bool

type HTTPMeetingPlace

type HTTPMeetingPlace struct {
	TorAddress string
	URL        string
}

func (*HTTPMeetingPlace) Exchange

func (hmp *HTTPMeetingPlace) Exchange(log func(string, ...interface{}), id, message []byte, shutdown chan struct{}) ([]byte, error)

func (*HTTPMeetingPlace) Padding

func (hmp *HTTPMeetingPlace) Padding() int

type KeyExchange

type KeyExchange struct {
	sync.Mutex

	Log          func(string, ...interface{})
	Testing      bool
	ShutdownChan chan struct{}
	// contains filtered or unexported fields
}

func NewKeyExchange

func NewKeyExchange(rand io.Reader, meetingPlace MeetingPlace, sharedSecret *SharedSecret, kxBytes []byte) (*KeyExchange, error)

func UnmarshalKeyExchange

func UnmarshalKeyExchange(rand io.Reader, meetingPlace MeetingPlace, serialised []byte) (*KeyExchange, error)

func (*KeyExchange) Marshal

func (kx *KeyExchange) Marshal() []byte

func (*KeyExchange) Run

func (kx *KeyExchange) Run() ([]byte, error)

type MeetingPlace

type MeetingPlace interface {
	Padding() int
	Exchange(log func(string, ...interface{}), id, message []byte, shutdown chan struct{}) ([]byte, error)
}

type SharedSecret

type SharedSecret struct {
	Secret           string
	Cards            CardStack
	Day, Month, Year int
	Hours, Minutes   int
}

type SimpleMeetingPlace

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

func NewSimpleMeetingPlace

func NewSimpleMeetingPlace() *SimpleMeetingPlace

func (*SimpleMeetingPlace) Exchange

func (smp *SimpleMeetingPlace) Exchange(log func(string, ...interface{}), id, message []byte, shutdown chan struct{}) ([]byte, error)

func (*SimpleMeetingPlace) Padding

func (smp *SimpleMeetingPlace) Padding() int

type Suit

type Suit int

Suit represents one of the four suits in a standard deck of cards.

const (
	SuitSpades Suit = iota
	SuitHearts
	SuitDimonds
	SuitClubs
)

Directories

Path Synopsis
appengine-server

Jump to

Keyboard shortcuts

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