From a25269c51e860a70fc96d1414319b7043f8b9220 Mon Sep 17 00:00:00 2001 From: Daniel Henkel <9447057+dhenkel92@users.noreply.github.com> Date: Mon, 6 May 2024 19:53:58 +0200 Subject: [PATCH] feature: create new game-server-watcher (#118) --- .github/workflows/game-server-watcher.yml | 40 ++++ .pre-commit-config.yaml | 16 +- async-server-provisioner/config/default.yml | 2 +- backend/.strapi-updater.json | 2 +- backend/src/index.js | 26 +++ bin/execute-go.sh | 13 ++ .../.dockerignore | 0 game-server-watcher-old/.gitignore | 90 +++++++++ .../.idea/.gitignore | 0 .../.idea/game-server-watcher.iml | 0 .../.idea/modules.xml | 0 .../.idea/vcs.xml | 0 .../Cargo.lock | 0 .../Cargo.toml | 0 game-server-watcher-old/Dockerfile | 19 ++ .../example-config.yaml | 0 .../src/main.rs | 0 .../src/net/is_port_reachable.rs | 0 .../src/net/mod.rs | 0 .../src/routes/mod.rs | 0 .../src/routes/types.rs | 0 .../src/routes/watcher_details.rs | 0 .../src/routes/watchers.rs | 0 .../src/watcher_config.rs | 0 game-server-watcher/.gitignore | 90 +-------- game-server-watcher/Dockerfile | 19 +- .../cmd/game-server-watcher/main.go | 56 ++++++ .../cmd/game-server-watcher/options.go | 1 + game-server-watcher/go.mod | 49 +++++ game-server-watcher/go.sum | 172 ++++++++++++++++++ game-server-watcher/pkg/cmd/server/server.go | 54 ++++++ .../templates/game-server-watcher.service | 5 +- 32 files changed, 540 insertions(+), 114 deletions(-) create mode 100644 .github/workflows/game-server-watcher.yml create mode 100755 bin/execute-go.sh rename {game-server-watcher => game-server-watcher-old}/.dockerignore (100%) create mode 100644 game-server-watcher-old/.gitignore rename {game-server-watcher => game-server-watcher-old}/.idea/.gitignore (100%) rename {game-server-watcher => game-server-watcher-old}/.idea/game-server-watcher.iml (100%) rename {game-server-watcher => game-server-watcher-old}/.idea/modules.xml (100%) rename {game-server-watcher => game-server-watcher-old}/.idea/vcs.xml (100%) rename {game-server-watcher => game-server-watcher-old}/Cargo.lock (100%) rename {game-server-watcher => game-server-watcher-old}/Cargo.toml (100%) create mode 100644 game-server-watcher-old/Dockerfile rename {game-server-watcher => game-server-watcher-old}/example-config.yaml (100%) rename {game-server-watcher => game-server-watcher-old}/src/main.rs (100%) rename {game-server-watcher => game-server-watcher-old}/src/net/is_port_reachable.rs (100%) rename {game-server-watcher => game-server-watcher-old}/src/net/mod.rs (100%) rename {game-server-watcher => game-server-watcher-old}/src/routes/mod.rs (100%) rename {game-server-watcher => game-server-watcher-old}/src/routes/types.rs (100%) rename {game-server-watcher => game-server-watcher-old}/src/routes/watcher_details.rs (100%) rename {game-server-watcher => game-server-watcher-old}/src/routes/watchers.rs (100%) rename {game-server-watcher => game-server-watcher-old}/src/watcher_config.rs (100%) create mode 100644 game-server-watcher/cmd/game-server-watcher/main.go create mode 100644 game-server-watcher/cmd/game-server-watcher/options.go create mode 100644 game-server-watcher/go.mod create mode 100644 game-server-watcher/go.sum create mode 100644 game-server-watcher/pkg/cmd/server/server.go diff --git a/.github/workflows/game-server-watcher.yml b/.github/workflows/game-server-watcher.yml new file mode 100644 index 0000000..9882bd0 --- /dev/null +++ b/.github/workflows/game-server-watcher.yml @@ -0,0 +1,40 @@ +on: + push: + branches: + - main + paths: + - ".github/workflows/game-server-watcher.yml" + - "game-server-watcher/**/*" + +name: Cloud Game Server Watcher + +jobs: + build: + name: Build Game Server Watcher + runs-on: ubuntu-latest + env: + IMAGE: cloudgame/game-server-watcher + steps: + - uses: actions/checkout@master + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: "1.22" + - name: Go vet + run: | + cd game-server-watcher + go vet ./... + - name: Build Docker Container + run: | + cd game-server-watcher + docker build -t $IMAGE:$GITHUB_RUN_ID -f Dockerfile --build-arg DD_GIT_REPOSITORY_URL=$(git config --get remote.origin.url) --build-arg DD_GIT_COMMIT_SHA=${{ github.sha }} . + - name: Push Container + run: | + docker tag $IMAGE:$GITHUB_RUN_ID $IMAGE:latest + docker push $IMAGE:$GITHUB_RUN_ID + docker push $IMAGE:latest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 14124d5..0ded3db 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -53,17 +53,17 @@ repos: ######################################### - repo: local hooks: - - id: cargo:fmt - name: Cargo fmt + - id: go:fmt + name: Go fmt language: script pass_filenames: false files: ^game-server-watcher/ - entry: ./bin/execute-cargo.sh - args: ["game-server-watcher", "fmt", "--all", "--", "--check"] - - id: cargo:clippy - name: Cargo clippy + entry: ./bin/execute-go.sh + args: ["game-server-watcher", "fmt", "./..."] + - id: go:vet + name: Go Vet language: script pass_filenames: false files: ^game-server-watcher/ - entry: ./bin/execute-cargo.sh - args: ["game-server-watcher", "clippy", "--features", "strict"] + entry: ./bin/execute-go.sh + args: ["game-server-watcher", "vet", "./..."] diff --git a/async-server-provisioner/config/default.yml b/async-server-provisioner/config/default.yml index 55c473f..e4bbdee 100644 --- a/async-server-provisioner/config/default.yml +++ b/async-server-provisioner/config/default.yml @@ -20,7 +20,7 @@ datadog: api_key: placeholder cloudGame: - ansibleBranch: use-latest-backup + ansibleBranch: main apiUrl: http://host.docker.internal:1337 apiToken: placeholder backupS3Bucket: cloud-game-dev diff --git a/backend/.strapi-updater.json b/backend/.strapi-updater.json index 690584a..bf57ded 100644 --- a/backend/.strapi-updater.json +++ b/backend/.strapi-updater.json @@ -1,5 +1,5 @@ { "latest": "4.24.1", - "lastUpdateCheck": 1714910701412, + "lastUpdateCheck": 1715013457662, "lastNotification": 1714740179673 } diff --git a/backend/src/index.js b/backend/src/index.js index 6744093..b1ace71 100644 --- a/backend/src/index.js +++ b/backend/src/index.js @@ -11,6 +11,32 @@ module.exports = { * This gives you an opportunity to extend code. */ register(/*{ strapi }*/) { + const extension = ({ nexus }) => ({ + typeDefs: ` + type GameServerPort { + port: Int! + protocol: String! + is_open: Boolean! + } + extend type GameDeployment { + game_server_ports: [GameServerPort!] + } + `, + resolvers: { + GameDeployment: { + game_server_ports: { + resolve: async (parent, args, context) => { + console.log(parent.id); + const data = await fetch("http://localhost:8080/ports"); + return data.json(); + }, + }, + }, + }, + // plugins: [nexus.plugin({})], + }); + + strapi.plugin("graphql").service("extension").use(extension); // const extensionService = strapi.plugin('graphql').service('extension'); // extensionService.use({ // resolversConfig: { diff --git a/bin/execute-go.sh b/bin/execute-go.sh new file mode 100755 index 0000000..cf9cc4f --- /dev/null +++ b/bin/execute-go.sh @@ -0,0 +1,13 @@ +#! /bin/bash + +set -e + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +project=$1 + +if [ "$#" -lt 2 ]; then + exit 1 +fi + +cd $DIR/../$1 +go ${*:2} diff --git a/game-server-watcher/.dockerignore b/game-server-watcher-old/.dockerignore similarity index 100% rename from game-server-watcher/.dockerignore rename to game-server-watcher-old/.dockerignore diff --git a/game-server-watcher-old/.gitignore b/game-server-watcher-old/.gitignore new file mode 100644 index 0000000..8d5ea28 --- /dev/null +++ b/game-server-watcher-old/.gitignore @@ -0,0 +1,90 @@ +### Rust template +# Generated by Cargo +# will have compiled files and executables +debug/ +target/ + +# These are backup files generated by rustfmt +**/*.rs.bk + +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Rust template +# Generated by Cargo +# will have compiled files and executables +debug/ +target/ + +# These are backup files generated by rustfmt +**/*.rs.bk diff --git a/game-server-watcher/.idea/.gitignore b/game-server-watcher-old/.idea/.gitignore similarity index 100% rename from game-server-watcher/.idea/.gitignore rename to game-server-watcher-old/.idea/.gitignore diff --git a/game-server-watcher/.idea/game-server-watcher.iml b/game-server-watcher-old/.idea/game-server-watcher.iml similarity index 100% rename from game-server-watcher/.idea/game-server-watcher.iml rename to game-server-watcher-old/.idea/game-server-watcher.iml diff --git a/game-server-watcher/.idea/modules.xml b/game-server-watcher-old/.idea/modules.xml similarity index 100% rename from game-server-watcher/.idea/modules.xml rename to game-server-watcher-old/.idea/modules.xml diff --git a/game-server-watcher/.idea/vcs.xml b/game-server-watcher-old/.idea/vcs.xml similarity index 100% rename from game-server-watcher/.idea/vcs.xml rename to game-server-watcher-old/.idea/vcs.xml diff --git a/game-server-watcher/Cargo.lock b/game-server-watcher-old/Cargo.lock similarity index 100% rename from game-server-watcher/Cargo.lock rename to game-server-watcher-old/Cargo.lock diff --git a/game-server-watcher/Cargo.toml b/game-server-watcher-old/Cargo.toml similarity index 100% rename from game-server-watcher/Cargo.toml rename to game-server-watcher-old/Cargo.toml diff --git a/game-server-watcher-old/Dockerfile b/game-server-watcher-old/Dockerfile new file mode 100644 index 0000000..e507904 --- /dev/null +++ b/game-server-watcher-old/Dockerfile @@ -0,0 +1,19 @@ +ARG BUILD_BASE=1.56.1-alpine3.14 +ARG BASE=3.14 + +FROM rust:${BUILD_BASE} as build + +WORKDIR /root + +RUN apk add --no-cache musl-dev + +COPY . . + +ENV CARGO_HTTP_MULTIPLEXING=false +RUN cargo build --release --features "strict" + +FROM alpine:${BASE} + +COPY --from=build /root/target/release/game-server-watcher /usr/bin/game-server-watcher + +ENTRYPOINT ["/usr/bin/game-server-watcher"] diff --git a/game-server-watcher/example-config.yaml b/game-server-watcher-old/example-config.yaml similarity index 100% rename from game-server-watcher/example-config.yaml rename to game-server-watcher-old/example-config.yaml diff --git a/game-server-watcher/src/main.rs b/game-server-watcher-old/src/main.rs similarity index 100% rename from game-server-watcher/src/main.rs rename to game-server-watcher-old/src/main.rs diff --git a/game-server-watcher/src/net/is_port_reachable.rs b/game-server-watcher-old/src/net/is_port_reachable.rs similarity index 100% rename from game-server-watcher/src/net/is_port_reachable.rs rename to game-server-watcher-old/src/net/is_port_reachable.rs diff --git a/game-server-watcher/src/net/mod.rs b/game-server-watcher-old/src/net/mod.rs similarity index 100% rename from game-server-watcher/src/net/mod.rs rename to game-server-watcher-old/src/net/mod.rs diff --git a/game-server-watcher/src/routes/mod.rs b/game-server-watcher-old/src/routes/mod.rs similarity index 100% rename from game-server-watcher/src/routes/mod.rs rename to game-server-watcher-old/src/routes/mod.rs diff --git a/game-server-watcher/src/routes/types.rs b/game-server-watcher-old/src/routes/types.rs similarity index 100% rename from game-server-watcher/src/routes/types.rs rename to game-server-watcher-old/src/routes/types.rs diff --git a/game-server-watcher/src/routes/watcher_details.rs b/game-server-watcher-old/src/routes/watcher_details.rs similarity index 100% rename from game-server-watcher/src/routes/watcher_details.rs rename to game-server-watcher-old/src/routes/watcher_details.rs diff --git a/game-server-watcher/src/routes/watchers.rs b/game-server-watcher-old/src/routes/watchers.rs similarity index 100% rename from game-server-watcher/src/routes/watchers.rs rename to game-server-watcher-old/src/routes/watchers.rs diff --git a/game-server-watcher/src/watcher_config.rs b/game-server-watcher-old/src/watcher_config.rs similarity index 100% rename from game-server-watcher/src/watcher_config.rs rename to game-server-watcher-old/src/watcher_config.rs diff --git a/game-server-watcher/.gitignore b/game-server-watcher/.gitignore index 8d5ea28..cde0123 100644 --- a/game-server-watcher/.gitignore +++ b/game-server-watcher/.gitignore @@ -1,90 +1,2 @@ -### Rust template -# Generated by Cargo -# will have compiled files and executables -debug/ -target/ -# These are backup files generated by rustfmt -**/*.rs.bk - -### JetBrains template -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf - -# Generated files -.idea/**/contentModel.xml - -# Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml - -# Gradle -.idea/**/gradle.xml -.idea/**/libraries - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/artifacts -# .idea/compiler.xml -# .idea/jarRepositories.xml -# .idea/modules.xml -# .idea/*.iml -# .idea/modules -# *.iml -# *.ipr - -# CMake -cmake-build-*/ - -# Mongo Explorer plugin -.idea/**/mongoSettings.xml - -# File-based project format -*.iws - -# IntelliJ -out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Cursive Clojure plugin -.idea/replstate.xml - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties - -# Editor-based Rest Client -.idea/httpRequests - -# Android studio 3.1+ serialized cache file -.idea/caches/build_file_checksums.ser - -### Rust template -# Generated by Cargo -# will have compiled files and executables -debug/ -target/ - -# These are backup files generated by rustfmt -**/*.rs.bk +dist/ diff --git a/game-server-watcher/Dockerfile b/game-server-watcher/Dockerfile index e507904..2ba4c78 100644 --- a/game-server-watcher/Dockerfile +++ b/game-server-watcher/Dockerfile @@ -1,19 +1,14 @@ -ARG BUILD_BASE=1.56.1-alpine3.14 -ARG BASE=3.14 +FROM golang:1.22-alpine3.19 as build -FROM rust:${BUILD_BASE} as build - -WORKDIR /root - -RUN apk add --no-cache musl-dev +ENV workdir=/usr/app +WORKDIR /usr/app COPY . . -ENV CARGO_HTTP_MULTIPLEXING=false -RUN cargo build --release --features "strict" +RUN CGO_ENABLED=0 go build -o ./game-server-watcher ./cmd/game-server-watcher/* -FROM alpine:${BASE} +FROM alpine:3.19 -COPY --from=build /root/target/release/game-server-watcher /usr/bin/game-server-watcher +COPY --from=build /usr/app/game-server-watcher /usr/bin/game-server-watcher -ENTRYPOINT ["/usr/bin/game-server-watcher"] +ENTRYPOINT ["game-server-watcher"] diff --git a/game-server-watcher/cmd/game-server-watcher/main.go b/game-server-watcher/cmd/game-server-watcher/main.go new file mode 100644 index 0000000..4cb4779 --- /dev/null +++ b/game-server-watcher/cmd/game-server-watcher/main.go @@ -0,0 +1,56 @@ +package main + +import ( + "fmt" + "game-server-watcher/pkg/cmd/server" + "log" + + "github.com/spf13/cobra" + "go.uber.org/zap" + "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "gopkg.in/DataDog/dd-trace-go.v1/profiler" +) + +func main() { + tracer.Start( + tracer.WithService("game-server-watcher"), + tracer.WithEnv("env"), + ) + defer tracer.Stop() + + err := profiler.Start( + profiler.WithService("game-server-watcher"), + profiler.WithEnv("env"), + profiler.WithProfileTypes( + profiler.CPUProfile, + profiler.HeapProfile, + + // The profiles below are disabled by + // default to keep overhead low, but + // can be enabled as needed. + // profiler.BlockProfile, + // profiler.MutexProfile, + // profiler.GoroutineProfile, + ), + ) + if err != nil { + log.Fatal(err) + } + defer profiler.Stop() + + logger, _ := zap.NewProduction() + defer logger.Sync() + + rootCmd := cobra.Command{ + Use: "game-server-watcher", + RunE: func(cmd *cobra.Command, args []string) error { + return fmt.Errorf("No command selected") + }, + } + + rootCmd.AddCommand(server.Commands(logger)...) + + if err := rootCmd.Execute(); err != nil { + logger.Error("Command not found", zap.Error(err)) + } +} diff --git a/game-server-watcher/cmd/game-server-watcher/options.go b/game-server-watcher/cmd/game-server-watcher/options.go new file mode 100644 index 0000000..06ab7d0 --- /dev/null +++ b/game-server-watcher/cmd/game-server-watcher/options.go @@ -0,0 +1 @@ +package main diff --git a/game-server-watcher/go.mod b/game-server-watcher/go.mod new file mode 100644 index 0000000..1c2e65c --- /dev/null +++ b/game-server-watcher/go.mod @@ -0,0 +1,49 @@ +module game-server-watcher + +go 1.22 + +require ( + github.com/spf13/cobra v1.8.0 + go.uber.org/zap v1.27.0 + gopkg.in/DataDog/dd-trace-go.v1 v1.63.1 +) + +require ( + github.com/DataDog/appsec-internal-go v1.5.0 // indirect + github.com/DataDog/datadog-agent/pkg/obfuscate v0.48.0 // indirect + github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.48.1 // indirect + github.com/DataDog/datadog-go/v5 v5.3.0 // indirect + github.com/DataDog/go-libddwaf/v2 v2.4.2 // indirect + github.com/DataDog/go-tuf v1.0.2-0.5.2 // indirect + github.com/DataDog/gostackparse v0.7.0 // indirect + github.com/DataDog/sketches-go v1.4.2 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/dustin/go-humanize v1.0.1 // indirect + github.com/ebitengine/purego v0.6.0-alpha.5 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b // indirect + github.com/google/uuid v1.5.0 // indirect + github.com/gorilla/mux v1.8.1 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/outcaste-io/ristretto v0.2.3 // indirect + github.com/philhofer/fwd v1.1.2 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/richardartoul/molecule v1.0.1-0.20221107223329-32cfee06a052 // indirect + github.com/secure-systems-lab/go-securesystemslib v0.7.0 // indirect + github.com/spaolacci/murmur3 v1.1.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/stretchr/testify v1.9.0 // indirect + github.com/tinylib/msgp v1.1.9 // indirect + go.uber.org/atomic v1.11.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + golang.org/x/crypto v0.22.0 // indirect + golang.org/x/mod v0.13.0 // indirect + golang.org/x/sys v0.20.0 // indirect + golang.org/x/time v0.3.0 // indirect + golang.org/x/tools v0.14.0 // indirect + golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect + google.golang.org/protobuf v1.34.0 // indirect +) diff --git a/game-server-watcher/go.sum b/game-server-watcher/go.sum new file mode 100644 index 0000000..e2d8084 --- /dev/null +++ b/game-server-watcher/go.sum @@ -0,0 +1,172 @@ +github.com/DataDog/appsec-internal-go v1.5.0 h1:8kS5zSx5T49uZ8dZTdT19QVAvC/B8ByyZdhQKYQWHno= +github.com/DataDog/appsec-internal-go v1.5.0/go.mod h1:pEp8gjfNLtEOmz+iZqC8bXhu0h4k7NUsW/qiQb34k1U= +github.com/DataDog/datadog-agent/pkg/obfuscate v0.48.0 h1:bUMSNsw1iofWiju9yc1f+kBd33E3hMJtq9GuU602Iy8= +github.com/DataDog/datadog-agent/pkg/obfuscate v0.48.0/go.mod h1:HzySONXnAgSmIQfL6gOv9hWprKJkx8CicuXuUbmgWfo= +github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.48.1 h1:5nE6N3JSs2IG3xzMthNFhXfOaXlrsdgqmJ73lndFf8c= +github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.48.1/go.mod h1:Vc+snp0Bey4MrrJyiV2tVxxJb6BmLomPvN1RgAvjGaQ= +github.com/DataDog/datadog-go/v5 v5.3.0 h1:2q2qjFOb3RwAZNU+ez27ZVDwErJv5/VpbBPprz7Z+s8= +github.com/DataDog/datadog-go/v5 v5.3.0/go.mod h1:XRDJk1pTc00gm+ZDiBKsjh7oOOtJfYfglVCmFb8C2+Q= +github.com/DataDog/go-libddwaf/v2 v2.4.2 h1:ilquGKUmN9/Ty0sIxiEyznVRxP3hKfmH15Y1SMq5gjA= +github.com/DataDog/go-libddwaf/v2 v2.4.2/go.mod h1:gsCdoijYQfj8ce/T2bEDNPZFIYnmHluAgVDpuQOWMZE= +github.com/DataDog/go-tuf v1.0.2-0.5.2 h1:EeZr937eKAWPxJ26IykAdWA4A0jQXJgkhUjqEI/w7+I= +github.com/DataDog/go-tuf v1.0.2-0.5.2/go.mod h1:zBcq6f654iVqmkk8n2Cx81E1JnNTMOAx1UEO/wZR+P0= +github.com/DataDog/gostackparse v0.7.0 h1:i7dLkXHvYzHV308hnkvVGDL3BR4FWl7IsXNPz/IGQh4= +github.com/DataDog/gostackparse v0.7.0/go.mod h1:lTfqcJKqS9KnXQGnyQMCugq3u1FP6UZMfWR0aitKFMM= +github.com/DataDog/sketches-go v1.4.2 h1:gppNudE9d19cQ98RYABOetxIhpTCl4m7CnbRZjvVA/o= +github.com/DataDog/sketches-go v1.4.2/go.mod h1:xJIXldczJyyjnbDop7ZZcLxJdV3+7Kra7H1KMgpgkLk= +github.com/Microsoft/go-winio v0.5.0/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +github.com/ebitengine/purego v0.6.0-alpha.5 h1:EYID3JOAdmQ4SNZYJHu9V6IqOeRQDBYxqKAg9PyoHFY= +github.com/ebitengine/purego v0.6.0-alpha.5/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b h1:h9U78+dx9a4BKdQkBBos92HalKpaGKHrp+3Uo6yTodo= +github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= +github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= +github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= +github.com/outcaste-io/ristretto v0.2.3 h1:AK4zt/fJ76kjlYObOeNwh4T3asEuaCmp26pOvUOL9w0= +github.com/outcaste-io/ristretto v0.2.3/go.mod h1:W8HywhmtlopSB1jeMg3JtdIhf+DYkLAr0VN/s4+MHac= +github.com/philhofer/fwd v1.1.2 h1:bnDivRJ1EWPjUIRXV5KfORO897HTbpFAQddBdE8t7Gw= +github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2tUTP0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/richardartoul/molecule v1.0.1-0.20221107223329-32cfee06a052 h1:Qp27Idfgi6ACvFQat5+VJvlYToylpM/hcyLBI3WaKPA= +github.com/richardartoul/molecule v1.0.1-0.20221107223329-32cfee06a052/go.mod h1:uvX/8buq8uVeiZiFht+0lqSLBHF+uGV8BrTv8W/SIwk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/secure-systems-lab/go-securesystemslib v0.7.0 h1:OwvJ5jQf9LnIAS83waAjPbcMsODrTQUpJ02eNLUoxBg= +github.com/secure-systems-lab/go-securesystemslib v0.7.0/go.mod h1:/2gYnlnHVQ6xeGtfIqFy7Do03K4cdCY0A/GlJLDKLHI= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/tinylib/msgp v1.1.9 h1:SHf3yoO2sGA0veCJeCBYLHuttAVFHGm2RHgNodW7wQU= +github.com/tinylib/msgp v1.1.9/go.mod h1:BCXGB54lDD8qUEPmiG0cQQUANC4IUQyB2ItS2UDlO/k= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= +go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= +golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= +golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +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-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= +golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +google.golang.org/grpc v1.57.1 h1:upNTNqv0ES+2ZOOqACwVtS3Il8M12/+Hz41RCPzAjQg= +google.golang.org/grpc v1.57.1/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.34.0 h1:Qo/qEd2RZPCf2nKuorzksSknv0d3ERwp1vFG38gSmH4= +google.golang.org/protobuf v1.34.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/DataDog/dd-trace-go.v1 v1.63.1 h1:POnTNQLAJHnuywfk48N+l/EiwQJ6Kdaa7nwV5dbfdUY= +gopkg.in/DataDog/dd-trace-go.v1 v1.63.1/go.mod h1:pv2V0h4+skvObjdi3pWV4k6JHsdQk+flbjdC25mmTfU= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= +honnef.co/go/gotraceui v0.2.0 h1:dmNsfQ9Vl3GwbiVD7Z8d/osC6WtGGrasyrC2suc4ZIQ= +honnef.co/go/gotraceui v0.2.0/go.mod h1:qHo4/W75cA3bX0QQoSvDjbJa4R8mAyyFjbWAj63XElc= diff --git a/game-server-watcher/pkg/cmd/server/server.go b/game-server-watcher/pkg/cmd/server/server.go new file mode 100644 index 0000000..506e3b4 --- /dev/null +++ b/game-server-watcher/pkg/cmd/server/server.go @@ -0,0 +1,54 @@ +package server + +import ( + "encoding/json" + "fmt" + "net/http" + + "github.com/spf13/cobra" + "go.uber.org/zap" + muxtrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/gorilla/mux" +) + +type ServerOpts struct { + port int +} + +func Commands(logger *zap.Logger) []*cobra.Command { + var serverOpts ServerOpts + serverCmd := &cobra.Command{ + Use: "server", + Short: "Starting http server", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + return runServer(logger, serverOpts) + }, + } + serverCmd.Flags().IntVar(&serverOpts.port, "port", 8080, "Port used to do stuff") + + return []*cobra.Command{serverCmd} +} + +type Port struct { + Port int `json:"port"` + Protocol string `json:"protocol"` + IsOpen bool `json:"is_open"` +} + +func runServer(logger *zap.Logger, opts ServerOpts) error { + mux := muxtrace.NewRouter() + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + logger.Info("Accessed endpoint") + w.Write([]byte("Hello World!")) + }) + + mux.HandleFunc("/ports", func(w http.ResponseWriter, r *http.Request) { + ports := []Port{{Port: 8080, IsOpen: false, Protocol: "TCP"}} + data, _ := json.Marshal(ports) + w.Header().Add("Content-Type", "application/json") + w.Write(data) + }) + + logger.Info("Starting server") + return http.ListenAndServe(fmt.Sprintf(":%d", opts.port), mux) +} diff --git a/infrastructure/ansible/roles/game-server-start/templates/game-server-watcher.service b/infrastructure/ansible/roles/game-server-start/templates/game-server-watcher.service index 652e678..20d8640 100644 --- a/infrastructure/ansible/roles/game-server-start/templates/game-server-watcher.service +++ b/infrastructure/ansible/roles/game-server-start/templates/game-server-watcher.service @@ -11,9 +11,8 @@ ExecStart=/usr/bin/docker run -i --name gs-watcher \ --net host \ -v /opt:/opt:ro \ {{ watcher.docker_image }} \ - --address 0.0.0.0 \ - --port {{ watcher.port }} \ - --config-path /opt/watcher-config.yml + server \ + --port {{ watcher.port }} TimeoutStopSec=300 [Install]