Skip to content

An online judge sandbox server in Rust, inspired by go-judge, for SAST OJ.

License

Notifications You must be signed in to change notification settings

NJUPT-SAST/rsjudge

Repository files navigation

rsjudge

Rsjudge logo

An online judge sandbox server in Rust, inspired by go-judge, for SASTOJ.

Features

  • Supports multiple programming languages, with easy way to add new ones in config file.

  • Support for multiple compiler versions — just use your favorite toolchain manager and set the path in config file.

  • Supporting both self-testing and final submission.

  • Customizable compilation and execution process with TOML config file.

  • Monitoring and limiting resource usage.

  • Works well with SASTOJ.

  • RESTful API, gRPC and RabbitMQ support, enable or disable them with feature flags or config file.

  • Streaming test results in real-time with SSE or gRPC stream.

  • Highly extensible with plugins.

  • Blazingly fast and secured with Rust🦀.

Repository structure

src/

Source of entry point, including CLI and configuration parsing.

xtask/

Extra tasks for building and packaging, invoked with cargo xtask <TASK>.

crates/

Sub-crates of the project.

crates/rsjudge-grpc/

Crate for gRPC server and client.

crates/rsjudge-judger/

Crate for answer comparing and judging.

crates/rsjudge-rest/

Crate for RESTful API server.

crates/rsjudge-runner/

Crate for sandbox logic.

packaging/

Files for generating .deb and .rpm package.

Repository structure visualized

Build from source

Prerequisites

  • Rust 1.74 or later,

  • Linux kernel >= 4.5,

    • Required for Seccomp BPF support.

  • For gRPC support (under grpc feature):

    • protoc >= 3.15,

    • buf for gRPC dependencies management.

  • For .deb package generation, a Debian/Ubuntu system with dpkg-dev and liblzma-dev installed.

Install dependencies

You can install Rust toolchain with rustup:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env

Debian/Ubuntu

  1. Install buf manually, if they are not available in the package manager.

  2. Ensure a protoc binary with version >= 3.15 is available in your PATH, or install it manually by downloading from the release page.

    • On Debian 12, Ubuntu 23.04 or later versions, you can install a compatible protoc with apt:

      sudo apt install -y protobuf-compiler libprotobuf-dev
  3. Install packaging related packages with apt:

    sudo apt install dpkg-dev liblzma-dev

Alpine

sudo apk add protoc protobuf-dev

# Installing buf
curl -sSL -o buf \
  "https://github.com/bufbuild/buf/releases/download/latest/buf-Linux-$(uname -m)"
# You can replace `/usr/local/bin` with your preferred directory,
# but remember to add it to `PATH`
sudo install -Dm755 buf /usr/local/bin/buf

Arch Linux

sudo pacman -S --needed protobuf buf

Build

Clone the repository:

git clone https://github.com/NJUPT-SAST/rsjudge.git
cd rsjudge

Build the project with Cargo:

cargo build --release

Generate .deb package:

cargo xtask dist deb

The .deb package will be generated in target/debian.

About

An online judge sandbox server in Rust, inspired by go-judge, for SAST OJ.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published