Skip to content

Commit

Permalink
enhance workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
scrayos committed Jan 29, 2024
1 parent 5bf3e4d commit 02943c3
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 32 deletions.
29 changes: 28 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ indent_style = space
ij_smart_tabs = false

# provide the visual guide and hard wrap, so we don't write overly long lines (but don't wrap automatically)
max_line_length = 100
max_line_length = 120
ij_visual_guides = 100
ij_wrap_on_typing = false

# the final newline helps with old/unix tools so that they can properly print files
Expand Down Expand Up @@ -90,3 +91,29 @@ ij_markdown_max_lines_around_block_elements = 1
# headers have exactly one newline around them to increase the readability
ij_markdown_min_lines_around_header = 1
ij_markdown_max_lines_around_header = 1

[*.rs]
max_line_length = 100
ij_continuation_indent_size = 4
ij_rust_align_multiline_chained_methods = false
ij_rust_align_multiline_parameters = true
ij_rust_align_multiline_parameters_in_calls = true
ij_rust_align_ret_type = true
ij_rust_align_type_params = false
ij_rust_align_where_bounds = true
ij_rust_align_where_clause = false
ij_rust_allow_one_line_match = false
ij_rust_block_comment_at_first_column = false
ij_rust_indent_where_clause = true
ij_rust_keep_blank_lines_in_code = 2
ij_rust_keep_blank_lines_in_declarations = 2
ij_rust_keep_indents_on_empty_lines = false
ij_rust_keep_line_breaks = true
ij_rust_line_comment_add_space = true
ij_rust_line_comment_at_first_column = false
ij_rust_min_number_of_blanks_between_items = 1
ij_rust_preserve_punctuation = false
ij_rust_spaces_around_assoc_type_binding = false

[{*.toml,Cargo.lock,Cargo.toml.orig,Gopkg.lock,Pipfile,poetry.lock}]
ij_toml_keep_indents_on_empty_lines = false
1 change: 0 additions & 1 deletion .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ jobs:
uses: docker/scout-action@v1
with:
command: cves
image: ${{ steps.meta.outputs.tags }}
sarif-file: sarif.output.json
exit-code: true
summary: true
Expand Down
14 changes: 0 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
### Remix+CloudflareWorkers template
/dist
/.mf

### 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
Expand Down Expand Up @@ -102,13 +98,3 @@ Cargo.lock

# Compiled resources
build/

### PNPM template

# Node modules
node_modules/

### Wrangler template

# Wrangler Temp
.wrangler/
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
![The official Logo of Xenos](.github/images/logo.png "Xenos")

![A visual badge for the latest release](https://img.shields.io/github/v/release/scrayosnet/xenos "Latest Release")
![A visual badge for the code quality](https://img.shields.io/scrutinizer/quality/g/scrayosnet/xenos "Code Quality")
![A visual badge for the coverage](https://img.shields.io/scrutinizer/coverage/g/scrayosnet/xenos "Coverage")
![A visual badge for the workflow status](https://img.shields.io/github/actions/workflow/status/scrayosnet/xenos/docker.yaml "Workflow Status")
![A visual badge for the dependency status](https://img.shields.io/librariesio/github/scrayosnet/xenos "Dependencies")
![A visual badge for the Docker image size](https://img.shields.io/docker/image-size/scrayosug/xenos "Image Size")
![A visual badge for the license](https://img.shields.io/github/license/scrayosnet/xenos "License")

Xenos is a Minecraft profile data proxy that can be used as an ultra-fast replacement for the
Expand All @@ -23,12 +24,22 @@ like [MineTools][minetools-docs], Xenos introduces little to no additional laten
latency-optimized responses to communicate with the services. It is meant to completely replace any kind of internal
caching and always use the API instead for inter process communication.

The differences between Xenos and serverless solutions like [Crafthead][crafthead-docs] are, that Xenos is deployed on
your own infrastructure to minimize latency, Xenos uses your own IPs regarding the rate-limit and you'll have more
over what requests are performed, that Xenos is based on gRPC to cut down API response times even further and that
Xenos will always try to return a value, even if only outdated data is available.

Therefore, Xenos is a reliable service, offering high-availability for Mojang API calls. It offers all the standard
Mojang APIs and will even be able to proxy authentication requests in the future.

## Major Features

* Perform [HTTP REST][rest-docs] lookups for profile information.
* Perform [gRPC][grpc-docs] and [HTTP REST][rest-docs] lookups for profile information.
* Do not worry about rate limits or caching at all! [^1]
* Get best-in-class caching inbuilt and always request Xenos with very low latency.
* Set Xenos up with replication, to get high availability.
* Supply data in any representation without converting it first (dashed vs non-dashed UUIDs).
* Fall back to retrieving cached data, if the Mojang API is currently not available.
* Store resolved information to allow for grace periods for the resolution between name changes!

## Getting started
Expand Down Expand Up @@ -62,6 +73,8 @@ on what that means.

[minetools-docs]: https://api.minetools.eu/

[crafthead-docs]: https://crafthead.net/

[grpc-docs]: https://grpc.io/

[rest-docs]: https://en.wikipedia.org/wiki/Representational_state_transfer
Expand Down
20 changes: 10 additions & 10 deletions proto/service.proto
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
syntax = "proto3";

package grpc.service;
package scrayosnet.xenos;

service Xenos {
rpc Uuids(UuidRequest) returns (UuidResponse);
rpc Profile(ProfileRequest) returns (ProfileResponse);
rpc Skin(SkinRequest) returns (SkinResponse);
rpc Head(HeadRequest) returns (HeadResponse);
}

message UuidRequest {
repeated string usernames = 1;
}

message UuidResolved {
message UuidResult {
uint64 timestamp = 1; // in seconds
string username = 2;
string uuid = 3;
}

message UuidResponse {
repeated UuidResolved resolved = 1;
repeated UuidResult resolved = 1;
}

message ProfileRequest {
Expand Down Expand Up @@ -51,10 +58,3 @@ message HeadResponse {
uint64 timestamp = 1; // in seconds
bytes data = 2;
}

service Xenos {
rpc Uuids(UuidRequest) returns (UuidResponse) {}
rpc Profile(ProfileRequest) returns (ProfileResponse) {}
rpc Skin(SkinRequest) returns (SkinResponse) {}
rpc Head(HeadRequest) returns (HeadResponse) {}
}
6 changes: 3 additions & 3 deletions src/service.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pub mod pb {
tonic::include_proto!("grpc.service");
tonic::include_proto!("scrayosnet.xenos");
}

use crate::cache;
Expand All @@ -15,7 +15,7 @@ use crate::util::{get_epoch_seconds, has_elapsed};
use image::{imageops, ColorType, GenericImageView, ImageOutputFormat};
use lazy_static::lazy_static;
use pb::xenos_server::Xenos;
use pb::{UuidRequest, UuidResolved, UuidResponse};
use pb::{UuidRequest, UuidResult, UuidResponse};
use regex::Regex;
use reqwest::StatusCode;
use std::collections::HashMap;
Expand Down Expand Up @@ -265,7 +265,7 @@ impl Xenos for XenosService {

let resolved = uuids
.into_iter()
.map(|entry| UuidResolved {
.map(|entry| UuidResult {
timestamp: entry.timestamp,
username: entry.username,
uuid: entry.uuid.simple().to_string(),
Expand Down

0 comments on commit 02943c3

Please sign in to comment.