Skip to content

Commit

Permalink
Run go fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis Fonseca committed Feb 4, 2018
1 parent 6a084d3 commit 72741e9
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 66 deletions.
11 changes: 4 additions & 7 deletions account-service/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ func passportLogin(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
log.WithField("Passport1.4 sign-in", authorizationMap["Passport1.4 sign-in"]).Warn("username")
log.WithField("pwd", authorizationMap["pwd"]).Warn("password")


w.Header().Set("Authentication-Info", "Passport1.4 da-status=success,from-PP="+authorizationMap["Passport1.4 sign-in"]+" ,ru=http://espassport.eso.com?mkt=EN-US&lc=1033&id=31071")

w.WriteHeader(http.StatusOK)
Expand Down Expand Up @@ -99,24 +98,23 @@ func masterTicket(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
responseBodyString :=
`<XMLBlobResult xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://zone.msn.com">
<statusCode>0</statusCode>
<xmlBlob>&lt;ticket&gt;&lt;duration&gt;2880000&lt;/duration&gt;&lt;sessionKey&gt;`+string(sessionKey)+`&lt;/sessionKey&gt;&lt;serviceName&gt;Master&lt;/serviceName&gt;&lt;playerName&gt;&lt;/playerName&gt;&lt;playerID&gt;0&lt;/playerID&gt;&lt;publicTokens&gt;&lt;/publicTokens&gt;&lt;iv&gt;3OkGeRUnv4zhbiKYo0CfBg==&lt;/iv&gt;&lt;productID&gt;&lt;/productID&gt;&lt;encryptedText&gt;V4pavoD/HSbll8ecenKOQjoeZ6+WVumK9n+J27oBBoSz2YdSMJ1w6hiY/U3g4UhO/B3cLOibjcSHdLaB3UvhexOFoAp/qbUu6E0nhmLQMvwEhWdqZ7W7QaBQaaxZsQli0s6ECkEPR4EUkNHBsdr3iA5PGfHR8BP1YsrU7jbat1NZ9QjIhQjjIkJGOB4ufnxSnYfja5cWZyDdiwqQwMcGi/9ztKR8Zjw3okZwl2Jov02AO9SoQSdMlbd8l1apYSZ/Z00yQIq02/vWKWgRI9of8ZsF0+HKG7gtWokvIQR4zphlNAGl72D91ylwVc/QzDOubKmxH1/K1sp5lvU/MX0biLi4PQZkAtMJUh+Qh9tuyxRKraAYHO795R5qmjnq7nQ7va2E++ZdoNLsvrPxHqpgg6ndhboRJmRY2hn/i5zy2Bx9MQx9bwDBwsI9PhKqbd9N5YiO/R7vC7ciQZWHBL9xAgVMrOH46UJame9oWIYx4CCn2R/39PKLR1fcSiadYEtHiTO90j6eabDqTF+Tk9/pSMJSE9uxL6rjF+HgM2B2c/s3Dp0li+nO4KLi/W/gHirVd/55whRNtvFWrC/+6kBA0k1YFu5Po8wkumGmGekdj990XScM7R7bPdZC1sL54LYADp9L3udFpuGmwM98cvpG+AqNY+4lSJGY3gwhzRaSVEUfp9/NrXMWaDm5Y4G5VHDL30LO0ljtBEqwBeIeE2ADoSzuUxsgji+nXuSUk74w/qUwg3b/bgSyARIibtRGhms6y9zk7/iSUcITtUhXs7NVU2d4iUF6iZHSOXewAnDdyBrqTw4MFdd3+rnFtR7X4C8xlWP4XeJIoD9uPseUTerBDEGES5WbQIx2vqH/ktpkW7j2XWAO+LNTMRXFNo7J9PBK/vrPUdNv3nZ7WLT55yWTKllb5C/9dthp8dvwySmMggqor+TH62/tbMCaiPIrgbnT1MVr9UbZL41ixt1+WzTINSr4qMwFGKwO0iCy02FrVRv6y3Kk5KfiqSK9Ku7u3uT5ykO14QFyqtxJPi1VerdwVnvPvNsmG5f2W0dnULO+KlVZK6HfTCsn5WS/KVkRNsOw+1Lw90KhhPziWXjCioOeOw==&lt;/encryptedText&gt;&lt;/ticket&gt;</xmlBlob></XMLBlobResult>`

<xmlBlob>&lt;ticket&gt;&lt;duration&gt;2880000&lt;/duration&gt;&lt;sessionKey&gt;` + string(sessionKey) + `&lt;/sessionKey&gt;&lt;serviceName&gt;Master&lt;/serviceName&gt;&lt;playerName&gt;&lt;/playerName&gt;&lt;playerID&gt;0&lt;/playerID&gt;&lt;publicTokens&gt;&lt;/publicTokens&gt;&lt;iv&gt;3OkGeRUnv4zhbiKYo0CfBg==&lt;/iv&gt;&lt;productID&gt;&lt;/productID&gt;&lt;encryptedText&gt;V4pavoD/HSbll8ecenKOQjoeZ6+WVumK9n+J27oBBoSz2YdSMJ1w6hiY/U3g4UhO/B3cLOibjcSHdLaB3UvhexOFoAp/qbUu6E0nhmLQMvwEhWdqZ7W7QaBQaaxZsQli0s6ECkEPR4EUkNHBsdr3iA5PGfHR8BP1YsrU7jbat1NZ9QjIhQjjIkJGOB4ufnxSnYfja5cWZyDdiwqQwMcGi/9ztKR8Zjw3okZwl2Jov02AO9SoQSdMlbd8l1apYSZ/Z00yQIq02/vWKWgRI9of8ZsF0+HKG7gtWokvIQR4zphlNAGl72D91ylwVc/QzDOubKmxH1/K1sp5lvU/MX0biLi4PQZkAtMJUh+Qh9tuyxRKraAYHO795R5qmjnq7nQ7va2E++ZdoNLsvrPxHqpgg6ndhboRJmRY2hn/i5zy2Bx9MQx9bwDBwsI9PhKqbd9N5YiO/R7vC7ciQZWHBL9xAgVMrOH46UJame9oWIYx4CCn2R/39PKLR1fcSiadYEtHiTO90j6eabDqTF+Tk9/pSMJSE9uxL6rjF+HgM2B2c/s3Dp0li+nO4KLi/W/gHirVd/55whRNtvFWrC/+6kBA0k1YFu5Po8wkumGmGekdj990XScM7R7bPdZC1sL54LYADp9L3udFpuGmwM98cvpG+AqNY+4lSJGY3gwhzRaSVEUfp9/NrXMWaDm5Y4G5VHDL30LO0ljtBEqwBeIeE2ADoSzuUxsgji+nXuSUk74w/qUwg3b/bgSyARIibtRGhms6y9zk7/iSUcITtUhXs7NVU2d4iUF6iZHSOXewAnDdyBrqTw4MFdd3+rnFtR7X4C8xlWP4XeJIoD9uPseUTerBDEGES5WbQIx2vqH/ktpkW7j2XWAO+LNTMRXFNo7J9PBK/vrPUdNv3nZ7WLT55yWTKllb5C/9dthp8dvwySmMggqor+TH62/tbMCaiPIrgbnT1MVr9UbZL41ixt1+WzTINSr4qMwFGKwO0iCy02FrVRv6y3Kk5KfiqSK9Ku7u3uT5ykO14QFyqtxJPi1VerdwVnvPvNsmG5f2W0dnULO+KlVZK6HfTCsn5WS/KVkRNsOw+1Lw90KhhPziWXjCioOeOw==&lt;/encryptedText&gt;&lt;/ticket&gt;</xmlBlob></XMLBlobResult>`

w.Header().Set("Authentication-Info", "Passport1.4 da-status=success,from-PP='username=asd ',ru=http://espassport.eso.com?mkt=EN-US&lc=1033&id=31071")
w.Header().Set("Content-Type", "application/xml")

log.Println(responseBodyString)
log.Println(responseBodyString)
w.WriteHeader(http.StatusOK)
w.Write([]byte(responseBodyString))
}

func notFound(w http.ResponseWriter, r *http.Request){
func notFound(w http.ResponseWriter, r *http.Request) {
log.WithField("url", r.RequestURI).Warn("Received invalid request: returning 404 Not Found")

http.NotFound(w, r)
}

func methodNotAllowed(w http.ResponseWriter, r *http.Request){
func methodNotAllowed(w http.ResponseWriter, r *http.Request) {
log.WithField("url", r.RequestURI).Warn("Received invalid request: returning 405 Method Not Allowed")

http.Error(w,
Expand All @@ -125,7 +123,6 @@ func methodNotAllowed(w http.ResponseWriter, r *http.Request){
)
}


func main() {
log.StandardLogger().Formatter = &log.TextFormatter{
FullTimestamp: true,
Expand Down
34 changes: 17 additions & 17 deletions config-server/account_service_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,42 @@ type AccountServiceGetConfigRequestEnvelope struct {
}

type AccountServiceGetConfigResponseEnvelope struct {
Soap string `xml:"xmlns:soap,attr"`
Xsi string `xml:"xmlns:xsi,attr"`
Xsd string `xml:"xmlns:xsd,attr"`
StatusCode int `xml:"soap:Body>GetConfigResponse>GetConfigResult>statusCode"`
Soap string `xml:"xmlns:soap,attr"`
Xsi string `xml:"xmlns:xsi,attr"`
Xsd string `xml:"xmlns:xsd,attr"`
StatusCode int `xml:"soap:Body>GetConfigResponse>GetConfigResult>statusCode"`
XmlBlob string `xml:"soap:Body>GetConfigResponse>GetConfigResult>xmlBlob"`
XMLName string `xml:"soap:Envelope"`
XMLName string `xml:"soap:Envelope"`
}

type AccountServiceConfig struct {
PassportLoginUrl string `xml:"PassportLoginUrl"`
HotmailLoginUrl string `xml:"HotmailLoginUrl"`
MSNLoginUrl string `xml:"MSNLoginUrl"`
PassportSiteID int `xml:"PassportSiteID"`
PassportSiteID int `xml:"PassportSiteID"`
MasterTicketUrl string `xml:"MasterTicketUrl"`
WebServiceUrl string `xml:"WebServiceUrl"`
XMLName string `xml:"config"`
XMLName string `xml:"config"`
}

func GetAccountServiceConfig() (*AccountServiceGetConfigResponseEnvelope, error) {
xmlBlob, err := xml.Marshal(AccountServiceConfig {
xmlBlob, err := xml.Marshal(AccountServiceConfig{
PassportLoginUrl: "aox.luisfonseca.xyz/aomsvr/login.php",
HotmailLoginUrl: "aox.luisfonseca.xyz/aomsvr/login.php",
MSNLoginUrl: "aox.luisfonseca.xyz/aomsvr/login.php",
PassportSiteID: 31071,
MasterTicketUrl: "aox.luisfonseca.xyz/aomsvr",
WebServiceUrl: "https://aox.luisfonseca.xyz/aomsvr/ZoneAccessService.php",
HotmailLoginUrl: "aox.luisfonseca.xyz/aomsvr/login.php",
MSNLoginUrl: "aox.luisfonseca.xyz/aomsvr/login.php",
PassportSiteID: 31071,
MasterTicketUrl: "aox.luisfonseca.xyz/aomsvr",
WebServiceUrl: "https://aox.luisfonseca.xyz/aomsvr/ZoneAccessService.php",
})
if err != nil {
return nil, err
}

return &AccountServiceGetConfigResponseEnvelope{
Soap: "http://schemas.xmlsoap.org/soap/envelope/",
Xsi: "http://www.w3.org/2001/XMLSchema-instance",
Xsd: "http://www.w3.org/2001/XMLSchema",
Soap: "http://schemas.xmlsoap.org/soap/envelope/",
Xsi: "http://www.w3.org/2001/XMLSchema-instance",
Xsd: "http://www.w3.org/2001/XMLSchema",
StatusCode: 0,
XmlBlob: string(xmlBlob),
XmlBlob: string(xmlBlob),
}, nil
}
4 changes: 2 additions & 2 deletions config-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ func accountServiceConfig(w http.ResponseWriter, r *http.Request, ps httprouter.
fmt.Fprintf(w, "%s", res)
}

func notFound(w http.ResponseWriter, r *http.Request){
func notFound(w http.ResponseWriter, r *http.Request) {
log.WithField("url", r.RequestURI).Warn("Received invalid request: returning 404 Not Found")

http.NotFound(w, r)
}

func methodNotAllowed(w http.ResponseWriter, r *http.Request){
func methodNotAllowed(w http.ResponseWriter, r *http.Request) {
log.WithField("url", r.RequestURI).Warn("Received invalid request: returning 405 Method Not Allowed")

http.Error(w,
Expand Down
2 changes: 1 addition & 1 deletion game-list-service/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package db
// Implemented using LevelDB.

import (
"github.com/pkg/errors"
"github.com/syndtr/goleveldb/leveldb"
"github.com/syndtr/goleveldb/leveldb/opt"
"github.com/pkg/errors"
)

type Database interface {
Expand Down
1 change: 0 additions & 1 deletion game-list-service/db/db_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ func (dbMock *DatabaseMock) ListGames(offset int, amount int) (map[string][]byte
return args.Get(0).(map[string][]byte), args.Error(1)
}


func (dbMock *DatabaseMock) OnGetNumberOfGames() *mock.Call {
return dbMock.On("GetNumberOfGames")
}
Expand Down
4 changes: 2 additions & 2 deletions game-list-service/db/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/syndtr/goleveldb/leveldb"
)

var dummyGameBytes = []byte{1,2,3}
var dummyGameBytes = []byte{1, 2, 3}

func TestInstanceDB(t *testing.T) {
Convey("Creating a new db should always succeed", t, func() {
Expand Down Expand Up @@ -52,7 +52,7 @@ func TestInstanceDB(t *testing.T) {
})
})

Convey("ListGames", func(){
Convey("ListGames", func() {
// TODO
})
})
Expand Down
5 changes: 3 additions & 2 deletions game-list-service/delete_game_req/types.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package delete_game_req

/*
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
Expand All @@ -8,8 +9,8 @@ package delete_game_req
</DeleteGame>
</soap:Body>
</soap:Envelope>
*/
*/

type Envelope struct {
GameId string `xml:"Body>DeleteGame>GameId"`
GameId string `xml:"Body>DeleteGame>GameId"`
}
12 changes: 6 additions & 6 deletions game-list-service/insert_game_req/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ package insert_game_req
</InsertGame>
</soap:Body>
</soap:Envelope>
*/
*/

type Envelope struct {
Soap string `xml:"xmlns:soap,attr"`
Soap string `xml:"xmlns:soap,attr"`

Game Game `xml:"Body>InsertGame>UpdatedGame"`
}

type Game struct {
GameName string `xml:"GameName,attr"`
KVPs []KVP `xml:"KVP"`
GameName string `xml:"GameName,attr"`
KVPs []KVP `xml:"KVP"`
}

type KVP struct {
K string `xml:"K,attr"`
V string `xml:"V,attr"`
K string `xml:"K,attr"`
V string `xml:"V,attr"`
}
8 changes: 4 additions & 4 deletions game-list-service/insert_game_resp/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package insert_game_resp

type Envelope struct {
XMLName string `xml:"soap:Envelope"`
Soap string `xml:"xmlns:soap,attr"`
Xsi string `xml:"xmlns:xsi,attr"`
Xsd string `xml:"xmlns:xsd,attr"`
Soap string `xml:"xmlns:soap,attr"`
Xsi string `xml:"xmlns:xsi,attr"`
Xsd string `xml:"xmlns:xsd,attr"`

InsertGameResult string `xml:"soap:Body>InsertGameResponse>InsertGameResult"`
InsertGameResult string `xml:"soap:Body>InsertGameResponse>InsertGameResult"`
}
6 changes: 3 additions & 3 deletions game-list-service/retrieve_games_req/types.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package retrieve_games_req

type Envelope struct {
Offset int `xml:"Body>RetrieveGames>Offset"`
Amount int `xml:"Body>RetrieveGames>Amount"`
SortColumn string `xml:"Body>RetrieveGames>SortColumn"`
Offset int `xml:"Body>RetrieveGames>Offset"`
Amount int `xml:"Body>RetrieveGames>Amount"`
SortColumn string `xml:"Body>RetrieveGames>SortColumn"`
// TODO: Not implemented yet
//FilterSettings FilterSettings `xml:"Body>RetrieveGames>filterSettings"`
//PreferPlayers PreferPlayers `xml:"Body>RetrieveGames>PreferPlayers"`
Expand Down
20 changes: 10 additions & 10 deletions game-list-service/retrieve_games_resp/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ package retrieve_games_resp

type Envelope struct {
XMLName string `xml:"soap:Envelope"`
Soap string `xml:"xmlns:soap,attr"`
Xsi string `xml:"xmlns:xsi,attr"`
Xsd string `xml:"xmlns:xsd,attr"`
Soap string `xml:"xmlns:soap,attr"`
Xsi string `xml:"xmlns:xsi,attr"`
Xsd string `xml:"xmlns:xsd,attr"`

PublishedGameCount int `xml:"soap:Body>RetrieveGamesResponse>RetrieveGamesResult>PublishedGameCount"`
Games []Game `xml:"soap:Body>RetrieveGamesResponse>RetrieveGamesResult>Games>Game"`
PublishedGameCount int `xml:"soap:Body>RetrieveGamesResponse>RetrieveGamesResult>PublishedGameCount"`
Games []Game `xml:"soap:Body>RetrieveGamesResponse>RetrieveGamesResult>Games>Game"`
}

type Game struct {
GameId string `xml:"GameId,attr"`
GameName string `xml:"GameName,attr"`
KVPs []KVP `xml:"KVP"`
GameId string `xml:"GameId,attr"`
GameName string `xml:"GameName,attr"`
KVPs []KVP `xml:"KVP"`
}

type KVP struct {
K string `xml:"K,attr"`
V string `xml:"V,attr"`
K string `xml:"K,attr"`
V string `xml:"V,attr"`
}
14 changes: 7 additions & 7 deletions game-list-service/update_game_req/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ package update_game_req
</InsertGame>
</soap:Body>
</soap:Envelope>
*/
*/

type Envelope struct {
Soap string `xml:"xmlns:soap,attr"`
Soap string `xml:"xmlns:soap,attr"`

Game Game `xml:"Body>UpdateGame>UpdatedGame"`
}

type Game struct {
GameName string `xml:"GameName,attr"`
GameId string `xml:"GameId,attr"`
KVPs []KVP `xml:"KVP"`
GameName string `xml:"GameName,attr"`
GameId string `xml:"GameId,attr"`
KVPs []KVP `xml:"KVP"`
}

type KVP struct {
K string `xml:"K,attr"`
V string `xml:"V,attr"`
K string `xml:"K,attr"`
V string `xml:"V,attr"`
}
8 changes: 4 additions & 4 deletions game-list-service/update_game_resp/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package update_game_resp

type Envelope struct {
XMLName string `xml:"soap:Envelope"`
Soap string `xml:"xmlns:soap,attr"`
Xsi string `xml:"xmlns:xsi,attr"`
Xsd string `xml:"xmlns:xsd,attr"`
Soap string `xml:"xmlns:soap,attr"`
Xsi string `xml:"xmlns:xsi,attr"`
Xsd string `xml:"xmlns:xsd,attr"`

UpdateGameResponse string `xml:"soap:Body>UpdateGameResponse"`
UpdateGameResponse string `xml:"soap:Body>UpdateGameResponse"`
}

0 comments on commit 72741e9

Please sign in to comment.