remove node holders and general repo cleanup
Some checks failed
Build and Test / terraria (push) Failing after 4m42s
Build and Test / minecraft-wiiu (push) Failing after 4m44s
Build and Test / splatoon-testfire (push) Failing after 4m45s
Build and Test / mario-tennis (push) Successful in 4m48s
Build and Test / sonic-transformed (push) Failing after 4m54s
Build and Test / friends (push) Failing after 4m56s
Build and Test / splatoon (push) Failing after 4m56s
Build and Test / fast-racing-neo (push) Failing after 4m58s
Build and Test / wii-u-chat (push) Failing after 4m58s
Build and Test / super-mario-maker (push) Failing after 5m2s
Build and Test / puyopuyo (push) Failing after 5m8s
Build and Test / wii-sports-club (push) Failing after 5m9s
Some checks failed
Build and Test / terraria (push) Failing after 4m42s
Build and Test / minecraft-wiiu (push) Failing after 4m44s
Build and Test / splatoon-testfire (push) Failing after 4m45s
Build and Test / mario-tennis (push) Successful in 4m48s
Build and Test / sonic-transformed (push) Failing after 4m54s
Build and Test / friends (push) Failing after 4m56s
Build and Test / splatoon (push) Failing after 4m56s
Build and Test / fast-racing-neo (push) Failing after 4m58s
Build and Test / wii-u-chat (push) Failing after 4m58s
Build and Test / super-mario-maker (push) Failing after 5m2s
Build and Test / puyopuyo (push) Failing after 5m8s
Build and Test / wii-sports-club (push) Failing after 5m9s
the node holders were just causing issues, we have no need for them currently, so we can just set the secure proxy URL through FORWARD_DESTINATION. less complexity for the cluster and self-hosters too
This commit is contained in:
parent
62e867af2f
commit
aaf9bc4b65
31 changed files with 51 additions and 574 deletions
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"image": "ci.virintox.com/spfn/rust-nex/dev-container:latest"
|
|
||||||
}
|
|
||||||
|
|
@ -3,10 +3,8 @@ target
|
||||||
.dockerignore
|
.dockerignore
|
||||||
Dockerfile
|
Dockerfile
|
||||||
CODE_OF_CONDUCT.md
|
CODE_OF_CONDUCT.md
|
||||||
CONTRIBUTING.md
|
|
||||||
README.md
|
README.md
|
||||||
.gitignore
|
.gitignore
|
||||||
LICENSE
|
LICENSE
|
||||||
.devcontainer.json
|
.forgejo/workflows/build.sh
|
||||||
.ci-scripts/make-edition.sh
|
|
||||||
.forgejo/workflows/build.yml
|
.forgejo/workflows/build.yml
|
||||||
|
|
@ -21,7 +21,7 @@ cp $TARGET_DIR/proxy_secure dist/
|
||||||
cp $TARGET_DIR/rnex-server-backend-auth dist/
|
cp $TARGET_DIR/rnex-server-backend-auth dist/
|
||||||
cp $TARGET_DIR/rnex-server-backend-secure dist/
|
cp $TARGET_DIR/rnex-server-backend-secure dist/
|
||||||
|
|
||||||
TARGETS=("node-holder" "proxy-secure" "proxy-insecure" "backend-auth" "backend-secure")
|
TARGETS=("proxy-secure" "proxy-insecure" "backend-auth" "backend-secure")
|
||||||
|
|
||||||
for TARGET in "${TARGETS[@]}"; do
|
for TARGET in "${TARGETS[@]}"; do
|
||||||
$RNEX_CONTAINER_PLATFORM build \
|
$RNEX_CONTAINER_PLATFORM build \
|
||||||
|
|
@ -62,4 +62,4 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
echo "SHORT_SHA=${SHORT_SHA::6}" >> $GITHUB_ENV
|
echo "SHORT_SHA=${SHORT_SHA::6}" >> $GITHUB_ENV
|
||||||
export CI_COMMIT_SHORT_SHA="${SHORT_SHA::6}"
|
export CI_COMMIT_SHORT_SHA="${SHORT_SHA::6}"
|
||||||
./.ci-scripts/make-edition.sh ${{ matrix.edition }}
|
./.forgejo/workflows/build.sh ${{ matrix.edition }}
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
default:
|
|
||||||
image: quay.io/podman/stable
|
|
||||||
cache:
|
|
||||||
key: image-cache
|
|
||||||
paths:
|
|
||||||
- /var/lib/containers/storage
|
|
||||||
- /run/containers/storage
|
|
||||||
- .local/share/containers/storage
|
|
||||||
before_script:
|
|
||||||
- git submodule update --init
|
|
||||||
- podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
|
||||||
|
|
||||||
variables:
|
|
||||||
DOCKER_TLS_CERTDIR: "/certs"
|
|
||||||
IMAGE_TAG: "${CI_COMMIT_REF_SLUG}"
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- build_and_test
|
|
||||||
|
|
||||||
splatoon:
|
|
||||||
stage: build_and_test
|
|
||||||
script: ./.ci-scripts/make-edition.sh splatoon
|
|
||||||
|
|
||||||
friends:
|
|
||||||
stage: build_and_test
|
|
||||||
script: ./.ci-scripts/make-edition.sh friends
|
|
||||||
|
|
||||||
super-mario-maker:
|
|
||||||
stage: build_and_test
|
|
||||||
script: ./.ci-scripts/make-edition.sh super-mario-maker
|
|
||||||
|
|
@ -1,89 +0,0 @@
|
||||||
# How to contribute
|
|
||||||
|
|
||||||
### Content
|
|
||||||
- [Making Issues](#making-issues)
|
|
||||||
- [Code Changes](#code-changes)
|
|
||||||
- [Consistency](#consistency)
|
|
||||||
- [Quality and Substance](#quality-and-substance)
|
|
||||||
- [Commits](#commits)
|
|
||||||
- [Scale and Scope](#scale-and-scope)
|
|
||||||
- [Messages](#messages)
|
|
||||||
- [Pull Requests](#pull-requests)
|
|
||||||
- [Tests](#tests)
|
|
||||||
- [Licensing](#licensing)
|
|
||||||
|
|
||||||
# Making Issues
|
|
||||||
Before contributing any code, you should understand how we use issues and how to make them in a way which ensures you will get the response you want.
|
|
||||||
|
|
||||||
Issues are used by all repositories for most interactions. Issues are used for reporting actual issues with the codebase, as well as making feature requests and asking general questions. When making an issue, please use one of the provided issue templates. Using the provided templates keeps things consistent, as well as makes it easier for any of our 3rd party tools to interact with issues. If a template does not exist for what you wish to do, create a feature request for one. Not using an issue template may result in your issue being closed without completion.
|
|
||||||
|
|
||||||
When making code changes, an issue for the changes must be made and marked as approved before making the relevant changes. This ensures that your time is not wasted on changes we are not interested in making.
|
|
||||||
|
|
||||||
When making issues we ask that you be as detailed as possible. Do not make issues with titles like "I had an issue", "Found a bug", etc. The issue title should be an adequate summary of the information found within the issue's contents. When writing the issue body, provide as much detail as possible. Make the issue as long as it needs to be in order to adequately get the information across. We welcome the use of images, videos, etc. as well when applicable. Provide error codes, error messages, timestamps, the actions leading up errors, etc. Relevant links and even code snippets are also asked for when applicable. The more details we have from the start, the less time we spend asking clarifying questions resulting in faster resolutions. If you do not have much information, that is alright as well. We simply ask that you provide us with as much as you can from the start, and have patience as we work things out.
|
|
||||||
|
|
||||||
# Code Changes
|
|
||||||
As stated in [Making Issues](#making-issues), before making any code changes there must be an open, approved, issue for them. If you can not find an approved issue for the changes you wish to make, please make one before continuing.
|
|
||||||
|
|
||||||
There are 2 main goals when making code contributions:
|
|
||||||
|
|
||||||
1. [Consistency](#consistency)
|
|
||||||
2. [Quality/Substance](#quality-and-substance)
|
|
||||||
|
|
||||||
## Consistency
|
|
||||||
Arguably the most important thing about contributions is keeping them consistent with the rest of the codebase/project. With very few exceptions, contributions should be consistent with the existing codebases style, implementations/patterns, tech stack, etc. Doing so will ensure that anyone can jump into any repository and easily navigate about it. If you would like to make changes which go against any current consistency guidelines or implementations (such as changing linter rules, or swapping to a different tool in the stack), we ask that you make an issue specifically for these ideas first so they can be discussed by the core team.
|
|
||||||
|
|
||||||
See each repository for it's style and linting rules, however some higher level guidelines are:
|
|
||||||
|
|
||||||
- NEX (game) servers are written in Rust.
|
|
||||||
- Game servers which require databases use MySQL.
|
|
||||||
- All other servers (with few exceptions) are written in TypeScript with the intention of being run on Node. If a server is not written in TypeScript, it needs to be migrated to it. Runtimes besides Node (Bun, Deno, etc.) are not accounted for. If compatibility for another runtime can be added without introducing regressions when running under Node, and without significant refactoring, then support may be added via a pull request.
|
|
||||||
- Package managers besides npm are not accounted for. If compatibility for another package manager can be added without introducing regressions when running under npm, and without significant refactoring, then support may be added via a pull request.
|
|
||||||
- TypeScript servers which require databases use MongoDB.
|
|
||||||
- Given that our stacks are mostly Go and TypeScript, our tools and libraries are also written in Go and TypeScript depending on where they will be used. For desktop applications we typically prefer [Electron](https://electronjs.org/), as it allows us to reuse our existing libraries.
|
|
||||||
|
|
||||||
## Quality and Substance
|
|
||||||
We do not accept changes for the sake of changes. Changes should solve real problems, not change things for your personal preferences. This does not mean changes need to be *large*, however. A spelling error is a "real problem" and is worth changing, despite being a small change. However changes such as "Changed from `for...of` to `forEach`" will likely be rejected unless some additional problem is being solved with the change.
|
|
||||||
|
|
||||||
This does not mean we do not value the opinions of others, however. If you feel that a change should be made, but does not solve a specific problem (such as a refactoring change), we welcome opening a feature request for these changes. We do not claim to be infallible, and we are open to making stylistic changes to our codebases when they make sense. However changes like these must still be approved, and justified. If the changes do not provide any true substance, they will likely be rejected.
|
|
||||||
|
|
||||||
Requiring changes to be approved and having substance is essential to not wasting the time of both contributors (who may spend time making changes we are not interested in) and our developers (who will have to spend time reviewing changes which ultimately get rejected).
|
|
||||||
|
|
||||||
# Commits
|
|
||||||
Besides the changes themselves, commits are the most important part of contributions. There are 2 major things to keep in mind for commits:
|
|
||||||
|
|
||||||
1. [Scale/Scope](#scale-and-scope)
|
|
||||||
2. [Messages](#messages)
|
|
||||||
|
|
||||||
## Scale and Scope
|
|
||||||
The scale and scope of a commit should be reasonable. Do not commit for every line when making multiple changes, for example. However you should not include many unrelated changes in a single commit. By limiting the scope of the commit we can ensure that if any regressions or new bugs are introduced we can easily revert those changes without the need for major refactors or reimplementations. Limiting the scale of commits also makes review of the changes easier and faster.
|
|
||||||
|
|
||||||
## Messages
|
|
||||||
Commit messages should adequately explain the changes in the commit. Messages like "Updated file.md" and "spelling error" should not be used. Nonsense messages such as "oops" or "fixed" are especially not allowed. Commit messages should, at minimum, be in the format `type: message` where `type` represents the type or scope of the changes (`feat`, `chore`, `docs`, `fix`, etc.) and `message` is the actual changes. Unless the word is from the codebase and starts with a capital letter (such as an exported Go struct), the `message` should be lowercase. We also recommend using both "subject" and "body" commits. This can be achieved through the git CLI by using multiple `-m`/`--message` flags. For example `git commit -m "short subject" -m "longer description of the changes"`.
|
|
||||||
|
|
||||||
The following are examples of good commit messages:
|
|
||||||
|
|
||||||
- `chore: renamed nnid service to nnas`
|
|
||||||
- `fix: fixed hang in MutexMap.Has`
|
|
||||||
|
|
||||||
Please refer to [Conventional Commits](https://conventionalcommits.org/) for a detailed guide on how to structure commit messages. Writing good, detailed, commit messages helps ensure that we can refer back to the git history and quickly find where specific changes occurred in the event that they need further review, reverting, etc.
|
|
||||||
|
|
||||||
# Pull Requests
|
|
||||||
As stated in [Making Issues](#making-issues), before making a pull request there must be an open, approved, issue for the changes being made. If you can not find an approved issue for the changes you wish to make, please make one before continuing. Unless a single update closes multiple issues, each pull request should target a single issue. If you wish to work on multiple issues, please open a pull request for each. This keeps the pull request scope limited and allows for easier discussion of the individual issues and your related changes to them.
|
|
||||||
|
|
||||||
Before making a pull request ensure you have tested all changes and that no regressions have been introduced.
|
|
||||||
|
|
||||||
Pull requests should never be made against the default (`main`/`master`) branch of a repository. The default branch contains the most recent, stable, version of the codebase. All work on the codebase should take place in other branches. Unless otherwise specified, your target branch should typically be the `dev` branch. You may target other feature branches, however, if need be. If a `dev` branch does not exist for the repository you are working on, please submit a feature request for one to be added before continuing.
|
|
||||||
|
|
||||||
A pull request does not necessarily need to *close* an issue. A pull request may be made which implements only a subset of the requirements to close an issue, but does not fully complete the task itself. A pull request should never be *unfinished* code, however. All code must be tested and shippable. A pull request must at minimum bring an issue closer to closing without introducing any new regressions.
|
|
||||||
|
|
||||||
Like everything else, pull requests should be as detailed as possible. Your title should adequately summarize the changes being made, and the body of the pull request should fully explain your changes. We ask that, if applicable, the rationale behind your changes also be noted. For example rather than simply "Changed from `for...of` to `forEach`", if the change was made for a performance reason you should say "Changed from `for...of` to `forEach` due to `forEach` being X times faster in this case" and provide some benchmarks. Adding images, videos, etc. is also welcomed in order to illustrate changes. If the changes being made are directly tied to some form of visual (such as a change to the website, a tools GUI, etc.) then images or videos is ***REQUIRED***. If none are provided, then we may delay review until they are given. Providing visual examples of these changes allow us to quickly assess whether or not we wish to proceed with the changes being made.
|
|
||||||
|
|
||||||
If a pull request requires any database migrations, describe them in detail and leave any migration queries inside of a code block within a `<details>` tag. This should happen either at the very beginning of the pull request message, or at the very end, but not somewhere in between. Doing so makes it clear at a glance that there are migrations required and makes it easy to find the related queries.
|
|
||||||
|
|
||||||
We ask that you have patience with us as we review your pull request. SPFN only has a single full time developer, all other work is done by volunteers on their own time. Due to the sheer number of issues and pull requests, alongside our other general work and research, it may take us some time to fully review and decide on whether or not to merge your changes.
|
|
||||||
|
|
||||||
# Tests
|
|
||||||
We do not require 100% code coverage in any tests. We do not currently have strict rules regarding tests, however we may ask that tests be provided for large or complex changes.
|
|
||||||
|
|
||||||
# Licensing
|
|
||||||
Unless otherwise specified all code is licensed under [GNU AGPLv3](https://choosealicense.com/licenses/agpl-3.0), including that of outside contributions. This license allows users many freedoms to use our code in their own applications, including private and commercial use, while ensuring that all derivatives remain under this same license and keeps the source available, even when used over a network. A repository's license may not be changed by outside contributors unless that change is done with good reason, has been approved by the core development team, and is done with the consent of all relevant contributors.
|
|
||||||
32
Cargo.lock
generated
32
Cargo.lock
generated
|
|
@ -2160,7 +2160,6 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hex",
|
"hex",
|
||||||
"rnex-prudp",
|
"rnex-prudp",
|
||||||
"rnex-reggie-protos",
|
|
||||||
"rnex-rmc",
|
"rnex-rmc",
|
||||||
"rnex-server",
|
"rnex-server",
|
||||||
"rnex-util",
|
"rnex-util",
|
||||||
|
|
@ -2422,9 +2421,9 @@ dependencies = [
|
||||||
"rand 0.10.2",
|
"rand 0.10.2",
|
||||||
"rnex-auth-protos",
|
"rnex-auth-protos",
|
||||||
"rnex-prudp",
|
"rnex-prudp",
|
||||||
"rnex-reggie-protos",
|
|
||||||
"rnex-rmc",
|
"rnex-rmc",
|
||||||
"rnex-server",
|
"rnex-server",
|
||||||
|
"thiserror",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tonic",
|
"tonic",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
|
@ -2581,16 +2580,6 @@ dependencies = [
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rnex-node-holder"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"rnex-reggie-protos",
|
|
||||||
"rnex-rmc",
|
|
||||||
"rnex-server",
|
|
||||||
"tokio",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rnex-prudp"
|
name = "rnex-prudp"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
@ -2607,15 +2596,6 @@ dependencies = [
|
||||||
"v-byte-helpers",
|
"v-byte-helpers",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rnex-reggie-protos"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"ctor",
|
|
||||||
"rnex-rmc",
|
|
||||||
"tracing",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rnex-rk"
|
name = "rnex-rk"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
@ -2695,16 +2675,6 @@ dependencies = [
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rnex-server-backend-node-holder"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"rnex-node-holder",
|
|
||||||
"rnex-reggie-protos",
|
|
||||||
"rnex-server",
|
|
||||||
"tokio",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rnex-server-backend-secure"
|
name = "rnex-server-backend-secure"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
|
||||||
|
|
@ -13,19 +13,16 @@ members = [
|
||||||
"rnex-protocols/rk-protos",
|
"rnex-protocols/rk-protos",
|
||||||
"rnex-protocols/base-protos",
|
"rnex-protocols/base-protos",
|
||||||
"rnex-protocols/auth-protos",
|
"rnex-protocols/auth-protos",
|
||||||
"rnex-protocols/reggie-protos",
|
|
||||||
"rnex-protocols/msg-protos",
|
"rnex-protocols/msg-protos",
|
||||||
"rnex-protocols/fpd-protos",
|
"rnex-protocols/fpd-protos",
|
||||||
"rnex-prudp",
|
"rnex-prudp",
|
||||||
"rnex-server",
|
"rnex-server",
|
||||||
"rnex-server/backend-auth",
|
"rnex-server/backend-auth",
|
||||||
"rnex-server/backend-secure",
|
"rnex-server/backend-secure",
|
||||||
"rnex-server/backend-node-holder",
|
|
||||||
"rnex-server-nex-modules/rnex-mm",
|
"rnex-server-nex-modules/rnex-mm",
|
||||||
"rnex-server-nex-modules/rnex-ds",
|
"rnex-server-nex-modules/rnex-ds",
|
||||||
"rnex-server-nex-modules/rnex-rk",
|
"rnex-server-nex-modules/rnex-rk",
|
||||||
"rnex-server-nex-modules/rnex-fpd",
|
"rnex-server-nex-modules/rnex-fpd",
|
||||||
"rnex-server-nex-modules/rnex-node-holder",
|
|
||||||
"rnex-server-nex-modules/rnex-base",
|
"rnex-server-nex-modules/rnex-base",
|
||||||
"rnex-server-nex-modules/rnex-msg",
|
"rnex-server-nex-modules/rnex-msg",
|
||||||
"rnex-server-nex-modules/rnex-auth",
|
"rnex-server-nex-modules/rnex-auth",
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
libssl3 \
|
libssl3 \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
FROM base AS node-holder
|
|
||||||
COPY dist/rnex-server-backend-node-holder /rnex-server-backend-node-holder
|
|
||||||
ENTRYPOINT ["/rnex-server-backend-node-holder"]
|
|
||||||
|
|
||||||
FROM base AS proxy-insecure
|
FROM base AS proxy-insecure
|
||||||
COPY dist/proxy_insecure /proxy_insecure
|
COPY dist/proxy_insecure /proxy_insecure
|
||||||
ENTRYPOINT ["/proxy_insecure"]
|
ENTRYPOINT ["/proxy_insecure"]
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
# Security Policy
|
|
||||||
|
|
||||||
Report security vulnerabilities through the security tab on this repo. Only vulnerabilities on the latest commit of any branch will be considered.
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
# Support
|
|
||||||
|
|
||||||
For support, join [our discord](https://discord.gg/splatfestival).
|
|
||||||
|
|
@ -14,5 +14,5 @@ echo FEATURES:
|
||||||
echo $EDITION_FEATURES
|
echo $EDITION_FEATURES
|
||||||
|
|
||||||
# RUSTFLAGS="--deny warnings" cargo clippy --workspace --features "$EDITION_FEATURES"
|
# RUSTFLAGS="--deny warnings" cargo clippy --workspace --features "$EDITION_FEATURES"
|
||||||
RUSTFLAGS="--deny warnings" cargo check --workspace --features "$EDITION_FEATURES"
|
cargo check --workspace --features "$EDITION_FEATURES"
|
||||||
# echo "edition checks are disabled right now due to being in"
|
# echo "edition checks are disabled right now due to being in"
|
||||||
|
|
|
||||||
61
flake.lock
generated
61
flake.lock
generated
|
|
@ -1,61 +0,0 @@
|
||||||
{
|
|
||||||
"nodes": {
|
|
||||||
"flake-parts": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs-lib": "nixpkgs-lib"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1767609335,
|
|
||||||
"narHash": "sha256-feveD98mQpptwrAEggBQKJTYbvwwglSbOv53uCfH9PY=",
|
|
||||||
"owner": "hercules-ci",
|
|
||||||
"repo": "flake-parts",
|
|
||||||
"rev": "250481aafeb741edfe23d29195671c19b36b6dca",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "hercules-ci",
|
|
||||||
"repo": "flake-parts",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1767640445,
|
|
||||||
"narHash": "sha256-UWYqmD7JFBEDBHWYcqE6s6c77pWdcU/i+bwD6XxMb8A=",
|
|
||||||
"owner": "nixos",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "9f0c42f8bc7151b8e7e5840fb3bd454ad850d8c5",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nixos",
|
|
||||||
"ref": "nixos-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs-lib": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1765674936,
|
|
||||||
"narHash": "sha256-k00uTP4JNfmejrCLJOwdObYC9jHRrr/5M/a/8L2EIdo=",
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "nixpkgs.lib",
|
|
||||||
"rev": "2075416fcb47225d9b68ac469a5c4801a9c4dd85",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "nixpkgs.lib",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-parts": "flake-parts",
|
|
||||||
"nixpkgs": "nixpkgs"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": "root",
|
|
||||||
"version": 7
|
|
||||||
}
|
|
||||||
28
flake.nix
28
flake.nix
|
|
@ -1,28 +0,0 @@
|
||||||
{
|
|
||||||
description = "rust nex server";
|
|
||||||
|
|
||||||
inputs = {
|
|
||||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
|
||||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
||||||
};
|
|
||||||
|
|
||||||
outputs =
|
|
||||||
inputs@{
|
|
||||||
self,
|
|
||||||
nixpkgs,
|
|
||||||
flake-parts,
|
|
||||||
}:
|
|
||||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
|
||||||
systems = [
|
|
||||||
"x86_64-linux"
|
|
||||||
"aarch64-linux"
|
|
||||||
"x86_64-darwin"
|
|
||||||
"aarch64-darwin"
|
|
||||||
];
|
|
||||||
perSystem =
|
|
||||||
{ pkgs, lib, ... }:
|
|
||||||
rec {
|
|
||||||
devShells.default = import ./shell.nix { inherit pkgs; };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -11,7 +11,6 @@ thiserror = "2.0.12"
|
||||||
rnex-prudp = { path = "../rnex-prudp" }
|
rnex-prudp = { path = "../rnex-prudp" }
|
||||||
rnex-server = { path = "../rnex-server" }
|
rnex-server = { path = "../rnex-server" }
|
||||||
rnex-util = { path = "../rnex-util" }
|
rnex-util = { path = "../rnex-util" }
|
||||||
rnex-reggie-protos = { path = "../rnex-protocols/reggie-protos" }
|
|
||||||
rnex-rmc = { path = "../rnex-rmc" }
|
rnex-rmc = { path = "../rnex-rmc" }
|
||||||
tokio = { version = "1.47.0", features = ["full"] }
|
tokio = { version = "1.47.0", features = ["full"] }
|
||||||
hex = "0.4.3"
|
hex = "0.4.3"
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
use rnex_prudp::{socket_addr::PRUDPSockAddr, virtual_port::VirtualPort};
|
use rnex_prudp::{socket_addr::PRUDPSockAddr, virtual_port::VirtualPort};
|
||||||
use rnex_reggie_protos::reggie::{EdgeNodeHolderConnectOption, RemoteEdgeNodeHolder};
|
|
||||||
use rnex_rmc::{
|
use rnex_rmc::{
|
||||||
RemoteDisconnectable, RmcCallable, RmcConnection, RmcPureRemoteObject,
|
RemoteDisconnectable, RmcCallable, RmcConnection, RmcPureRemoteObject,
|
||||||
new_rmc_gateway_connection, serialization::RmcSerialize,
|
serialization::RmcSerialize,
|
||||||
};
|
};
|
||||||
use rnex_server::{ConnectionInitData, try_get_ip};
|
use rnex_server::{ConnectionInitData, try_get_ip};
|
||||||
use rnex_util::{PID, SendingBufferConnection, SplittableBufferConnection, UnitPacketWrite};
|
use rnex_util::{PID, SendingBufferConnection, SplittableBufferConnection, UnitPacketWrite};
|
||||||
|
|
@ -13,7 +12,7 @@ use std::{
|
||||||
ops::Deref,
|
ops::Deref,
|
||||||
panic,
|
panic,
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
sync::{Arc, LazyLock},
|
sync::LazyLock,
|
||||||
};
|
};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use tokio::net::TcpStream;
|
use tokio::net::TcpStream;
|
||||||
|
|
@ -120,6 +119,7 @@ impl<T: RemoteDisconnectable, C: FnOnce() + Send + Sync + 'static> Deref for OnR
|
||||||
impl<T: RemoteDisconnectable + RmcPureRemoteObject, C: FnOnce() + Send + Sync + 'static>
|
impl<T: RemoteDisconnectable + RmcPureRemoteObject, C: FnOnce() + Send + Sync + 'static>
|
||||||
OnRemoteDrop<T, C>
|
OnRemoteDrop<T, C>
|
||||||
{
|
{
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn new(conn: RmcConnection, drop_func: C) -> Self {
|
pub fn new(conn: RmcConnection, drop_func: C) -> Self {
|
||||||
Self(T::new(conn), Some(drop_func))
|
Self(T::new(conn), Some(drop_func))
|
||||||
}
|
}
|
||||||
|
|
@ -152,34 +152,6 @@ impl<T: RemoteDisconnectable, C: FnOnce() + Send + Sync + 'static> Drop for OnRe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn setup_edge_node_connection(
|
|
||||||
param: &ProxyStartupParam,
|
|
||||||
shutdown_callback: impl FnOnce() + Send + Sync + 'static,
|
|
||||||
) {
|
|
||||||
let conn = tokio::net::TcpStream::connect(¶m.edge_node_holder)
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let conn: SplittableBufferConnection = conn.into();
|
|
||||||
|
|
||||||
conn.send(
|
|
||||||
EdgeNodeHolderConnectOption::Register(param.self_public)
|
|
||||||
.to_data()
|
|
||||||
.unwrap(),
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
|
|
||||||
println!("{:?}", param.self_public);
|
|
||||||
//leave the inner object floating so that it gets destroyed once we disconnect
|
|
||||||
new_rmc_gateway_connection(conn, async move |r| {
|
|
||||||
Arc::new(OnRemoteDrop::<RemoteEdgeNodeHolder, _>::new(
|
|
||||||
r,
|
|
||||||
shutdown_callback,
|
|
||||||
))
|
|
||||||
})
|
|
||||||
.await;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn new_backend_connection(
|
pub async fn new_backend_connection(
|
||||||
param: &ProxyStartupParam,
|
param: &ProxyStartupParam,
|
||||||
addr: PRUDPSockAddr,
|
addr: PRUDPSockAddr,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
use proxy::edge_node_dc_callback;
|
use proxy_common::ProxyStartupParam;
|
||||||
use proxy_common::{ProxyStartupParam, setup_edge_node_connection};
|
|
||||||
use rnex_server::with_setup;
|
use rnex_server::with_setup;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
|
|
@ -8,7 +7,7 @@ async fn main() {
|
||||||
let param = ProxyStartupParam::new(proxy_common::ProxyType::Secure)
|
let param = ProxyStartupParam::new(proxy_common::ProxyType::Secure)
|
||||||
.expect("unable to get startup parameters");
|
.expect("unable to get startup parameters");
|
||||||
|
|
||||||
setup_edge_node_connection(¶m, edge_node_dc_callback).await;
|
// setup_edge_node_connection(¶m, edge_node_dc_callback).await;
|
||||||
proxy::start_secure(param).await;
|
proxy::start_secure(param).await;
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -360,8 +360,6 @@ impl<T: CryptoHandler> InternalSocket<T> {
|
||||||
async fn connection_thread(
|
async fn connection_thread(
|
||||||
connection: Weak<InternalConnectionMutex<T::CryptoConnectionInstance>>,
|
connection: Weak<InternalConnectionMutex<T::CryptoConnectionInstance>>,
|
||||||
) {
|
) {
|
||||||
//todo: handle stuff like resending packets if they arent acknowledged in here
|
|
||||||
|
|
||||||
while let Some(conn) = connection.upgrade() {
|
while let Some(conn) = connection.upgrade() {
|
||||||
let mut conn = conn.lock().await;
|
let mut conn = conn.lock().await;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,6 @@
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
"git-submodules": {
|
"git-submodules": {
|
||||||
"enabled": true
|
"enabled": true
|
||||||
}
|
},
|
||||||
|
"reviewers": ["redbinder0526", "bloxerhd018"]
|
||||||
}
|
}
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "rnex-reggie-protos"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2024"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
ctor = "1.0.8"
|
|
||||||
rnex-rmc = { path = "../../rnex-rmc" }
|
|
||||||
tracing = "0.1.44"
|
|
||||||
|
|
||||||
[features]
|
|
||||||
splatoon = ["v3-5-0"]
|
|
||||||
datastore = ["database-support", "v3-8-15"]
|
|
||||||
database-support = []
|
|
||||||
nx = []
|
|
||||||
third-notif-param = []
|
|
||||||
v3-3-2 = []
|
|
||||||
v3-4-0 = ["v3-3-2", "third-notif-param"]
|
|
||||||
v3-5-0 = ["v3-4-0"]
|
|
||||||
v3-8-13 = ["v3-5-0"]
|
|
||||||
v3-8-15 = ["v3-5-0"]
|
|
||||||
v3-10-22 = ["v3-8-15"]
|
|
||||||
v4-3-11 = ["v3-8-15"]
|
|
||||||
friends = []
|
|
||||||
rmc_struct_header = []
|
|
||||||
big_pid = []
|
|
||||||
|
|
||||||
[lints]
|
|
||||||
workspace = true
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
#![allow(async_fn_in_trait)]
|
|
||||||
|
|
||||||
pub mod reggie;
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
use std::net::SocketAddrV4;
|
|
||||||
|
|
||||||
use rnex_rmc::{RmcSerialize, define_rmc_proto, method_id, response::ErrorCode, rmc_proto};
|
|
||||||
|
|
||||||
#[rmc_proto(1)]
|
|
||||||
pub trait EdgeNodeManagement {
|
|
||||||
#[method_id(1)]
|
|
||||||
async fn get_url(&self, seed: u64) -> Result<SocketAddrV4, ErrorCode>;
|
|
||||||
}
|
|
||||||
|
|
||||||
define_rmc_proto!(
|
|
||||||
proto EdgeNodeHolder{
|
|
||||||
EdgeNodeManagement
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
#[derive(RmcSerialize, Debug)]
|
|
||||||
#[repr(u32)]
|
|
||||||
pub enum EdgeNodeHolderConnectOption {
|
|
||||||
DontRegister = 0,
|
|
||||||
Register(SocketAddrV4) = 1,
|
|
||||||
}
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
use bytemuck::{Pod, Zeroable};
|
use bytemuck::{Pod, Zeroable};
|
||||||
use rnex_base_protos::ResultsRange;
|
use rnex_base_protos::ResultsRange;
|
||||||
use rnex_rmc::{
|
use rnex_rmc::{
|
||||||
RmcSerialize, method_id,
|
RmcSerialize,
|
||||||
qbuffer::QBuffer,
|
qbuffer::QBuffer,
|
||||||
response::ErrorCode,
|
|
||||||
rmc_proto,
|
rmc_proto,
|
||||||
util::{PID, date_time::DateTime},
|
util::{PID, date_time::DateTime},
|
||||||
};
|
};
|
||||||
|
#[cfg(feature = "splatoon")]
|
||||||
|
use rnex_rmc::{method_id, response::ErrorCode};
|
||||||
|
|
||||||
#[derive(RmcSerialize, Debug)]
|
#[derive(RmcSerialize, Debug)]
|
||||||
#[rmc_struct(0)]
|
#[rmc_struct(0)]
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ edition = "2024"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rnex-rmc = { path = "../../rnex-rmc" }
|
rnex-rmc = { path = "../../rnex-rmc" }
|
||||||
rnex-auth-protos = { path = "../../rnex-protocols/auth-protos" }
|
rnex-auth-protos = { path = "../../rnex-protocols/auth-protos" }
|
||||||
rnex-reggie-protos = { path = "../../rnex-protocols/reggie-protos" }
|
|
||||||
rnex-server = { path = "../../rnex-server" }
|
rnex-server = { path = "../../rnex-server" }
|
||||||
rnex-prudp = { path = "../../rnex-prudp" }
|
rnex-prudp = { path = "../../rnex-prudp" }
|
||||||
hex = "0.4.3"
|
hex = "0.4.3"
|
||||||
|
|
@ -17,6 +16,7 @@ tracing = "0.1.44"
|
||||||
cfg-if = "1.0.4"
|
cfg-if = "1.0.4"
|
||||||
anyhow = "1.0.103"
|
anyhow = "1.0.103"
|
||||||
tokio = { version = "1.52.3", features = ["net"] }
|
tokio = { version = "1.52.3", features = ["net"] }
|
||||||
|
thiserror = "2.0.20"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
rmc_struct_header = []
|
rmc_struct_header = []
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,5 @@
|
||||||
use std::{
|
use std::{env, hash::{DefaultHasher, Hasher}, net::SocketAddrV4, sync::LazyLock};
|
||||||
hash::{DefaultHasher, Hasher},
|
use std::str::FromStr;
|
||||||
net::SocketAddrV4,
|
|
||||||
sync::LazyLock,
|
|
||||||
};
|
|
||||||
|
|
||||||
use cfg_if::cfg_if;
|
use cfg_if::cfg_if;
|
||||||
use nex_account::{grpc, grpc_client};
|
use nex_account::{grpc, grpc_client};
|
||||||
use rnex_auth_protos::{
|
use rnex_auth_protos::{
|
||||||
|
|
@ -11,7 +7,6 @@ use rnex_auth_protos::{
|
||||||
auth::{Auth, ConnectionData, ConnectionDataOld},
|
auth::{Auth, ConnectionData, ConnectionDataOld},
|
||||||
};
|
};
|
||||||
use rnex_prudp::kerberos::{Ticket, TicketInternalData};
|
use rnex_prudp::kerberos::{Ticket, TicketInternalData};
|
||||||
use rnex_reggie_protos::reggie::RemoteEdgeNodeManagement;
|
|
||||||
use rnex_rmc::{
|
use rnex_rmc::{
|
||||||
any::Any,
|
any::Any,
|
||||||
qresult::QResult,
|
qresult::QResult,
|
||||||
|
|
@ -47,6 +42,14 @@ pub fn generate_ticket(
|
||||||
}
|
}
|
||||||
.encrypt(source_key, &encrypted_inner)
|
.encrypt(source_key, &encrypted_inner)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn try_get_env<T: FromStr>(name: &'static str) -> Result<T, ErrorCode> {
|
||||||
|
env::var(name)
|
||||||
|
.ok()
|
||||||
|
.and_then(|val| val.parse::<T>().ok())
|
||||||
|
.ok_or(ErrorCode::Core_Unknown)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn generate_ticket_with_string_user_key(
|
pub fn generate_ticket_with_string_user_key(
|
||||||
source_act: PID,
|
source_act: PID,
|
||||||
dest_act_login_data: (PID, [u8; 16]),
|
dest_act_login_data: (PID, [u8; 16]),
|
||||||
|
|
@ -193,9 +196,14 @@ impl Auth for AuthHandler {
|
||||||
|
|
||||||
hasher.write(name.as_bytes());
|
hasher.write(name.as_bytes());
|
||||||
|
|
||||||
let Ok(addr) = self.am.control_server.get_url(hasher.finish()).await else {
|
// let Ok(addr) = self.am.control_server.get_url(hasher.finish()).await else {
|
||||||
warn!("no secure proxies");
|
// warn!("no secure proxies");
|
||||||
return Err(ErrorCode::Core_Exception);
|
// return Err(ErrorCode::Core_Exception);
|
||||||
|
// };
|
||||||
|
|
||||||
|
let addr = match try_get_env("FORWARD_DESTINATION") {
|
||||||
|
Ok(val) => val,
|
||||||
|
Err(e) => return Err(e),
|
||||||
};
|
};
|
||||||
|
|
||||||
let connection_data = ConnectionDataOld {
|
let connection_data = ConnectionDataOld {
|
||||||
|
|
@ -231,9 +239,14 @@ impl Auth for AuthHandler {
|
||||||
|
|
||||||
hasher.write(name.as_bytes());
|
hasher.write(name.as_bytes());
|
||||||
|
|
||||||
let Ok(addr) = self.control_server.get_url(hasher.finish()).await else {
|
// let Ok(addr) = self.control_server.get_url(hasher.finish()).await else {
|
||||||
warn!("no secure proxies");
|
// warn!("no secure proxies");
|
||||||
return Err(ErrorCode::Core_Exception);
|
// return Err(ErrorCode::Core_Exception);
|
||||||
|
// };
|
||||||
|
|
||||||
|
let addr = match try_get_env("FORWARD_DESTINATION") {
|
||||||
|
Ok(val) => val,
|
||||||
|
Err(e) => return Err(e),
|
||||||
};
|
};
|
||||||
|
|
||||||
let connection_data = ConnectionData {
|
let connection_data = ConnectionData {
|
||||||
|
|
@ -291,9 +304,14 @@ impl Auth for AuthHandler {
|
||||||
|
|
||||||
hasher.write(name.as_bytes());
|
hasher.write(name.as_bytes());
|
||||||
|
|
||||||
let Ok(addr) = self.am.control_server.get_url(hasher.finish()).await else {
|
// let Ok(addr) = self.am.control_server.get_url(hasher.finish()).await else {
|
||||||
warn!("no secure proxies");
|
// warn!("no secure proxies");
|
||||||
return Err(ErrorCode::Core_Exception);
|
// return Err(ErrorCode::Core_Exception);
|
||||||
|
// };
|
||||||
|
|
||||||
|
let addr = match try_get_env("FORWARD_DESTINATION") {
|
||||||
|
Ok(val) => val,
|
||||||
|
Err(e) => return Err(e),
|
||||||
};
|
};
|
||||||
|
|
||||||
let connection_data = ConnectionData {
|
let connection_data = ConnectionData {
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,8 @@
|
||||||
#[allow(async_fn_in_trait)]
|
#[allow(async_fn_in_trait)]
|
||||||
pub mod auth_handler;
|
pub mod auth_handler;
|
||||||
|
|
||||||
use std::{env, sync::Arc};
|
|
||||||
use tokio::net::TcpStream;
|
|
||||||
|
|
||||||
use nex_account::{grpc::Pid, grpc_client};
|
use nex_account::{grpc::Pid, grpc_client};
|
||||||
use rnex_reggie_protos::reggie::{EdgeNodeHolderConnectOption::DontRegister, RemoteEdgeNodeHolder};
|
use rnex_rmc::util::account::Account;
|
||||||
use rnex_rmc::{
|
|
||||||
OnlyRemote, new_rmc_gateway_connection,
|
|
||||||
serialization::RmcSerialize,
|
|
||||||
util::{SplittableBufferConnection, account::Account},
|
|
||||||
};
|
|
||||||
use rnex_server::{ConnectionInitData, RnexManager, RnexModule, WeakPassthroughInitModule};
|
use rnex_server::{ConnectionInitData, RnexManager, RnexModule, WeakPassthroughInitModule};
|
||||||
use tracing::info;
|
use tracing::info;
|
||||||
|
|
||||||
|
|
@ -20,7 +12,6 @@ use crate::auth_handler::AuthHandler;
|
||||||
pub struct AuthManager {
|
pub struct AuthManager {
|
||||||
pub destination_server_acct: Account,
|
pub destination_server_acct: Account,
|
||||||
pub build_name: &'static str,
|
pub build_name: &'static str,
|
||||||
pub control_server: Arc<OnlyRemote<RemoteEdgeNodeHolder>>,
|
|
||||||
}
|
}
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct AuthModule;
|
pub struct AuthModule;
|
||||||
|
|
@ -40,35 +31,14 @@ impl RnexManager for AuthManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
pub static FORWARD_EDGE_NODE_HOLDER: Lazy<SocketAddrV4> = Lazy::new(|| {
|
|
||||||
env::var("FORWARD_EDGE_NODE_HOLDER")
|
|
||||||
.ok()
|
|
||||||
.and_then(|s| Some(s.parse().unwrap()))
|
|
||||||
.expect("FORWARD_EDGE_NODE_HOLDER not set")
|
|
||||||
});*/
|
|
||||||
|
|
||||||
impl RnexModule for AuthModule {
|
impl RnexModule for AuthModule {
|
||||||
type Manager = AuthManager;
|
type Manager = AuthManager;
|
||||||
type InitError = anyhow::Error;
|
type InitError = anyhow::Error;
|
||||||
async fn create_manager(
|
async fn create_manager(
|
||||||
_: &rnex_server::ModuleHolder,
|
_: &rnex_server::ModuleHolder,
|
||||||
) -> Result<Self::Manager, Self::InitError> {
|
) -> Result<Self::Manager, Self::InitError> {
|
||||||
let conn = TcpStream::connect(env::var("FORWARD_EDGE_NODE_HOLDER")?)
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let conn: SplittableBufferConnection = conn.into();
|
|
||||||
|
|
||||||
conn.send(DontRegister.to_data().unwrap()).await;
|
|
||||||
|
|
||||||
let conn = new_rmc_gateway_connection(conn, async |r| {
|
|
||||||
Arc::new(OnlyRemote::<RemoteEdgeNodeHolder>::new(r))
|
|
||||||
})
|
|
||||||
.await;
|
|
||||||
Ok(AuthManager {
|
Ok(AuthManager {
|
||||||
build_name: option_env!("AUTH_REPORT_VERSION").unwrap_or("no version specified"),
|
build_name: option_env!("AUTH_REPORT_VERSION").unwrap_or("no version specified"),
|
||||||
control_server: conn,
|
|
||||||
// todo: update nex-account to allow pulling the entire account info for rnex
|
// todo: update nex-account to allow pulling the entire account info for rnex
|
||||||
destination_server_acct: Account::new_raw_key(
|
destination_server_acct: Account::new_raw_key(
|
||||||
2,
|
2,
|
||||||
|
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "rnex-node-holder"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2024"
|
|
||||||
|
|
||||||
[features]
|
|
||||||
rmc_struct_header = []
|
|
||||||
guest_login = []
|
|
||||||
friends = ["guest_login", "database-support"]
|
|
||||||
big_pid = []
|
|
||||||
third-notif-param = []
|
|
||||||
v3-3-2 = []
|
|
||||||
v3-4-0 = ["v3-3-2", "third-notif-param", "rmc_struct_header"]
|
|
||||||
v3-5-0 = ["v3-4-0"]
|
|
||||||
v3-8-13 = ["v3-5-0"]
|
|
||||||
v3-8-15 = ["v3-5-0"]
|
|
||||||
v3-10-22 = ["v3-8-15"]
|
|
||||||
v4-3-11 = ["v3-8-15"]
|
|
||||||
nx = ["big_pid"]
|
|
||||||
splatoon = ["v3-5-0"]
|
|
||||||
datastore = ["database-support", "v3-8-15"]
|
|
||||||
database-support = []
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
rnex-rmc = { path = "../../rnex-rmc" }
|
|
||||||
rnex-reggie-protos = { path = "../../rnex-protocols/reggie-protos" }
|
|
||||||
rnex-server = { path = "../../rnex-server" }
|
|
||||||
tokio = { version = "1.52.3", features = ["sync"] }
|
|
||||||
|
|
||||||
[lints]
|
|
||||||
workspace = true
|
|
||||||
|
|
@ -1,84 +0,0 @@
|
||||||
use std::{
|
|
||||||
convert::Infallible,
|
|
||||||
net::{Ipv4Addr, SocketAddrV4},
|
|
||||||
sync::{Arc, Weak},
|
|
||||||
};
|
|
||||||
|
|
||||||
use rnex_reggie_protos::reggie::{
|
|
||||||
EdgeNodeHolderConnectOption, EdgeNodeManagement, LocalEdgeNodeHolder,
|
|
||||||
};
|
|
||||||
use rnex_rmc::{response::ErrorCode, rmc_struct};
|
|
||||||
use rnex_server::{
|
|
||||||
PassthroughInitModule, RnexManager, RnexModule, WeakPassthroughInitModule,
|
|
||||||
};
|
|
||||||
use tokio::sync::RwLock;
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
#[rmc_struct(EdgeNodeHolder)]
|
|
||||||
pub struct EdgeNode {
|
|
||||||
em: PassthroughInitModule<NodeHolderManager>,
|
|
||||||
address: SocketAddrV4,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl EdgeNodeManagement for EdgeNode {
|
|
||||||
async fn get_url(&self, seed: u64) -> Result<SocketAddrV4, ErrorCode> {
|
|
||||||
let nodes = self.em.edge_nodes.read().await;
|
|
||||||
|
|
||||||
let nodes: Vec<_> = nodes.iter().filter_map(|n| n.upgrade()).collect();
|
|
||||||
|
|
||||||
// avoid a devide by zero
|
|
||||||
if nodes.len() == 0 {
|
|
||||||
return Err(ErrorCode::Core_InvalidIndex);
|
|
||||||
};
|
|
||||||
|
|
||||||
let node = &nodes[seed as usize % nodes.len()];
|
|
||||||
|
|
||||||
Ok(node.address)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default, Debug)]
|
|
||||||
pub struct NodeHolderManager {
|
|
||||||
edge_nodes: RwLock<Vec<Weak<EdgeNode>>>,
|
|
||||||
}
|
|
||||||
#[derive(Default, Debug)]
|
|
||||||
pub struct NodeHolderModule;
|
|
||||||
|
|
||||||
impl RnexManager for NodeHolderManager {
|
|
||||||
type User = Arc<EdgeNode>;
|
|
||||||
type InitData = EdgeNodeHolderConnectOption;
|
|
||||||
async fn init_new_user(
|
|
||||||
this: PassthroughInitModule<Self>,
|
|
||||||
_mod_holder: &rnex_server::ModuleHolder,
|
|
||||||
_remote: &rnex_rmc::RmcConnection,
|
|
||||||
init_data: &Self::InitData,
|
|
||||||
_: WeakPassthroughInitModule<Self::User>,
|
|
||||||
) -> Self::User {
|
|
||||||
match init_data {
|
|
||||||
EdgeNodeHolderConnectOption::DontRegister => Arc::new(EdgeNode {
|
|
||||||
em: this,
|
|
||||||
address: SocketAddrV4::new(Ipv4Addr::UNSPECIFIED, 0),
|
|
||||||
}),
|
|
||||||
EdgeNodeHolderConnectOption::Register(socket_addr_v4) => {
|
|
||||||
let node = Arc::new(EdgeNode {
|
|
||||||
em: this.clone(),
|
|
||||||
address: *socket_addr_v4,
|
|
||||||
});
|
|
||||||
this.edge_nodes.write().await.push(Arc::downgrade(&node));
|
|
||||||
|
|
||||||
node
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl RnexModule for NodeHolderModule {
|
|
||||||
type Manager = NodeHolderManager;
|
|
||||||
type InitError = Infallible;
|
|
||||||
|
|
||||||
async fn create_manager(
|
|
||||||
_: &rnex_server::ModuleHolder,
|
|
||||||
) -> Result<Self::Manager, Self::InitError> {
|
|
||||||
Ok(NodeHolderManager::default())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "rnex-server-backend-node-holder"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2024"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
rnex-server = {path = ".."}
|
|
||||||
rnex-node-holder = {path = "../../rnex-server-nex-modules/rnex-node-holder"}
|
|
||||||
rnex-reggie-protos = { path = "../../rnex-protocols/reggie-protos" }
|
|
||||||
tokio = { version = "1.52.3", features = ["rt-multi-thread"] }
|
|
||||||
|
|
||||||
[features]
|
|
||||||
splatoon = ["v3-5-0"]
|
|
||||||
datastore = ["database-support", "v3-8-15"]
|
|
||||||
database-support = []
|
|
||||||
nx = []
|
|
||||||
third-notif-param = []
|
|
||||||
v3-3-2 = []
|
|
||||||
v3-4-0 = ["v3-3-2", "third-notif-param"]
|
|
||||||
v3-5-0 = ["v3-4-0"]
|
|
||||||
v3-8-13 = ["v3-5-0"]
|
|
||||||
v3-8-15 = ["v3-5-0"]
|
|
||||||
v3-10-22 = ["v3-8-15"]
|
|
||||||
v4-3-11 = ["v3-8-15"]
|
|
||||||
friends = []
|
|
||||||
rmc_struct_header = []
|
|
||||||
big_pid = []
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
use rnex_node_holder::NodeHolderModule;
|
|
||||||
use rnex_reggie_protos::reggie::EdgeNodeHolderConnectOption;
|
|
||||||
use rnex_server::launch_rnex_module_server;
|
|
||||||
|
|
||||||
#[tokio::main]
|
|
||||||
async fn main() {
|
|
||||||
launch_rnex_module_server! {
|
|
||||||
EdgeNodeHolderConnectOption;
|
|
||||||
NodeHolderModule
|
|
||||||
}
|
|
||||||
}
|
|
||||||
18
shell.nix
18
shell.nix
|
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
pkgs ? import <nixpkgs> { },
|
|
||||||
pkg ? pkgs.callPackage ./. { },
|
|
||||||
}:
|
|
||||||
pkgs.mkShell {
|
|
||||||
# Get dependencies from the main package
|
|
||||||
# inputsFrom = [ pkg ];
|
|
||||||
# Additional tooling
|
|
||||||
buildInputs = with pkgs; [
|
|
||||||
cargo
|
|
||||||
rust-analyzer # LSP Server
|
|
||||||
rustfmt # Formatter
|
|
||||||
clippy # Linter
|
|
||||||
podman
|
|
||||||
yq
|
|
||||||
jq
|
|
||||||
];
|
|
||||||
}
|
|
||||||
Loading…
Reference in a new issue