Documentation ¶
Index ¶
- Constants
- func GetRequestBody(w http.ResponseWriter, r *http.Request) ([]byte, bool)
- func MakeChallengesAcceptHandler(b *Broker) goji.HandlerFunc
- func MakeChallengesGetHandler(b *Broker) goji.HandlerFunc
- func MakeChallengesGetOneHandler(b *Broker) goji.HandlerFunc
- func MakeChallengesPostHandler(b *Broker) goji.HandlerFunc
- func MakeGamesGetHandler(b *Broker) goji.HandlerFunc
- func MakeGamesGetOneHandler(b *Broker) goji.HandlerFunc
- func MakePlayersGetHandler(b *Broker) goji.HandlerFunc
- func MakePlayersGetOneHandler(b *Broker) goji.HandlerFunc
- func MakePlayersPatchHandler(b *Broker) goji.HandlerFunc
- func MakePlayersPostHandler(b *Broker, s *cachedshell.Shell) goji.HandlerFunc
- func WriteError(w http.ResponseWriter, e error, c int)
- func WriteJSON(w http.ResponseWriter, d interface{}, c int)
- type Broker
- type Challenge
- func (c *Challenge) Challenger() *Player
- func (c *Challenge) Comment() string
- func (c *Challenge) Committer() *Player
- func (c *Challenge) Hash() string
- func (c *Challenge) ID() string
- func (c *Challenge) IpfsJsonData() ([]byte, error)
- func (c *Challenge) Parent() Commit
- func (c *Challenge) Publish(s *cachedshell.Shell) (string, error)
- func (c *Challenge) Sign() error
- func (c *Challenge) Signature() []byte
- func (c *Challenge) SignatureData() ([]byte, error)
- func (c *Challenge) Timeout() time.Time
- func (c *Challenge) Timestamp() time.Time
- func (c *Challenge) Type() string
- func (c *Challenge) Verify() error
- type ChallengeAcceptance
- func (c *ChallengeAcceptance) Accepter() *Player
- func (c *ChallengeAcceptance) Challenge() *Challenge
- func (c *ChallengeAcceptance) Comment() string
- func (c *ChallengeAcceptance) Committer() *Player
- func (c *ChallengeAcceptance) Hash() string
- func (c *ChallengeAcceptance) ID() string
- func (c *ChallengeAcceptance) IpfsJsonData() ([]byte, error)
- func (c *ChallengeAcceptance) Parent() Commit
- func (c *ChallengeAcceptance) Publish(s *cachedshell.Shell) (string, error)
- func (c *ChallengeAcceptance) Sign() error
- func (c *ChallengeAcceptance) Signature() []byte
- func (c *ChallengeAcceptance) SignatureData() ([]byte, error)
- func (c *ChallengeAcceptance) Timeout() time.Time
- func (c *ChallengeAcceptance) Timestamp() time.Time
- func (c *ChallengeAcceptance) Type() string
- func (c *ChallengeAcceptance) Verify() error
- type ChallengeConfirmation
- func (c *ChallengeConfirmation) Acceptance() *ChallengeAcceptance
- func (c *ChallengeConfirmation) Comment() string
- func (c *ChallengeConfirmation) Committer() *Player
- func (c *ChallengeConfirmation) Confirmer() *Player
- func (c *ChallengeConfirmation) Hash() string
- func (c *ChallengeConfirmation) ID() string
- func (c *ChallengeConfirmation) IpfsJsonData() ([]byte, error)
- func (c *ChallengeConfirmation) Parent() Commit
- func (c *ChallengeConfirmation) Publish(s *cachedshell.Shell) (string, error)
- func (c *ChallengeConfirmation) Sign() error
- func (c *ChallengeConfirmation) Signature() []byte
- func (c *ChallengeConfirmation) SignatureData() ([]byte, error)
- func (c *ChallengeConfirmation) Timeout() time.Time
- func (c *ChallengeConfirmation) Timestamp() time.Time
- func (c *ChallengeConfirmation) Type() string
- func (c *ChallengeConfirmation) Verify() error
- type Commit
- type Game
- func (g *Game) Accept(accepter *Player, exp time.Duration, c string) error
- func (g *Game) Acceptance() *ChallengeAcceptance
- func (g *Game) Challenge() *Challenge
- func (g *Game) Commits() []Commit
- func (g *Game) Confirm(confirmer *Player, exp time.Duration, c string) error
- func (g *Game) Confirmation() *ChallengeConfirmation
- func (g *Game) ID() string
- func (g *Game) Merge(o *Game) error
- func (g *Game) Players() []*Player
- func (g *Game) Publish(s *cachedshell.Shell) (string, error)
- func (g *Game) Step(player *Player, data []byte) error
- func (g *Game) Steps() []*GameStep
- func (g *Game) Timeout() time.Time
- func (g *Game) Timestamp() time.Time
- func (g *Game) Write(out io.Writer) error
- type GameStep
- func (g *GameStep) Committer() *Player
- func (g *GameStep) Data() []byte
- func (g *GameStep) Hash() string
- func (g *GameStep) ID() string
- func (g *GameStep) IpfsJsonData() ([]byte, error)
- func (g *GameStep) Parent() Commit
- func (g *GameStep) Player() *Player
- func (g *GameStep) Publish(s *cachedshell.Shell) (string, error)
- func (g *GameStep) Sign() error
- func (g *GameStep) Signature() []byte
- func (g *GameStep) SignatureData() ([]byte, error)
- func (g *GameStep) Timestamp() time.Time
- func (g *GameStep) Type() string
- func (g *GameStep) Verify() error
- type IPGSTime
- type Player
- func (p *Player) Get(h string, s *cachedshell.Shell) (string, error)
- func (p *Player) ID() string
- func (p *Player) Key() *PublicKey
- func (p *Player) PrivateKey() *PrivateKey
- func (p *Player) Publish(s *cachedshell.Shell, author *Player) (string, error)
- func (p *Player) Read(in io.Reader) error
- func (p *Player) String() string
- func (p *Player) Update(o *Player) (bool, error)
- func (p *Player) Write(out io.Writer) error
- type PrivateKey
- type PublicKey
- func (k *PublicKey) Equals(o *PublicKey) bool
- func (k *PublicKey) Get(h string, s *cachedshell.Shell) error
- func (k *PublicKey) Hash() string
- func (k *PublicKey) Key() *crypto.PublicKey
- func (k *PublicKey) MarshalJSON() ([]byte, error)
- func (k *PublicKey) Publish(s *cachedshell.Shell) (string, error)
- func (k *PublicKey) UnmarshalJSON(d []byte) error
- type State
- func (st *State) AcceptGame(id string, exp time.Duration, c string) (string, error)
- func (st *State) AddGame(g *Game) (string, error)
- func (s *State) AddPlayer(p *Player) (changed bool)
- func (st *State) Challenges() []*Game
- func (s *State) Combine(o *State) (bool, error)
- func (st *State) Commit(nodeDir string, s *cachedshell.Shell, unpin bool) error
- func (st *State) ConfirmGame(id string, exp time.Duration, c string) error
- func (st *State) CreateGame(exp time.Duration, c string) (string, error)
- func (st *State) Game(id string) *Game
- func (st *State) Games() []*Game
- func (st *State) Get(h string, s *cachedshell.Shell) error
- func (st *State) LastUpdatedString() string
- func (st *State) ParseLastUpdated(s string) error
- func (s *State) PlayerForID(id string) *Player
- func (st *State) Publish(s *cachedshell.Shell) (string, error)
- func (st *State) Read(nodeDir string) error
- func (st *State) StepGame(id string, data []byte) error
- func (st *State) Write(nodeDir string) error
Constants ¶
View Source
const ( CommitterPublicKeyLinkName = "committer-public-key" DataLinkName = "data" ParentLinkName = "parent" CommitTypeChallenge = "challenge-offer" CommitTypeChallengeAcceptance = "challenge-accept" CommitTypeChallengeConfirm = "challenge-confirm" CommitTypeGameStep = "game-step" )
View Source
const ( AuthorPublicKeyLinkName = "author-public-key" PlayerPublicKeyLinkName = "player-public-key" )
View Source
const ( StateLinkName = "interplanetary-game-system" IdentityLinkName = "identity.pem" PlayersLinkName = "players" ChallengesLinkName = "challenges" GamesLinkName = "games" LastUpdatedFileName = "last-updated" StateDirectoryName = "state" PlayersDirectoryName = "players" GamesDirectoryName = "games" PrivateKeyFileName = "private.pem" )
Variables ¶
This section is empty.
Functions ¶
func GetRequestBody ¶
func MakeChallengesAcceptHandler ¶
func MakeChallengesAcceptHandler(b *Broker) goji.HandlerFunc
func MakeChallengesGetHandler ¶
func MakeChallengesGetHandler(b *Broker) goji.HandlerFunc
func MakeChallengesGetOneHandler ¶
func MakeChallengesGetOneHandler(b *Broker) goji.HandlerFunc
func MakeChallengesPostHandler ¶
func MakeChallengesPostHandler(b *Broker) goji.HandlerFunc
func MakeGamesGetHandler ¶
func MakeGamesGetHandler(b *Broker) goji.HandlerFunc
func MakeGamesGetOneHandler ¶
func MakeGamesGetOneHandler(b *Broker) goji.HandlerFunc
func MakePlayersGetHandler ¶
func MakePlayersGetHandler(b *Broker) goji.HandlerFunc
func MakePlayersGetOneHandler ¶
func MakePlayersGetOneHandler(b *Broker) goji.HandlerFunc
func MakePlayersPatchHandler ¶
func MakePlayersPatchHandler(b *Broker) goji.HandlerFunc
func MakePlayersPostHandler ¶
func MakePlayersPostHandler(b *Broker, s *cachedshell.Shell) goji.HandlerFunc
func WriteError ¶
func WriteError(w http.ResponseWriter, e error, c int)
func WriteJSON ¶
func WriteJSON(w http.ResponseWriter, d interface{}, c int)
Types ¶
type Challenge ¶
type Challenge struct {
// contains filtered or unexported fields
}
func NewChallenge ¶
func NewChallenge() *Challenge
func (*Challenge) Challenger ¶
func (*Challenge) IpfsJsonData ¶
func (*Challenge) SignatureData ¶
type ChallengeAcceptance ¶
type ChallengeAcceptance struct {
// contains filtered or unexported fields
}
func NewChallengeAcceptance ¶
func NewChallengeAcceptance() *ChallengeAcceptance
func (*ChallengeAcceptance) Accepter ¶
func (c *ChallengeAcceptance) Accepter() *Player
func (*ChallengeAcceptance) Challenge ¶
func (c *ChallengeAcceptance) Challenge() *Challenge
func (*ChallengeAcceptance) Comment ¶
func (c *ChallengeAcceptance) Comment() string
func (*ChallengeAcceptance) Committer ¶
func (c *ChallengeAcceptance) Committer() *Player
func (*ChallengeAcceptance) Hash ¶
func (c *ChallengeAcceptance) Hash() string
func (*ChallengeAcceptance) ID ¶
func (c *ChallengeAcceptance) ID() string
func (*ChallengeAcceptance) IpfsJsonData ¶
func (c *ChallengeAcceptance) IpfsJsonData() ([]byte, error)
func (*ChallengeAcceptance) Parent ¶
func (c *ChallengeAcceptance) Parent() Commit
func (*ChallengeAcceptance) Publish ¶
func (c *ChallengeAcceptance) Publish(s *cachedshell.Shell) (string, error)
func (*ChallengeAcceptance) Sign ¶
func (c *ChallengeAcceptance) Sign() error
func (*ChallengeAcceptance) Signature ¶
func (c *ChallengeAcceptance) Signature() []byte
func (*ChallengeAcceptance) SignatureData ¶
func (c *ChallengeAcceptance) SignatureData() ([]byte, error)
func (*ChallengeAcceptance) Timeout ¶
func (c *ChallengeAcceptance) Timeout() time.Time
func (*ChallengeAcceptance) Timestamp ¶
func (c *ChallengeAcceptance) Timestamp() time.Time
func (*ChallengeAcceptance) Type ¶
func (c *ChallengeAcceptance) Type() string
func (*ChallengeAcceptance) Verify ¶
func (c *ChallengeAcceptance) Verify() error
type ChallengeConfirmation ¶
type ChallengeConfirmation struct {
// contains filtered or unexported fields
}
func NewChallengeConfirmation ¶
func NewChallengeConfirmation() *ChallengeConfirmation
func (*ChallengeConfirmation) Acceptance ¶
func (c *ChallengeConfirmation) Acceptance() *ChallengeAcceptance
func (*ChallengeConfirmation) Comment ¶
func (c *ChallengeConfirmation) Comment() string
func (*ChallengeConfirmation) Committer ¶
func (c *ChallengeConfirmation) Committer() *Player
func (*ChallengeConfirmation) Confirmer ¶
func (c *ChallengeConfirmation) Confirmer() *Player
func (*ChallengeConfirmation) Hash ¶
func (c *ChallengeConfirmation) Hash() string
func (*ChallengeConfirmation) ID ¶
func (c *ChallengeConfirmation) ID() string
func (*ChallengeConfirmation) IpfsJsonData ¶
func (c *ChallengeConfirmation) IpfsJsonData() ([]byte, error)
func (*ChallengeConfirmation) Parent ¶
func (c *ChallengeConfirmation) Parent() Commit
func (*ChallengeConfirmation) Publish ¶
func (c *ChallengeConfirmation) Publish(s *cachedshell.Shell) (string, error)
func (*ChallengeConfirmation) Sign ¶
func (c *ChallengeConfirmation) Sign() error
func (*ChallengeConfirmation) Signature ¶
func (c *ChallengeConfirmation) Signature() []byte
func (*ChallengeConfirmation) SignatureData ¶
func (c *ChallengeConfirmation) SignatureData() ([]byte, error)
func (*ChallengeConfirmation) Timeout ¶
func (c *ChallengeConfirmation) Timeout() time.Time
func (*ChallengeConfirmation) Timestamp ¶
func (c *ChallengeConfirmation) Timestamp() time.Time
func (*ChallengeConfirmation) Type ¶
func (c *ChallengeConfirmation) Type() string
func (*ChallengeConfirmation) Verify ¶
func (c *ChallengeConfirmation) Verify() error
type Commit ¶
type Commit interface { Type() string Timestamp() time.Time ID() string Committer() *Player Parent() Commit Hash() string Signature() []byte SignatureData() ([]byte, error) Sign() error Verify() error IpfsJsonData() ([]byte, error) Publish(*cachedshell.Shell) (string, error) // contains filtered or unexported methods }
type Game ¶
type Game struct {
// contains filtered or unexported fields
}
func CreateGame ¶
func (*Game) Acceptance ¶
func (g *Game) Acceptance() *ChallengeAcceptance
func (*Game) Confirmation ¶
func (g *Game) Confirmation() *ChallengeConfirmation
type GameStep ¶
type GameStep struct {
// contains filtered or unexported fields
}
func NewGameStep ¶
func NewGameStep() *GameStep
func (*GameStep) IpfsJsonData ¶
func (*GameStep) SignatureData ¶
type IPGSTime ¶
IPGSTime wraps around time.Time for consistent text formatting
func (IPGSTime) MarshalJSON ¶
MarshalJSON creates a UTC RFC-3339 representation of the time.Time embedded within IPGSTime
type Player ¶
type Player struct { Timestamp time.Time Name string Flags map[string]int Nodes []string // contains filtered or unexported fields }
func NewPlayer ¶
func NewPlayer(pub *PublicKey, priv *PrivateKey) *Player
func (*Player) PrivateKey ¶
func (p *Player) PrivateKey() *PrivateKey
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
func NewPrivateKey ¶
func NewPrivateKey(k *crypto.PrivateKey) *PrivateKey
func (*PrivateKey) Key ¶
func (k *PrivateKey) Key() *crypto.PrivateKey
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
func (*PublicKey) MarshalJSON ¶
func (*PublicKey) UnmarshalJSON ¶
type State ¶
type State struct { LastUpdated time.Time Owner *Player Players []*Player // contains filtered or unexported fields }
func FindLatestState ¶
func FindStateForNode ¶
func FindStateForNode(nodeID string, s *cachedshell.Shell) (*State, error)
func (*State) AcceptGame ¶
func (*State) Challenges ¶
func (*State) ConfirmGame ¶
func (*State) LastUpdatedString ¶
func (*State) ParseLastUpdated ¶
func (*State) PlayerForID ¶
Click to show internal directories.
Click to hide internal directories.