From 58a76230dfbfba3911f9c5fa561f4cf1bfc2f167 Mon Sep 17 00:00:00 2001 From: Akatsuki Levi Date: Fri, 12 Apr 2024 19:17:06 -0300 Subject: [PATCH] feat: Progress to add Splatoon servers --- compose.yml | 48 +++++++++++++++++++ environment/splatoon-secure.conf | 21 ++++++++ environment/splatoon.env | 2 + logs/splatoon-authentication/.gitkeep | 0 logs/splatoon-secure/.gitkeep | 0 .../splatoon-authentication/dockerize.patch | 23 +++++++++ patches/splatoon-secure/dockerize.patch | 23 +++++++++ patches/splatoon-secure/fix-no-param3.patch | 48 +++++++++++++++++++ repos/BOSS | 2 +- repos/Inkay | 2 +- repos/account | 2 +- repos/friends | 2 +- repos/juxtaposition-ui | 2 +- repos/mitmproxy-pretendo | 2 +- repos/splatoon-authentication | 1 + repos/splatoon-secure | 1 + repos/website | 2 +- .../update-account-servers-database.js | 9 ++++ scripts/setup-environment.sh | 1 + setup.sh | 2 +- 20 files changed, 185 insertions(+), 8 deletions(-) create mode 100644 environment/splatoon-secure.conf create mode 100644 environment/splatoon.env create mode 100644 logs/splatoon-authentication/.gitkeep create mode 100644 logs/splatoon-secure/.gitkeep create mode 100644 patches/splatoon-authentication/dockerize.patch create mode 100644 patches/splatoon-secure/dockerize.patch create mode 100644 patches/splatoon-secure/fix-no-param3.patch create mode 160000 repos/splatoon-authentication create mode 160000 repos/splatoon-secure diff --git a/compose.yml b/compose.yml index b3c840c..fb4c452 100644 --- a/compose.yml +++ b/compose.yml @@ -459,6 +459,54 @@ services: - ./environment/super-mario-maker.env - ./environment/super-mario-maker.local.env + splatoon-authentication: + build: ./repos/splatoon-authentication + depends_on: + - account + - mongodb + restart: unless-stopped + ports: + # Go delve debugger + - 127.0.0.1:2349:2349 + # Authentication server + - 61002:61002/udp + volumes: + - type: bind + source: ./logs/splatoon-authentication/ + target: /app/log/ + networks: + internal: + dns: 172.20.0.200 + env_file: + - ./environment/splatoon.env + - ./environment/splatoon.local.env + + splatoon-secure: + build: ./repos/splatoon-secure + depends_on: + - account + - mongodb + - splatoon-authentication + restart: unless-stopped + ports: + # Go delve debugger + - 127.0.0.1:2350:2350 + # Secure server + - 60003:60003/udp + volumes: + - type: bind + source: ./logs/splatoon-secure/ + target: /app/log/ + - type: bind + source: ./environment/splatoon-secure.conf + target: /app/secure.conf + networks: + internal: + dns: 172.20.0.200 + env_file: + - ./environment/splatoon.env + - ./environment/splatoon.local.env + volumes: mitmproxy-pretendo-data: mongodb-database: diff --git a/environment/splatoon-secure.conf b/environment/splatoon-secure.conf new file mode 100644 index 0000000..60a4bbf --- /dev/null +++ b/environment/splatoon-secure.conf @@ -0,0 +1,21 @@ +PrudpVersion=1 +SignatureVersion=1 +ServerPort=60003 +KerberosKeySize=32 +AccessKey=6f599f81 +ServerName=Pretendo Splatoon Secure +NexVersion=30500 +AccountDatabaseIP=account +AccountDatabasePort=5000 +NEXDatabaseIP=mongodb +NEXDatabasePort=27017 +DatabaseUseAuth=false +AccountDatabase=pretendo +PNIDCollection=pnids +NexAccountsCollection=nexaccounts +SplatoonDatabase=splatoon +RoomsCollection=rooms +SessionsCollection=sessions +UsersCollection=users +RegionsCollection=regions +TournamentsCollection=tourneys \ No newline at end of file diff --git a/environment/splatoon.env b/environment/splatoon.env new file mode 100644 index 0000000..37a25c5 --- /dev/null +++ b/environment/splatoon.env @@ -0,0 +1,2 @@ +PN_SPLATOON_AUTHENTICATION_SERVER_PORT=61002 +MONGO_URI=mongodb://mongodb:27017/pretendo_account?replicaSet=rs diff --git a/logs/splatoon-authentication/.gitkeep b/logs/splatoon-authentication/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/logs/splatoon-secure/.gitkeep b/logs/splatoon-secure/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/patches/splatoon-authentication/dockerize.patch b/patches/splatoon-authentication/dockerize.patch new file mode 100644 index 0000000..43f148d --- /dev/null +++ b/patches/splatoon-authentication/dockerize.patch @@ -0,0 +1,23 @@ +diff --git c/Dockerfile i/Dockerfile +new file mode 100644 +index 0000000..d2d087b +--- /dev/null ++++ i/Dockerfile +@@ -0,0 +1,17 @@ ++FROM golang:alpine AS builder ++WORKDIR /build ++ ++RUN go install github.com/go-delve/delve/cmd/dlv@latest ++ ++COPY go.* ./ ++RUN go mod download ++ ++COPY . ./ ++RUN go build -gcflags "all=-N -l" -v -o server ++ ++FROM alpine:latest AS runner ++WORKDIR /app ++ ++COPY --from=builder /build/server /app/server ++COPY --from=builder /go/bin/dlv /app/ ++CMD ["/app/dlv", "exec", "/app/server", "--listen=:2349", "--headless", "--api-version=2", "--log", "--accept-multiclient", "--continue"] diff --git a/patches/splatoon-secure/dockerize.patch b/patches/splatoon-secure/dockerize.patch new file mode 100644 index 0000000..7b3129f --- /dev/null +++ b/patches/splatoon-secure/dockerize.patch @@ -0,0 +1,23 @@ +diff --git c/Dockerfile i/Dockerfile +new file mode 100644 +index 0000000..d2d087b +--- /dev/null ++++ i/Dockerfile +@@ -0,0 +1,17 @@ ++FROM golang:alpine AS builder ++WORKDIR /build ++ ++RUN go install github.com/go-delve/delve/cmd/dlv@latest ++ ++COPY go.* ./ ++RUN go mod download ++ ++COPY . ./ ++RUN go build -gcflags "all=-N -l" -v -o server ++ ++FROM alpine:latest AS runner ++WORKDIR /app ++ ++COPY --from=builder /build/server /app/server ++COPY --from=builder /go/bin/dlv /app/ ++CMD ["/app/dlv", "exec", "/app/server", "--listen=:2350", "--headless", "--api-version=2", "--log", "--accept-multiclient", "--continue"] diff --git a/patches/splatoon-secure/fix-no-param3.patch b/patches/splatoon-secure/fix-no-param3.patch new file mode 100644 index 0000000..fd0e279 --- /dev/null +++ b/patches/splatoon-secure/fix-no-param3.patch @@ -0,0 +1,48 @@ +diff --git a/nex/matchmake-extension/auto_matchmake_with_param_postpone.go b/nex/matchmake-extension/auto_matchmake_with_param_postpone.go +index 7e1fff0..22b06d5 100644 +--- a/nex/matchmake-extension/auto_matchmake_with_param_postpone.go ++++ b/nex/matchmake-extension/auto_matchmake_with_param_postpone.go +@@ -69,7 +69,7 @@ func AutoMatchmakeWithParam_Postpone(err error, client *nex.Client, callID uint3 + oEvent.PIDSource = client.PID() + oEvent.Type = 122000 // Switch gathering + oEvent.Param1 = gid +- oEvent.Param3 = 1 ++ // oEvent.Param3 = 1 + + for _, pid := range database.GetRoomPlayers(sourceGid) { + if pid == 0 { +@@ -160,7 +160,7 @@ func AutoMatchmakeWithParam_Postpone(err error, client *nex.Client, callID uint3 + oEvent.Type = 3001 // New participant + oEvent.Param1 = gid + oEvent.Param2 = client.PID() +- oEvent.Param3 = uint32(participationCount) ++ // oEvent.Param3 = uint32(participationCount) + /* if matchmakeSession.GameMode == 12 { + oEvent.Param3 = 4 + } else { +diff --git a/nex/matchmake-extension/create_matchmake_session_with_param.go b/nex/matchmake-extension/create_matchmake_session_with_param.go +index c8b79cf..b113f56 100644 +--- a/nex/matchmake-extension/create_matchmake_session_with_param.go ++++ b/nex/matchmake-extension/create_matchmake_session_with_param.go +@@ -95,7 +95,7 @@ func CreateMatchmakeSessionWithParam(err error, client *nex.Client, callID uint3 + oEvent.Type = 3001 // New participant + oEvent.Param1 = gid + oEvent.Param2 = hostpid +- oEvent.Param3 = 1 ++ // oEvent.Param3 = 1 + + stream := nex.NewStreamOut(globals.NEXServer) + oEventBytes := oEvent.Bytes(stream) +diff --git a/nex/matchmake-extension/join_matchmake_session_with_param.go b/nex/matchmake-extension/join_matchmake_session_with_param.go +index 40b4d85..309385c 100644 +--- a/nex/matchmake-extension/join_matchmake_session_with_param.go ++++ b/nex/matchmake-extension/join_matchmake_session_with_param.go +@@ -138,7 +138,7 @@ func JoinMatchmakeSessionWithParam(err error, client *nex.Client, callID uint32, + oEvent.Type = 3001 // New participant + oEvent.Param1 = gid + oEvent.Param2 = client.PID() +- oEvent.Param3 = 1 ++ // oEvent.Param3 = 1 + + stream := nex.NewStreamOut(globals.NEXServer) + oEventBytes := oEvent.Bytes(stream) diff --git a/repos/BOSS b/repos/BOSS index 61f8611..16a762b 160000 --- a/repos/BOSS +++ b/repos/BOSS @@ -1 +1 @@ -Subproject commit 61f8611cf3430310e1b94a0b2aeae3480148348a +Subproject commit 16a762b97265de9c428e36667be6718e4e724c83 diff --git a/repos/Inkay b/repos/Inkay index 349b1f3..d62765b 160000 --- a/repos/Inkay +++ b/repos/Inkay @@ -1 +1 @@ -Subproject commit 349b1f38aa2f2ff173d7ebe9af95e919d1ddf50c +Subproject commit d62765bab97ac64cb96cbe240970dd5243da81eb diff --git a/repos/account b/repos/account index 0074645..0242fa7 160000 --- a/repos/account +++ b/repos/account @@ -1 +1 @@ -Subproject commit 007464596091affb61baf9dc9a5ba9c5038a5262 +Subproject commit 0242fa74506cc07228e643040f4a4cdaadd853b6 diff --git a/repos/friends b/repos/friends index ee46ec4..cc9b839 160000 --- a/repos/friends +++ b/repos/friends @@ -1 +1 @@ -Subproject commit ee46ec47e5d5549bb68f45c5e130b69409f0688b +Subproject commit cc9b839d45bf7b65203c9d74935ad927aa8e8b49 diff --git a/repos/juxtaposition-ui b/repos/juxtaposition-ui index 95fab2b..e373686 160000 --- a/repos/juxtaposition-ui +++ b/repos/juxtaposition-ui @@ -1 +1 @@ -Subproject commit 95fab2bae9f7e810724ea1bfee47dd0314d351c6 +Subproject commit e3736862caf91ee0e100c56e58f3f56ab738701f diff --git a/repos/mitmproxy-pretendo b/repos/mitmproxy-pretendo index b7b6e19..43cbe68 160000 --- a/repos/mitmproxy-pretendo +++ b/repos/mitmproxy-pretendo @@ -1 +1 @@ -Subproject commit b7b6e1987902ed2434e02c3c0ed870f2ad0e93ee +Subproject commit 43cbe685873e7a5fbee5c313c8e74bba5ad81870 diff --git a/repos/splatoon-authentication b/repos/splatoon-authentication new file mode 160000 index 0000000..189bc9e --- /dev/null +++ b/repos/splatoon-authentication @@ -0,0 +1 @@ +Subproject commit 189bc9e6c7ee1dd38abc5459c940a34a125ec1c2 diff --git a/repos/splatoon-secure b/repos/splatoon-secure new file mode 160000 index 0000000..2f3ca91 --- /dev/null +++ b/repos/splatoon-secure @@ -0,0 +1 @@ +Subproject commit 2f3ca91e7772404e4c87f46011da7f8b92fc4110 diff --git a/repos/website b/repos/website index 139a18d..9bb9f6a 160000 --- a/repos/website +++ b/repos/website @@ -1 +1 @@ -Subproject commit 139a18ddd1890f18db977a2912ea42b8b7f71c25 +Subproject commit 9bb9f6a4f0579d02a62fd5c3777093f367a4107d diff --git a/scripts/run-in-container/update-account-servers-database.js b/scripts/run-in-container/update-account-servers-database.js index 4504d5f..c9bfe8c 100644 --- a/scripts/run-in-container/update-account-servers-database.js +++ b/scripts/run-in-container/update-account-servers-database.js @@ -83,6 +83,15 @@ async function runAsync() { 1, "0".repeat(64) ); + await createNexServer( + "Splatoon", + "10176900", + ["00050000-10176A00", "00050000-10176900", "00050000-10162B00"], + process.env.SERVER_IP, + process.env.SPLATOON_PORT, + 1, + "0".repeat(64) + ); await mongoose.connection.close(); } diff --git a/scripts/setup-environment.sh b/scripts/setup-environment.sh index 9f48fe2..0a27445 100755 --- a/scripts/setup-environment.sh +++ b/scripts/setup-environment.sh @@ -130,6 +130,7 @@ echo "SERVER_IP=$server_ip" >>"$git_base_dir/.env" echo "PN_FRIENDS_SECURE_SERVER_HOST=$server_ip" >>./friends.local.env echo "PN_WIIU_CHAT_SECURE_SERVER_LOCATION=$server_ip" >>./wiiu-chat.local.env echo "PN_SMM_SECURE_SERVER_HOST=$server_ip" >>./super-mario-maker.local.env +echo "PN_SPLATOON_AUTHENTICATION_SERVER_HOST=$server_ip" >>./splatoon.local.env # Get the Wii U IP address if [[ -n "$wiiu_ip" ]]; then diff --git a/setup.sh b/setup.sh index 58a9fcf..87fd481 100755 --- a/setup.sh +++ b/setup.sh @@ -120,4 +120,4 @@ print_stage "Setting up containers with first-run scripts." setup_containers print_title "Pretendo Network server setup script finished" -print_success "Setup completed! You can now start your Pretendo Network server with \"docker compose up -d --build\"." +print_success "Setup completed! You can now start your Pretendo Network server with \"docker compose up -d --build\"." \ No newline at end of file