This commit is contained in:
parent
78e07731c8
commit
c85cd0bb8e
11 changed files with 644 additions and 0 deletions
26
rulebot/engine/board.go
Normal file
26
rulebot/engine/board.go
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
package engine
|
||||||
|
|
||||||
|
// Board is the board state of a game
|
||||||
|
type Board struct {
|
||||||
|
PlayerBoards map[*Player]PlayerBoard
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stack is a stack/list of cards
|
||||||
|
type Stack []*Card
|
||||||
|
|
||||||
|
// PlayerBoard is the side of the board belonging to a specific player
|
||||||
|
type PlayerBoard struct {
|
||||||
|
Home Zone // Player's home
|
||||||
|
Problems []Zone // All problems the player can place cards at
|
||||||
|
Deck Stack // Cards left in the main deck
|
||||||
|
ProblemDeck Stack // Cards left in the problem deck
|
||||||
|
Discards Stack // Cards in the discard pile
|
||||||
|
Banished Stack // Cards that have been banished
|
||||||
|
Hand Stack // Cards the player has in hand
|
||||||
|
}
|
||||||
|
|
||||||
|
// Zone is a place cards can go to/be played at
|
||||||
|
type Zone struct {
|
||||||
|
Cards []*CardInstance // Cards in the zone
|
||||||
|
Problem *CardInstance // If it's a problem, the problem's card
|
||||||
|
}
|
54
rulebot/engine/card.go
Normal file
54
rulebot/engine/card.go
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
package engine
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.fromouter.space/mcg/draft/mlp"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Card is a card of MLP:CCG
|
||||||
|
type Card struct {
|
||||||
|
Info mlp.Card
|
||||||
|
|
||||||
|
// Continuous abilities
|
||||||
|
Static []Ability
|
||||||
|
|
||||||
|
// Activated abilities
|
||||||
|
Activated []ActivatedAbility
|
||||||
|
|
||||||
|
// Triggered abilities
|
||||||
|
Triggered []TriggeredAbility
|
||||||
|
}
|
||||||
|
|
||||||
|
// CardInstance is an instance of a card
|
||||||
|
type CardInstance struct {
|
||||||
|
Identity Card
|
||||||
|
IsToken bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// ActivatedAbility is an ability that can be activated
|
||||||
|
type ActivatedAbility struct {
|
||||||
|
Timing Timing // When can this ability be activated
|
||||||
|
Ability Ability
|
||||||
|
}
|
||||||
|
|
||||||
|
// TriggeredAbility is an ability that gets triggered during an event
|
||||||
|
type TriggeredAbility struct {
|
||||||
|
Trigger Event // When is this ability triggered
|
||||||
|
Ability Ability
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ability is an ability a card can have
|
||||||
|
type Ability struct {
|
||||||
|
Requirements []Effect // These must resolve for the effects to activate
|
||||||
|
Effects []Effect
|
||||||
|
}
|
||||||
|
|
||||||
|
// Timing is when a player can activate an ability/play an event
|
||||||
|
type Timing string
|
||||||
|
|
||||||
|
// All timings
|
||||||
|
const (
|
||||||
|
TimeInstant Timing = "instant"
|
||||||
|
TimeMainPhase Timing = "main phase"
|
||||||
|
TimeFaceoff Timing = "faceoff"
|
||||||
|
TimeReaction Timing = "reaction"
|
||||||
|
)
|
37
rulebot/engine/card_test.go
Normal file
37
rulebot/engine/card_test.go
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
package engine_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.fromouter.space/mcg/draft/mlp"
|
||||||
|
"git.fromouter.space/mcg/mlp-server-tools/rulebot/engine"
|
||||||
|
)
|
||||||
|
|
||||||
|
var cards = map[string]engine.Card{
|
||||||
|
"pr15": engine.Card{
|
||||||
|
Info: mlp.Card{
|
||||||
|
ID: "pr15",
|
||||||
|
Name: "Rainbow Dash",
|
||||||
|
Subname: "Weather Leader",
|
||||||
|
Type: "Friend",
|
||||||
|
Text: "Main Phase: Exhaust this card to ready another one of your cards.",
|
||||||
|
},
|
||||||
|
Activated: []engine.ActivatedAbility{
|
||||||
|
engine.ActivatedAbility{
|
||||||
|
Timing: engine.TimeMainPhase,
|
||||||
|
Ability: engine.Ability{
|
||||||
|
Requirements: []engine.Effect{
|
||||||
|
engine.Effect{
|
||||||
|
Type: engine.EfExhaust,
|
||||||
|
TargetType: engine.TargetThisCard,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Effects: []engine.Effect{
|
||||||
|
engine.Effect{
|
||||||
|
Type: engine.EfReady,
|
||||||
|
TargetType: engine.TargetOwnCard,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
45
rulebot/engine/effect.go
Normal file
45
rulebot/engine/effect.go
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
package engine
|
||||||
|
|
||||||
|
// Effect is an effect a triggered/activated ability can trigger
|
||||||
|
type Effect struct {
|
||||||
|
Type EffectType
|
||||||
|
TargetType TargetingType
|
||||||
|
|
||||||
|
// Targets, if not implicit
|
||||||
|
TargetCard *CardInstance
|
||||||
|
TargetPlayer *Player
|
||||||
|
}
|
||||||
|
|
||||||
|
// EffectType is the type of an effect
|
||||||
|
type EffectType string
|
||||||
|
|
||||||
|
// All effect types
|
||||||
|
const (
|
||||||
|
EfDraw EffectType = "draw card"
|
||||||
|
EfTurn EffectType = "turn card over"
|
||||||
|
EfFrighten EffectType = "frighten card"
|
||||||
|
EfRally EffectType = "rally card"
|
||||||
|
EfExhaust EffectType = "exhaust card"
|
||||||
|
EfReady EffectType = "ready card"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TargetingType is how an ability is targeted
|
||||||
|
type TargetingType string
|
||||||
|
|
||||||
|
// All targeting types
|
||||||
|
const (
|
||||||
|
TargetThisCard TargetingType = "this card"
|
||||||
|
TargetThisProblem TargetingType = "this card's problem"
|
||||||
|
TargetCard TargetingType = "card"
|
||||||
|
TargetFriend TargetingType = "friend"
|
||||||
|
TargetPlayer TargetingType = "player"
|
||||||
|
TargetOpponent TargetingType = "opponent"
|
||||||
|
TargetOwnCard TargetingType = "own card"
|
||||||
|
TargetOwnFriend TargetingType = "own friend"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Apply tries to apply an effect
|
||||||
|
func (e *Effect) Apply() error {
|
||||||
|
//TODO
|
||||||
|
return nil
|
||||||
|
}
|
28
rulebot/engine/event.go
Normal file
28
rulebot/engine/event.go
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
package engine
|
||||||
|
|
||||||
|
// Event is an event that happened in a game
|
||||||
|
type Event struct {
|
||||||
|
Type EventType
|
||||||
|
}
|
||||||
|
|
||||||
|
// EventType is a type of event
|
||||||
|
type EventType string
|
||||||
|
|
||||||
|
// All event types
|
||||||
|
const (
|
||||||
|
EvtPlayCard EventType = "card played" // when * play
|
||||||
|
EvtEntersPlay EventType = "card entered play" // when * enters play
|
||||||
|
EvtLeavesPlay EventType = "card left play" // when * leaves play
|
||||||
|
EvtMove EventType = "card moved" // when you move *
|
||||||
|
EvtConfront EventType = "problem confrontend" // when you confront * problem
|
||||||
|
EvtWinFaceoff EventType = "faceoff won" // when you win a faceoff
|
||||||
|
|
||||||
|
// Card-specific events
|
||||||
|
EvtLostTokens EventType = "player lost tokens" // when an opponent loses * action tokens
|
||||||
|
EvtDrawn EventType = "player drew a card" // when * draws a card
|
||||||
|
|
||||||
|
// Troublemaker events
|
||||||
|
EvtTMUncovered EventType = "tm uncovered" // when this card is uncovered
|
||||||
|
EvtTMChallenged EventType = "tm challenged" // when an opponent challenges *
|
||||||
|
EvtTMDefeated EventType = "tm defeated" // when this card is defeated
|
||||||
|
)
|
79
rulebot/engine/game.go
Normal file
79
rulebot/engine/game.go
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
package engine
|
||||||
|
|
||||||
|
// Game is a game of MLP:CCG
|
||||||
|
type Game struct {
|
||||||
|
Players []*Player
|
||||||
|
Board Board
|
||||||
|
Turns []*Turn
|
||||||
|
CurrentTurn *Turn
|
||||||
|
}
|
||||||
|
|
||||||
|
// Action is an action that can be taken by players
|
||||||
|
type Action struct {
|
||||||
|
Type ActionType
|
||||||
|
}
|
||||||
|
|
||||||
|
// ActionType is a type of action players can take
|
||||||
|
type ActionType string
|
||||||
|
|
||||||
|
// All actions
|
||||||
|
const (
|
||||||
|
ActDraw ActionType = "draw"
|
||||||
|
ActPlay ActionType = "play a card"
|
||||||
|
ActActivate ActionType = "activate ability"
|
||||||
|
ActMove ActionType = "move character"
|
||||||
|
ActRally ActionType = "rally friend"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Turn is a turn in a game
|
||||||
|
type Turn struct {
|
||||||
|
ActionLog []Action
|
||||||
|
Player *Player
|
||||||
|
Phase Phase
|
||||||
|
Step PhaseStep
|
||||||
|
}
|
||||||
|
|
||||||
|
// Phase is a turn phase
|
||||||
|
type Phase string
|
||||||
|
|
||||||
|
// All phases
|
||||||
|
const (
|
||||||
|
PhaseReady = "ready phase"
|
||||||
|
PhaseTroublemaker = "troublemaker phase"
|
||||||
|
PhaseMain = "main phase"
|
||||||
|
PhaseScore = "score phase"
|
||||||
|
PhaseEnd = "end phase"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PhaseStep is a step in a phase
|
||||||
|
type PhaseStep string
|
||||||
|
|
||||||
|
// All steps
|
||||||
|
const (
|
||||||
|
// Ready phase steps
|
||||||
|
ReadyStep PhaseStep = "ready step"
|
||||||
|
ActionStep PhaseStep = "action step"
|
||||||
|
DrawStep PhaseStep = "draw step"
|
||||||
|
|
||||||
|
// Troublemaker phase steps
|
||||||
|
UncoverStep PhaseStep = "uncover step"
|
||||||
|
ChallengeStep PhaseStep = "challenge step"
|
||||||
|
|
||||||
|
// Score phase steps
|
||||||
|
ConfrontStep PhaseStep = "confront step"
|
||||||
|
FaceoffStep PhaseStep = "faceoff step"
|
||||||
|
SolveStep PhaseStep = "solve step"
|
||||||
|
|
||||||
|
// End phase steps
|
||||||
|
EndOfTurnStep PhaseStep = "end of turn step"
|
||||||
|
WrapUpStep PhaseStep = "wrap up step"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PhaseStepList lists all the steps of each phase
|
||||||
|
var PhaseStepList = map[Phase][]PhaseStep{
|
||||||
|
PhaseReady: []PhaseStep{ReadyStep, ActionStep, DrawStep},
|
||||||
|
PhaseTroublemaker: []PhaseStep{UncoverStep, ChallengeStep},
|
||||||
|
PhaseMain: []PhaseStep{},
|
||||||
|
PhaseScore: []PhaseStep{ConfrontStep, FaceoffStep, SolveStep},
|
||||||
|
PhaseEnd: []PhaseStep{EndOfTurnStep, WrapUpStep},
|
||||||
|
}
|
5
rulebot/engine/player.go
Normal file
5
rulebot/engine/player.go
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
package engine
|
||||||
|
|
||||||
|
// Player is a player in a game
|
||||||
|
type Player struct {
|
||||||
|
}
|
10
rulebot/go.mod
Normal file
10
rulebot/go.mod
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
module git.fromouter.space/mcg/mlp-server-tools/rulebot
|
||||||
|
|
||||||
|
go 1.12
|
||||||
|
|
||||||
|
require (
|
||||||
|
git.fromouter.space/Artificiale/moa v0.0.1
|
||||||
|
git.fromouter.space/mcg/cardgage v0.0.4
|
||||||
|
git.fromouter.space/mcg/draft v0.0.4
|
||||||
|
github.com/go-kit/kit v0.9.0
|
||||||
|
)
|
193
rulebot/go.sum
Normal file
193
rulebot/go.sum
Normal file
|
@ -0,0 +1,193 @@
|
||||||
|
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
|
git.fromouter.space/Artificiale/moa v0.0.1-p2/go.mod h1:dHYul6vVMwDCzre18AFs6NmI22yeI7AE0iQC1jFEQi0=
|
||||||
|
git.fromouter.space/Artificiale/moa v0.0.1 h1:1mVML0v3Bh5Fya9dz7pKtlt7+Z6hRzXxmlY7sBvw0FI=
|
||||||
|
git.fromouter.space/Artificiale/moa v0.0.1/go.mod h1:dHYul6vVMwDCzre18AFs6NmI22yeI7AE0iQC1jFEQi0=
|
||||||
|
git.fromouter.space/mcg/cardgage v0.0.4 h1:LHMUeNMh0QiMkM3TgsLe9l5sDmanQrej6UiWSVTb67c=
|
||||||
|
git.fromouter.space/mcg/cardgage v0.0.4/go.mod h1:vCmJ9HRdRGSWg2YQW9oNG7geYACdgWYmzL+zZdrsYhQ=
|
||||||
|
git.fromouter.space/mcg/draft v0.0.4 h1:BuyjLuKnNUrPQe33CaEMCv+OIe1vPBDdeD2Kl2Fklvs=
|
||||||
|
git.fromouter.space/mcg/draft v0.0.4/go.mod h1:QQmDm9FgAZL3b2/pIDd4Eo608SxMiCQQe5vIybe/CDY=
|
||||||
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
|
github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
|
||||||
|
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
|
||||||
|
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
|
||||||
|
github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878 h1:EFSB7Zo9Eg91v7MJPVsifUysc/wPdN+NOnVe6bWbdBM=
|
||||||
|
github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878/go.mod h1:3AMJUQhVx52RsWOnlkpikZr01T/yAVN2gn0861vByNg=
|
||||||
|
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||||
|
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||||
|
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
||||||
|
github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k=
|
||||||
|
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
|
||||||
|
github.com/cenkalti/backoff v2.0.0+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
|
||||||
|
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
|
||||||
|
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
|
||||||
|
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||||
|
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||||
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||||
|
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||||
|
github.com/go-kit/kit v0.9.0 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk=
|
||||||
|
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||||
|
github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA=
|
||||||
|
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||||
|
github.com/go-redis/redis v6.15.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
|
||||||
|
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
|
||||||
|
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||||
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
|
||||||
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||||
|
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||||
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
|
||||||
|
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||||
|
github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=
|
||||||
|
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||||
|
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||||
|
github.com/gorilla/mux v1.7.2 h1:zoNxOV7WjqXptQOVngLmcSQgXmgk4NMz1HibBchjl/I=
|
||||||
|
github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||||
|
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
|
||||||
|
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||||
|
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4=
|
||||||
|
github.com/hashicorp/consul/api v1.1.0 h1:BNQPM9ytxj6jbjjdRPioQ94T6YXriSopn0i8COv6SRA=
|
||||||
|
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
|
||||||
|
github.com/hashicorp/consul/sdk v0.1.1 h1:LnuDWGNsoajlhGyHJvuWW6FVqRl8JOTPqS6CPTsYjhY=
|
||||||
|
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
|
||||||
|
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
|
||||||
|
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||||
|
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
||||||
|
github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM=
|
||||||
|
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
||||||
|
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
||||||
|
github.com/hashicorp/go-immutable-radix v1.1.0 h1:vN9wG1D6KG6YHRTWr8512cxGOVgTMEfgEdSj/hr8MPc=
|
||||||
|
github.com/hashicorp/go-immutable-radix v1.1.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
||||||
|
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
|
||||||
|
github.com/hashicorp/go-msgpack v0.5.5 h1:i9R9JSrqIz0QVLz3sz+i3YJdT7TTSLcfLLzJi9aZTuI=
|
||||||
|
github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
|
||||||
|
github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o=
|
||||||
|
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
||||||
|
github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
|
||||||
|
github.com/hashicorp/go-rootcerts v1.0.0 h1:Rqb66Oo1X/eSV1x66xbDccZjhJigjg0+e82kpwzSwCI=
|
||||||
|
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
|
||||||
|
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
|
||||||
|
github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc=
|
||||||
|
github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A=
|
||||||
|
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
|
||||||
|
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||||
|
github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE=
|
||||||
|
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||||
|
github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
|
||||||
|
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||||
|
github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=
|
||||||
|
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||||
|
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
|
||||||
|
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
|
||||||
|
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
|
||||||
|
github.com/hashicorp/memberlist v0.1.4 h1:gkyML/r71w3FL8gUi74Vk76avkj/9lYAY9lvg0OcoGs=
|
||||||
|
github.com/hashicorp/memberlist v0.1.4/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
|
||||||
|
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
|
||||||
|
github.com/hashicorp/serf v0.8.3 h1:MWYcmct5EtKz0efYooPcL0yNkem+7kWxqXDi/UIh+8k=
|
||||||
|
github.com/hashicorp/serf v0.8.3/go.mod h1:UpNcs7fFbpKIyZaUuSW6EPiH+eZC7OuyFD+wc1oal+k=
|
||||||
|
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||||
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
|
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
|
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY=
|
||||||
|
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||||
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
|
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||||
|
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||||
|
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||||
|
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||||
|
github.com/miekg/dns v1.1.13 h1:x7DQtkU0cedzeS8TD36tT/w1Hm4rDtfCaYYAHE7TTBI=
|
||||||
|
github.com/miekg/dns v1.1.13/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||||
|
github.com/minio/highwayhash v1.0.0/go.mod h1:xQboMTeM9nY9v/LlAOxFctujiv5+Aq2hR5dxBpaMbdc=
|
||||||
|
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
|
||||||
|
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||||
|
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
||||||
|
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||||
|
github.com/mitchellh/go-testing-interface v1.0.0 h1:fzU/JVNcaqHQEcVFAKeR41fkiLdIPrefOvVG1VZ96U0=
|
||||||
|
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
|
||||||
|
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
|
||||||
|
github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
|
||||||
|
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
|
||||||
|
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||||
|
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
|
||||||
|
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||||
|
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
|
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
|
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||||
|
github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
||||||
|
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||||
|
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
|
||||||
|
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||||
|
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||||
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||||
|
github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM=
|
||||||
|
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||||
|
github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
|
||||||
|
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||||
|
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||||
|
github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||||
|
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I=
|
||||||
|
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
|
||||||
|
github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
|
||||||
|
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||||
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||||
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
|
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||||
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
|
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
|
||||||
|
golang.org/x/crypto v0.0.0-20180820150726-614d502a4dac/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
|
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5 h1:8dUaAV7K4uHsF56JQWkprecIQKdPHtR9jCHF5nB8uzc=
|
||||||
|
golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
|
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
|
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
|
||||||
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20180828065106-d99a578cf41b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190531132440-69e3a3a65b5b h1:cuzzKXORsbIjh3IeOgOj0x2QA08ntIxmwi1mkRC3qoc=
|
||||||
|
golang.org/x/sys v0.0.0-20190531132440-69e3a3a65b5b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
|
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||||
|
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc=
|
||||||
|
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||||
|
google.golang.org/grpc v1.21.0 h1:G+97AoqBnmZIT91cLG/EkCoK9NSelj64P8bOHHNmGn0=
|
||||||
|
google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/fatih/pool.v2 v2.0.0/go.mod h1:8xVGeu1/2jr2wm5V9SPuMht2H5AEmf5aFMGSQixtjTY=
|
||||||
|
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||||
|
gopkg.in/rethinkdb/rethinkdb-go.v5 v5.0.1/go.mod h1:x+1XKi70FH0kHCpvPQ78hGBCCxoNdE7sP+kEFdKgN6A=
|
||||||
|
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||||
|
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
89
rulebot/main.go
Normal file
89
rulebot/main.go
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
package main // import "git.fromouter.space/mcg/mlp-server-tools/rulebot"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
|
"os"
|
||||||
|
"os/signal"
|
||||||
|
"strings"
|
||||||
|
"syscall"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"git.fromouter.space/Artificiale/moa/sd"
|
||||||
|
botapi "git.fromouter.space/mcg/cardgage/client/bot"
|
||||||
|
"github.com/go-kit/kit/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
var logger log.Logger
|
||||||
|
var logAll bool
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
consulAddr := flag.String("consul.addr", "consul:8500", "Consul address")
|
||||||
|
botName := flag.String("bot.name", "rulebot", "Bot name")
|
||||||
|
gameFilter := flag.String("filter.game", "mlpccg-mcg", "What game to filter for (separated by comma)")
|
||||||
|
tagFilter := flag.String("filter.tag", "+rules", "What tags to filter for (separated by comma)")
|
||||||
|
flag.BoolVar(&logAll, "debug.log", false, "Log a lot of stuff")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
logger = log.NewLogfmtLogger(os.Stderr)
|
||||||
|
logger = log.With(logger, "ts", log.DefaultTimestampUTC)
|
||||||
|
logger = log.With(logger, "caller", log.DefaultCaller)
|
||||||
|
|
||||||
|
// Register with consul
|
||||||
|
registrar := sd.Register(*consulAddr, sd.Options{
|
||||||
|
Name: "rulebot",
|
||||||
|
Tags: []string{
|
||||||
|
"bot", // I am a room bot
|
||||||
|
},
|
||||||
|
}, logger)
|
||||||
|
defer registrar.Deregister()
|
||||||
|
|
||||||
|
// Seed RNG
|
||||||
|
rand.Seed(time.Now().UnixNano())
|
||||||
|
|
||||||
|
// Initialize consul client for service discovery
|
||||||
|
sd.InitClient(*consulAddr)
|
||||||
|
|
||||||
|
errs := make(chan error)
|
||||||
|
go func() {
|
||||||
|
c := make(chan os.Signal)
|
||||||
|
signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
|
||||||
|
errs <- fmt.Errorf("%s", <-c)
|
||||||
|
}()
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
games := strings.Split(*gameFilter, ",")
|
||||||
|
tags := strings.Split(*tagFilter, ",")
|
||||||
|
errs <- runBot(*botName, games, tags)
|
||||||
|
}()
|
||||||
|
|
||||||
|
logger.Log("exit", <-errs)
|
||||||
|
}
|
||||||
|
|
||||||
|
func runBot(name string, games, tags []string) error {
|
||||||
|
// Search for roomsvc
|
||||||
|
roomsvc, err := sd.GetOne("roomsvc")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
addr := fmt.Sprintf("ws://%s:%d/bot", roomsvc.Service.Address, roomsvc.Service.Port)
|
||||||
|
|
||||||
|
wsbot, err := botapi.NewBot(addr, botapi.Params{
|
||||||
|
Name: name,
|
||||||
|
MsgBufferSize: 10,
|
||||||
|
Logger: logger,
|
||||||
|
GameIDs: games,
|
||||||
|
Tags: tags,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
draftbot := NewRuleBot(wsbot, name)
|
||||||
|
wsbot.Listen(draftbot.OnMessage)
|
||||||
|
|
||||||
|
return errors.New("eof")
|
||||||
|
}
|
78
rulebot/rulebot.go
Normal file
78
rulebot/rulebot.go
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
room "git.fromouter.space/mcg/cardgage/room/api"
|
||||||
|
)
|
||||||
|
|
||||||
|
// RuleBot is the functional part of RuleBot
|
||||||
|
type RuleBot struct {
|
||||||
|
API BotInterface
|
||||||
|
Name string
|
||||||
|
Rooms map[string]roomInfo
|
||||||
|
Games map[string]*engine.Game
|
||||||
|
}
|
||||||
|
|
||||||
|
type roomInfo struct {
|
||||||
|
Name string
|
||||||
|
Owner string
|
||||||
|
}
|
||||||
|
|
||||||
|
// BotInterface is the interface needed by RuleBot for working in cardgage
|
||||||
|
// This exists so that RuleBot can be attached to a mocked API for testing
|
||||||
|
type BotInterface interface {
|
||||||
|
Send(room.BotMessage)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewRuleBot creates a new rule engine instance with the given name
|
||||||
|
// and communication interface
|
||||||
|
func NewRuleBot(botAPI BotInterface, name string) *RuleBot {
|
||||||
|
return &RuleBot{
|
||||||
|
API: botAPI,
|
||||||
|
Name: name,
|
||||||
|
Rooms: make(map[string]roomInfo),
|
||||||
|
Sessions: make(map[string]*session),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// OnMessage is the function to be called when messages are received
|
||||||
|
func (d *RuleBot) OnMessage(msg room.ServerMessage) {
|
||||||
|
switch msg.Type {
|
||||||
|
case room.MsgMessage:
|
||||||
|
if logAll {
|
||||||
|
logger.Log("event", "message",
|
||||||
|
"roomid", msg.RoomID,
|
||||||
|
"from", msg.Message.From,
|
||||||
|
"to", msg.Message.To,
|
||||||
|
"content", msg.Message.Message)
|
||||||
|
}
|
||||||
|
// Only consider messages that speak directly to me
|
||||||
|
if msg.Message.To == d.Name {
|
||||||
|
d.handleMessage(msg.RoomID, *msg.Message)
|
||||||
|
}
|
||||||
|
case room.MsgEvent:
|
||||||
|
if logAll {
|
||||||
|
logger.Log("event", "event",
|
||||||
|
"roomid", msg.RoomID,
|
||||||
|
"content", msg.Event.Message)
|
||||||
|
}
|
||||||
|
d.handleEvent(msg.RoomID, *msg.Event)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *RuleBot) sendMessage(roomid string, msg room.Message) {
|
||||||
|
d.API.Send(room.BotMessage{
|
||||||
|
RoomID: roomid,
|
||||||
|
Type: room.MsgMessage,
|
||||||
|
Message: &msg,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *RuleBot) handleMessage(roomid string, msg room.Message) {
|
||||||
|
//TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *RuleBot) handleSessionMessages(roomid string, s *session) {
|
||||||
|
for msg := range s.messages {
|
||||||
|
d.sendMessage(roomid, msg)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue