diff --git a/account-service/main.go b/account-service/main.go index 9e3d0a2..ae31e77 100644 --- a/account-service/main.go +++ b/account-service/main.go @@ -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) @@ -99,24 +98,23 @@ func masterTicket(w http.ResponseWriter, r *http.Request, ps httprouter.Params) responseBodyString := ` 0 - <ticket><duration>2880000</duration><sessionKey>`+string(sessionKey)+`</sessionKey><serviceName>Master</serviceName><playerName></playerName><playerID>0</playerID><publicTokens></publicTokens><iv>3OkGeRUnv4zhbiKYo0CfBg==</iv><productID></productID><encryptedText>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==</encryptedText></ticket>` - + <ticket><duration>2880000</duration><sessionKey>` + string(sessionKey) + `</sessionKey><serviceName>Master</serviceName><playerName></playerName><playerID>0</playerID><publicTokens></publicTokens><iv>3OkGeRUnv4zhbiKYo0CfBg==</iv><productID></productID><encryptedText>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==</encryptedText></ticket>` 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, @@ -125,7 +123,6 @@ func methodNotAllowed(w http.ResponseWriter, r *http.Request){ ) } - func main() { log.StandardLogger().Formatter = &log.TextFormatter{ FullTimestamp: true, diff --git a/config-server/account_service_config.go b/config-server/account_service_config.go index 89d85aa..70855f4 100644 --- a/config-server/account_service_config.go +++ b/config-server/account_service_config.go @@ -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 } diff --git a/config-server/main.go b/config-server/main.go index 2d2959a..6ad8c9d 100644 --- a/config-server/main.go +++ b/config-server/main.go @@ -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, diff --git a/game-list-service/db/db.go b/game-list-service/db/db.go index 067b440..4340f6a 100644 --- a/game-list-service/db/db.go +++ b/game-list-service/db/db.go @@ -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 { diff --git a/game-list-service/db/db_mock.go b/game-list-service/db/db_mock.go index 2359b0f..0d84773 100644 --- a/game-list-service/db/db_mock.go +++ b/game-list-service/db/db_mock.go @@ -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") } diff --git a/game-list-service/db/db_test.go b/game-list-service/db/db_test.go index ef33cc1..d6925e5 100644 --- a/game-list-service/db/db_test.go +++ b/game-list-service/db/db_test.go @@ -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() { @@ -52,7 +52,7 @@ func TestInstanceDB(t *testing.T) { }) }) - Convey("ListGames", func(){ + Convey("ListGames", func() { // TODO }) }) diff --git a/game-list-service/delete_game_req/types.go b/game-list-service/delete_game_req/types.go index 30a66cc..b0c13aa 100644 --- a/game-list-service/delete_game_req/types.go +++ b/game-list-service/delete_game_req/types.go @@ -1,4 +1,5 @@ package delete_game_req + /* @@ -8,8 +9,8 @@ package delete_game_req - */ +*/ type Envelope struct { - GameId string `xml:"Body>DeleteGame>GameId"` + GameId string `xml:"Body>DeleteGame>GameId"` } diff --git a/game-list-service/insert_game_req/types.go b/game-list-service/insert_game_req/types.go index 0306a42..463c69c 100644 --- a/game-list-service/insert_game_req/types.go +++ b/game-list-service/insert_game_req/types.go @@ -34,20 +34,20 @@ package insert_game_req - */ +*/ 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"` } diff --git a/game-list-service/insert_game_resp/types.go b/game-list-service/insert_game_resp/types.go index 521d851..127ed7d 100644 --- a/game-list-service/insert_game_resp/types.go +++ b/game-list-service/insert_game_resp/types.go @@ -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"` } diff --git a/game-list-service/retrieve_games_req/types.go b/game-list-service/retrieve_games_req/types.go index c831229..3b2a316 100644 --- a/game-list-service/retrieve_games_req/types.go +++ b/game-list-service/retrieve_games_req/types.go @@ -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"` diff --git a/game-list-service/retrieve_games_resp/types.go b/game-list-service/retrieve_games_resp/types.go index 93cd0b8..cbdf140 100644 --- a/game-list-service/retrieve_games_resp/types.go +++ b/game-list-service/retrieve_games_resp/types.go @@ -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"` } diff --git a/game-list-service/update_game_req/types.go b/game-list-service/update_game_req/types.go index 950267b..cc3d913 100644 --- a/game-list-service/update_game_req/types.go +++ b/game-list-service/update_game_req/types.go @@ -34,21 +34,21 @@ package update_game_req - */ +*/ 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"` } diff --git a/game-list-service/update_game_resp/types.go b/game-list-service/update_game_resp/types.go index fc79731..e89a96a 100644 --- a/game-list-service/update_game_resp/types.go +++ b/game-list-service/update_game_resp/types.go @@ -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"` }