#hyper #hyper-server #bin #nbt #lowest #auction #metrics

nightly bin+lib lowestbins

Lowestbins 以 Rust 编写,以实现最大效率

5 个稳定版本

1.4.1 2022年11月3日
1.3.3 2022年10月19日
1.3.2 2022年10月8日
1.3.1 2022年10月7日
1.3.0 2022年9月29日

#1568 in 命令行工具

Apache-2.0

3MB
710 代码行

Logo

GitHub issues GitHub forks GitHub stars GitHub license Website Discord GitHub Sponsors

forthebadge forthebadge

Lowestbins-rs

A fast and efficient Lowestbins implementation that uses parallel requests to fetch all Lowestbins in less than 2.5 SECONDS and uses the hyper server allowing for practically unlimited requests per second while only using 50mb of ram!
Lowestbins-rs is used by Skytils for the Lowestbins feature.

托管实例

If you are using this in a project, please credit me! or sponsor me on github github.com/sponsors/Tricked-dev

在您的代码中使用

JavaScript

node

const fetch = require("undici"); // node-fetch also works
let json = await fetch("https://lb.tricked.pro/lowestbins").then((res) =>
  res.json()
);

console.log(json["ENCHANTMENT_ULTIMATE_SWARM_2"]);

web/deno

let json = await fetch("https://lb.tricked.pro/lowestbins").then((res) =>
  res.json()
);
console.log(json["ENCHANTMENT_ULTIMATE_SWARM_2"]);

Python

import requests
json = requests.get("https://lb.tricked.pro/lowestbins").json()
print(json["ENCHANTMENT_ULTIMATE_SWARM_2"])

API 端点

/lowestbins | /lowestbins.json | /auctions/lowestbins

Returns a json object with all lowestbins

/lowestbins.txt

Returns a text file with all lowestbins easier to parse and smaller in size

/auction/{item} | lowestbin/{item}

Returns the price of a item as number this endpoint can be used to get more up to date prices due to it not being cached as often

/metrics

Returns prometheus metrics of the prices

/

Returns basic data about the api and update time

使用方法

Docker

docker run  --name lowestbins -p 8080:8080 -e HOST=0.0.0.0 -e UPDATE_SECONDS=120 -d ghcr.io/tricked-dev/lowestbins:latest

构建

  • If you're on Linux, you can go to releases and download the binary
  • Windows/MacOS: you need to install cargo and run cargo build --release and the exe/binary should be in the ./target/release/lowestbins.

配置选项

环境变量

PORT # The port to run the server on
HOST # The host to run the server on
SAVE_TO_DISK # set to 0 to not save the auctions to disk
OVERWRITES # Overwrite values format: `BLESSED_BAIT:200,ROCK_CANDY:6000,NON_EXISTENT_ITEM:200`
UPDATE_SECONDS # The amount of seconds to wait before updating the lowestbins
WEBHOOK_URL # The webhook url used for reporting the requests (discord/discord compatible)
RUST_LOG # The log level lowestbins=debug recommended

特性

  • NBT 解析
  • 获取拍卖并返回最低拍卖价
  • hyper 服务器
  • 与 skytils 兼容
  • metrics 端点 /metrics
  • rust

待办事项

  • 使用 quiche 以实现更快的请求
  • 使用 cargo pgo 优化二进制文件

本软件遵循Apache 2许可证

依赖项

~32–45MB
~843K SLoC