Skip to content
Closed
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d78ba32
cache value for default 30s to allow for mobile retries
SeverinAlexB Feb 2, 2026
33a917d
added link2 with shorter timeout
SeverinAlexB Feb 2, 2026
9f6e7d2
refactored
SeverinAlexB Feb 2, 2026
195e0e2
improved readme
SeverinAlexB Feb 2, 2026
9607fba
updated docs
SeverinAlexB Feb 2, 2026
441f31b
add security limits
SeverinAlexB Feb 2, 2026
e04995a
added some docs and id length limit
SeverinAlexB Feb 2, 2026
39a55d6
added github checks
SeverinAlexB Feb 2, 2026
57633f1
a few fixes
SeverinAlexB Feb 2, 2026
ff725d0
fmt
SeverinAlexB Feb 2, 2026
777bcff
dependency updates
SeverinAlexB Feb 2, 2026
d2e4a28
removed expect
SeverinAlexB Feb 2, 2026
0f91f65
added release file
SeverinAlexB Feb 2, 2026
6da7287
more release targets
SeverinAlexB Feb 2, 2026
50e0fba
added docker file
SeverinAlexB Feb 2, 2026
722c600
removed build on PR
SeverinAlexB Feb 2, 2026
faa9d4e
added badges to readme
SeverinAlexB Feb 2, 2026
119bfdd
bind to 127.0.0.1 by default
SeverinAlexB Feb 2, 2026
b55fdf7
fix license
SeverinAlexB Feb 3, 2026
816901a
improved test duration
SeverinAlexB Feb 3, 2026
96dc7c2
renamed request_timeout to link_timeout
SeverinAlexB Feb 3, 2026
3a6d208
increased cache cleanup time to 15s
SeverinAlexB Feb 3, 2026
4ab768c
added deprecation warning to /link/
SeverinAlexB Feb 3, 2026
aa4070b
fmt
SeverinAlexB Feb 3, 2026
ba1327e
added demo
SeverinAlexB Feb 3, 2026
53eb97e
made relay url configurable
SeverinAlexB Feb 3, 2026
26a23b2
fixed disconnect problem with two phase commit
SeverinAlexB Feb 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI

on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

env:
CARGO_TERM_COLOR: always

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo test

format:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --check

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy -- -D warnings
106 changes: 106 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Release

on:
push:
tags: ['v*']

env:
CARGO_TERM_COLOR: always

jobs:
build:
name: Build ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
name: linux-x64
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
name: linux-x64-musl
musl: true
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
name: linux-arm64
cross: true
- target: x86_64-apple-darwin
os: macos-latest
name: macos-x64
- target: aarch64-apple-darwin
os: macos-latest
name: macos-arm64
- target: x86_64-pc-windows-msvc
os: windows-latest
name: windows-x64
- target: aarch64-pc-windows-msvc
os: windows-latest
name: windows-arm64

steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}

- name: Install musl-tools
if: matrix.musl
run: sudo apt-get update && sudo apt-get install -y musl-tools

- name: Install cross-compiler (Linux ARM)
if: matrix.cross
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV

- name: Build
run: cargo build --release --target ${{ matrix.target }}

- name: Package (Unix)
if: matrix.os != 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
tar -czvf ../../../http-relay-${{ matrix.name }}.tar.gz http-relay

- name: Package (Windows)
if: matrix.os == 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
7z a ../../../http-relay-${{ matrix.name }}.zip http-relay.exe

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: http-relay-${{ matrix.name }}
path: http-relay-${{ matrix.name }}.*

release:
name: Create Release
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write

steps:
- uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true

- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/*
generate_release_notes: true
31 changes: 19 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
[package]
name = "http-relay"
description = "A Rust implementation of _some_ of [Http relay spec](https://httprelay.io/)."
version = "0.5.1"
version = "0.6.0"
edition = "2021"
authors = ["SeverinAlexB", "SHAcollision", "Nuh"]
authors = ["SeverinAlexB"]
license = "MIT"
homepage = "https://github.com/pubky/pubky-http-relay"
repository = "https://github.com/pubky/pubky-http-relay"
homepage = "https://github.com/pubky/http-relay"
repository = "https://github.com/pubky/http-relay"
keywords = ["httprelay", "http", "relay"]
categories = ["web-programming"]

[dependencies]
anyhow = "1.0.99"
axum = "0.8.6"
axum-server = "0.7.2"
anyhow = "1.0.100"
axum = "0.8.8"
axum-server = "0.8.0"
clap = { version = "4", features = ["derive"] }
futures-util = "0.3.31"
tokio = { version = "1.47.1", features = ["full"] }
tracing = "0.1.41"
url = "2.5.4"
tower-http = { version = "0.6.6", features = ["cors", "trace"] }
lru = "0.16.3"
tokio = { version = "1.49.0", features = ["full"] }
tracing = "0.1.44"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
url = "2.5.8"
tower-http = { version = "0.6.8", features = ["cors", "trace"] }

[[bin]]
name = "http-relay"
path = "src/main.rs"

[dev-dependencies]
axum-test = "17.3.0"
axum-test = "18.7.0"
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM rust:1.84-alpine AS builder

RUN apk add --no-cache musl-dev

WORKDIR /app
COPY Cargo.toml Cargo.lock ./
COPY src ./src

RUN cargo build --release

FROM scratch

COPY --from=builder /app/target/release/http-relay /http-relay

EXPOSE 8080

ENTRYPOINT ["/http-relay"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Synonym

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading