Compare commits
49 Commits
Author | SHA1 | Date | |
---|---|---|---|
6048d9f1c2 | |||
ad937f7202 | |||
|
27c2b2b75b | ||
|
89f29244ac | ||
|
479f6fcbf3 | ||
|
d48736c12a | ||
|
f2dd8d5c38 | ||
|
f9e6352940 | ||
|
d43455a1d9 | ||
|
bb66931250 | ||
|
bb8d5bbe9e | ||
|
97343093b1 | ||
|
6558dc6045 | ||
|
38d532a49c | ||
|
b86c443616 | ||
|
c32a1cfca7 | ||
|
7e5d2f4de9 | ||
|
4b0bc8156d | ||
|
b7fc19c6fc | ||
|
a46e30f9b3 | ||
|
6a3a2a366f | ||
|
604e605f94 | ||
|
ab576a7e36 | ||
|
658c6d5a3b | ||
|
80e65028bb | ||
|
d3b964c845 | ||
|
9ac42b065f | ||
|
a08c7c5305 | ||
|
1f87fb1e41 | ||
|
01bcd300d7 | ||
|
2232fbf305 | ||
|
d1f5e413c5 | ||
|
f4874ee104 | ||
|
600be596ee | ||
|
d481c5456e | ||
|
e56c2e31fb | ||
|
8dd01ecb4d | ||
|
4cf4ecf591 | ||
|
251612a2b8 | ||
|
cdc53004fd | ||
|
c9a77058b4 | ||
|
66a5138056 | ||
|
d31f17c8c1 | ||
|
16f2e165ac | ||
|
794f3799ca | ||
|
1361cd502b | ||
|
b038ebf661 | ||
|
9f68a0ed4b | ||
|
d4fad5d966 |
93
.github/workflows/build.yml
vendored
93
.github/workflows/build.yml
vendored
@ -3,10 +3,12 @@ name: Build
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "*"
|
- "**"
|
||||||
|
tags:
|
||||||
|
- '[0-9]+.[0-9]+.[0-9]+'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- "*"
|
- "**"
|
||||||
types: [opened, synchronize, reopened]
|
types: [opened, synchronize, reopened]
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
@ -58,7 +60,11 @@ jobs:
|
|||||||
uses: ammaraskar/msvc-problem-matcher@master
|
uses: ammaraskar/msvc-problem-matcher@master
|
||||||
|
|
||||||
- name: Build ${{matrix.arch}} ${{matrix.configuration}} binaries
|
- name: Build ${{matrix.arch}} ${{matrix.configuration}} binaries
|
||||||
|
<<<<<<< HEAD
|
||||||
run: msbuild /m /v:minimal /p:Configuration=${{matrix.configuration}} /p:Platform=${{matrix.platform}} build/master-server.sln
|
run: msbuild /m /v:minimal /p:Configuration=${{matrix.configuration}} /p:Platform=${{matrix.platform}} build/master-server.sln
|
||||||
|
=======
|
||||||
|
run: msbuild /m /v:minimal /p:Configuration=${{matrix.configuration}} /p:Platform=${{matrix.platform}} build/alterware-master.sln
|
||||||
|
>>>>>>> 27c2b2b75b56e54dcfbec690dd086946a45587d7
|
||||||
|
|
||||||
- name: Upload ${{matrix.arch}} ${{matrix.configuration}} binaries
|
- name: Upload ${{matrix.arch}} ${{matrix.configuration}} binaries
|
||||||
uses: actions/upload-artifact@main
|
uses: actions/upload-artifact@main
|
||||||
@ -162,17 +168,28 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: macos-${{matrix.arch}}-${{matrix.configuration}}
|
name: macos-${{matrix.arch}}-${{matrix.configuration}}
|
||||||
path: |
|
path: |
|
||||||
|
<<<<<<< HEAD
|
||||||
build/bin/${{matrix.arch}}/${{matrix.configuration}}/master-server
|
build/bin/${{matrix.arch}}/${{matrix.configuration}}/master-server
|
||||||
|
=======
|
||||||
|
build/bin/${{matrix.arch}}/${{matrix.configuration}}/alterware-master
|
||||||
|
>>>>>>> 27c2b2b75b56e54dcfbec690dd086946a45587d7
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
name: Deploy artifacts
|
name: Deploy artifacts
|
||||||
needs: [build-win, build-linux, build-macos]
|
needs: [build-win, build-linux, build-macos]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
<<<<<<< HEAD
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||||
steps:
|
steps:
|
||||||
- name: Setup main environment
|
- name: Setup main environment
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
run: echo "MASTER_SERVER_PATH=${{ secrets.MASTER_SERVER_SSH_PATH }}" >> $GITHUB_ENV
|
run: echo "MASTER_SERVER_PATH=${{ secrets.MASTER_SERVER_SSH_PATH }}" >> $GITHUB_ENV
|
||||||
|
=======
|
||||||
|
if: github.ref_type == 'tag'
|
||||||
|
steps:
|
||||||
|
- name: Setup main environment
|
||||||
|
run: echo "ALTERWARE_MASTER_SERVER_PATH=${{ secrets.ALTERWARE_MASTER_SERVER_SSH_PATH }}" >> $GITHUB_ENV
|
||||||
|
>>>>>>> 27c2b2b75b56e54dcfbec690dd086946a45587d7
|
||||||
|
|
||||||
- name: Download Release binaries
|
- name: Download Release binaries
|
||||||
uses: actions/download-artifact@main
|
uses: actions/download-artifact@main
|
||||||
@ -182,6 +199,7 @@ jobs:
|
|||||||
- name: Install SSH key
|
- name: Install SSH key
|
||||||
uses: shimataro/ssh-key-action@v2.7.0
|
uses: shimataro/ssh-key-action@v2.7.0
|
||||||
with:
|
with:
|
||||||
|
<<<<<<< HEAD
|
||||||
key: ${{ secrets.MASTER_SERVER_SSH_PRIVATE_KEY }}
|
key: ${{ secrets.MASTER_SERVER_SSH_PRIVATE_KEY }}
|
||||||
known_hosts: 'just-a-placeholder-so-we-dont-get-errors'
|
known_hosts: 'just-a-placeholder-so-we-dont-get-errors'
|
||||||
|
|
||||||
@ -193,3 +211,74 @@ jobs:
|
|||||||
|
|
||||||
- name: Publish changes
|
- name: Publish changes
|
||||||
run: ssh ${{ secrets.MASTER_SERVER_SSH_USER }}@${{ secrets.MASTER_SERVER_SSH_ADDRESS }} ${{ secrets.SSH_SERVER_PUBLISH_COMMAND }}
|
run: ssh ${{ secrets.MASTER_SERVER_SSH_USER }}@${{ secrets.MASTER_SERVER_SSH_ADDRESS }} ${{ secrets.SSH_SERVER_PUBLISH_COMMAND }}
|
||||||
|
=======
|
||||||
|
key: ${{ secrets.ALTERWARE_MASTER_SERVER_SSH_PRIVATE_KEY }}
|
||||||
|
known_hosts: 'just-a-placeholder-so-we-dont-get-errors'
|
||||||
|
|
||||||
|
- name: Add known hosts
|
||||||
|
run: ssh-keyscan -H ${{ secrets.ALTERWARE_MASTER_SERVER_SSH_ADDRESS }} >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
|
- name: Upload release binary
|
||||||
|
run: rsync -avz alterware-master ${{ secrets.ALTERWARE_MASTER_SERVER_SSH_USER }}@${{ secrets.ALTERWARE_MASTER_SERVER_SSH_ADDRESS }}:${{ env.ALTERWARE_MASTER_SERVER_PATH }}/
|
||||||
|
|
||||||
|
- name: Publish changes
|
||||||
|
run: ssh ${{ secrets.ALTERWARE_MASTER_SERVER_SSH_USER }}@${{ secrets.ALTERWARE_MASTER_SERVER_SSH_ADDRESS }} ${{ secrets.ALTERWARE_SSH_SERVER_PUBLISH_COMMAND }}
|
||||||
|
|
||||||
|
docker:
|
||||||
|
name: Create Docker Image
|
||||||
|
needs: [build-win, build-linux, build-macos]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.ref_type == 'tag'
|
||||||
|
steps:
|
||||||
|
- name: Check out files
|
||||||
|
uses: actions/checkout@main
|
||||||
|
with:
|
||||||
|
sparse-checkout: |
|
||||||
|
Dockerfile
|
||||||
|
README.md
|
||||||
|
sparse-checkout-cone-mode: false
|
||||||
|
|
||||||
|
- name: Download Release binaries
|
||||||
|
uses: actions/download-artifact@main
|
||||||
|
|
||||||
|
- name: Compress Binaries
|
||||||
|
run: |
|
||||||
|
for dir in */; do
|
||||||
|
if [[ $dir == *"windows"* ]]; then
|
||||||
|
cd "$dir" && zip -r "../${dir%/}.zip" . && cd ..
|
||||||
|
else
|
||||||
|
tar -czvf "${dir%/}.tar.gz" -C "$dir" .
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Setup Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3.2.0
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v3.1.0
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USER }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- id: meta
|
||||||
|
uses: docker/metadata-action@v5.5.1
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
alterware/master-server
|
||||||
|
tags: |
|
||||||
|
${{ github.ref_name }}
|
||||||
|
latest
|
||||||
|
|
||||||
|
- name: Build and Push Docker Image
|
||||||
|
id: build-and-push
|
||||||
|
uses: docker/build-push-action@v5.1.0
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
>>>>>>> 27c2b2b75b56e54dcfbec690dd086946a45587d7
|
||||||
|
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -19,4 +19,8 @@
|
|||||||
[submodule "deps/curl"]
|
[submodule "deps/curl"]
|
||||||
path = deps/curl
|
path = deps/curl
|
||||||
url = https://github.com/curl/curl.git
|
url = https://github.com/curl/curl.git
|
||||||
|
<<<<<<< HEAD
|
||||||
branch = curl-8_7_1
|
branch = curl-8_7_1
|
||||||
|
=======
|
||||||
|
branch = curl-8_7_1
|
||||||
|
>>>>>>> 27c2b2b75b56e54dcfbec690dd086946a45587d7
|
||||||
|
13
Dockerfile
Normal file
13
Dockerfile
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
FROM ubuntu:latest
|
||||||
|
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y libc++-dev libcurl4-gnutls-dev
|
||||||
|
|
||||||
|
COPY --chmod=755 ./linux-x64-release/alterware-master /usr/local/bin/
|
||||||
|
|
||||||
|
RUN groupadd alterware-master && useradd -r -g alterware-master alterware-master
|
||||||
|
USER alterware-master
|
||||||
|
|
||||||
|
EXPOSE 20810/udp
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/local/bin/alterware-master"]
|
@ -4,6 +4,13 @@
|
|||||||
# Master Server
|
# Master Server
|
||||||
This is the master server our clients use. It is based on the DP Master Server (ID Tech) protocol
|
This is the master server our clients use. It is based on the DP Master Server (ID Tech) protocol
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
Run using [Docker][docker-link]
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run -p 20810:20810/udp alterware/master-server:latest
|
||||||
|
```
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
- Install [Premake5][premake5-link] and add it to your system PATH
|
- Install [Premake5][premake5-link] and add it to your system PATH
|
||||||
- Clone this repository using [Git][git-link]
|
- Clone this repository using [Git][git-link]
|
||||||
@ -18,6 +25,7 @@ Requirements for Unix systems:
|
|||||||
- Customization: Modifications to the Premake5.lua script may be required
|
- Customization: Modifications to the Premake5.lua script may be required
|
||||||
- Platform support: Details regarding supported platforms are available in [build.yml][build-link]
|
- Platform support: Details regarding supported platforms are available in [build.yml][build-link]
|
||||||
|
|
||||||
|
[docker-link]: https://www.docker.com
|
||||||
[premake5-link]: https://premake.github.io
|
[premake5-link]: https://premake.github.io
|
||||||
[git-link]: https://git-scm.com
|
[git-link]: https://git-scm.com
|
||||||
[mold-link]: https://github.com/rui314/mold
|
[mold-link]: https://github.com/rui314/mold
|
||||||
|
@ -36,7 +36,7 @@ namespace crypto_key
|
|||||||
|
|
||||||
if (!utils::io::write_file("./private.key", key.serialize()))
|
if (!utils::io::write_file("./private.key", key.serialize()))
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Failed to write server key!");
|
console::error("Failed to write server key!");
|
||||||
}
|
}
|
||||||
|
|
||||||
console::info("Generated cryptographic key: %llX", key.get_hash());
|
console::info("Generated cryptographic key: %llX", key.get_hash());
|
||||||
|
@ -9,6 +9,7 @@ enum class game_type
|
|||||||
iw5,
|
iw5,
|
||||||
iw6,
|
iw6,
|
||||||
iw7,
|
iw7,
|
||||||
|
h1,
|
||||||
s1,
|
s1,
|
||||||
t7,
|
t7,
|
||||||
};
|
};
|
||||||
@ -22,6 +23,7 @@ inline const std::string& resolve_game_type_name(const game_type game)
|
|||||||
{game_type::iw5, "IW5"},
|
{game_type::iw5, "IW5"},
|
||||||
{game_type::iw6, "IW6"},
|
{game_type::iw6, "IW6"},
|
||||||
{game_type::iw7, "IW7"},
|
{game_type::iw7, "IW7"},
|
||||||
|
{game_type::h1, "H1"},
|
||||||
{game_type::s1, "S1"},
|
{game_type::s1, "S1"},
|
||||||
{game_type::t7, "T7"},
|
{game_type::t7, "T7"},
|
||||||
};
|
};
|
||||||
@ -51,6 +53,11 @@ inline game_type resolve_game_type(const std::string& game_name)
|
|||||||
return game_type::iw7;
|
return game_type::iw7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (game_name == "H1")
|
||||||
|
{
|
||||||
|
return game_type::h1;
|
||||||
|
}
|
||||||
|
|
||||||
if (game_name == "S1")
|
if (game_name == "S1")
|
||||||
{
|
{
|
||||||
return game_type::s1;
|
return game_type::s1;
|
||||||
|
@ -30,6 +30,7 @@ void elimination_handler::run_frame()
|
|||||||
(server.state == game_server::state::can_ping && diff > 15min))
|
(server.state == game_server::state::can_ping && diff > 15min))
|
||||||
{
|
{
|
||||||
context.remove();
|
context.remove();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (server.game == game_type::unknown)
|
if (server.game == game_type::unknown)
|
||||||
@ -43,6 +44,7 @@ void elimination_handler::run_frame()
|
|||||||
console::log("Removing T7 server '%s' because they are using an outdated protocol (%i)", context.get_address().to_string().data(), server.protocol);
|
console::log("Removing T7 server '%s' because they are using an outdated protocol (%i)", context.get_address().to_string().data(), server.protocol);
|
||||||
#endif
|
#endif
|
||||||
context.remove();
|
context.remove();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
++server_count[server.game][context.get_address().to_string(false)];
|
++server_count[server.game][context.get_address().to_string(false)];
|
||||||
@ -50,6 +52,18 @@ void elimination_handler::run_frame()
|
|||||||
{
|
{
|
||||||
console::log("Removing server '%s' because it exceeds MAX_SERVERS_PER_GAME", context.get_address().to_string().data());
|
console::log("Removing server '%s' because it exceeds MAX_SERVERS_PER_GAME", context.get_address().to_string().data());
|
||||||
context.remove();
|
context.remove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto name = utils::string::to_lower(server.name);
|
||||||
|
for (const auto& entry : bad_names)
|
||||||
|
{
|
||||||
|
if (const auto pos = name.find(entry); pos != std::string::npos)
|
||||||
|
{
|
||||||
|
console::log("Removing server '%s' (%s) because it contains a bad name", server.name.data(), context.get_address().to_string().data());
|
||||||
|
context.remove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto name = utils::string::to_lower(server.name);
|
const auto name = utils::string::to_lower(server.name);
|
||||||
|
@ -142,8 +142,14 @@ void kill_list::write_to_disk()
|
|||||||
stream << entry.ip_address_ << " " << entry.reason_ << "\n";
|
stream << entry.ip_address_ << " " << entry.reason_ << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
utils::io::write_file(kill_file, stream.str(), false);
|
if (utils::io::write_file(kill_file, stream.str(), false))
|
||||||
console::info("Wrote %s to disk (%zu entries)", kill_file, entries.size());
|
{
|
||||||
|
console::info("Wrote %s to disk (%zu entries)", kill_file, entries.size());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
console::error("Failed to write %s!", kill_file);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user