Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM node:22-alpine AS build
FROM node:24.11-alpine AS build
WORKDIR /opt/app
ADD . .
RUN npm ci --legacy-peer-deps
RUN npm run build --omit=dev


FROM node:22-alpine
FROM node:24.11-alpine

ARG XRAY_CORE_VERSION=v25.10.15
ARG UPSTREAM_REPO=XTLS
Expand Down Expand Up @@ -47,6 +47,8 @@ RUN npm ci --omit=dev --legacy-peer-deps \
&& npm cache clean --force


RUN ln -s /usr/local/bin/xray /usr/local/bin/rw-core

ENV NODE_ENV=production
ENV NODE_OPTIONS="--max-http-header-size=65536"

Expand Down
6 changes: 5 additions & 1 deletion docker-compose-prod.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
services:
remnanode:
image: remnawave/node:latest
container_name: remnanode
hostname: remnanode
image: remnawave/node:latest
network_mode: host
restart: always
ulimits:
nofile:
soft: 1048576
hard: 1048576
environment:
- NODE_PORT=2222
- SECRET_KEY=""
2 changes: 1 addition & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ supervisord -c /etc/supervisord.conf &
echo "[Entrypoint] Supervisord started successfully"
sleep 1
echo "[Entrypoint] Getting Xray version..."
XRAY_CORE_VERSION=$(/usr/local/bin/xray version | head -n 1)
XRAY_CORE_VERSION=$(/usr/local/bin/rw-core version | head -n 1)
export XRAY_CORE_VERSION
echo "[Entrypoint] Xray version: $XRAY_CORE_VERSION"

Expand Down
2 changes: 2 additions & 0 deletions libs/contract/api/controllers/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ export const STATS_ROUTES = {

GET_ALL_OUTBOUNDS_STATS: 'get-all-outbounds-stats',
GET_ALL_INBOUNDS_STATS: 'get-all-inbounds-stats',

GET_COMBINED_STATS: 'get-combined-stats',
} as const;
1 change: 1 addition & 0 deletions libs/contract/api/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const REST_API = {
GET_OUTBOUND_STATS: `${ROOT}/${CONTROLLERS.STATS_CONTROLLER}/${CONTROLLERS.STATS_ROUTES.GET_OUTBOUND_STATS}`,
GET_ALL_OUTBOUNDS_STATS: `${ROOT}/${CONTROLLERS.STATS_CONTROLLER}/${CONTROLLERS.STATS_ROUTES.GET_ALL_OUTBOUNDS_STATS}`,
GET_ALL_INBOUNDS_STATS: `${ROOT}/${CONTROLLERS.STATS_CONTROLLER}/${CONTROLLERS.STATS_ROUTES.GET_ALL_INBOUNDS_STATS}`,
GET_COMBINED_STATS: `${ROOT}/${CONTROLLERS.STATS_CONTROLLER}/${CONTROLLERS.STATS_ROUTES.GET_COMBINED_STATS}`,
},
HANDLER: {
ADD_USER: `${ROOT}/${CONTROLLERS.HANDLER_CONTROLLER}/${CONTROLLERS.HANDLER_ROUTES.ADD_USER}`,
Expand Down
24 changes: 0 additions & 24 deletions libs/contract/commands/handler/add-user.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export namespace AddUserCommand {
tag: z.string(),
username: z.string(),
password: z.string(),
level: z.number().default(0),
});

const BaseVlessUser = z.object({
Expand All @@ -29,7 +28,6 @@ export namespace AddUserCommand {
username: z.string(),
uuid: z.string(),
flow: z.enum(['xtls-rprx-vision', '']),
level: z.number().default(0),
});

const BaseShadowsocksUser = z.object({
Expand All @@ -39,33 +37,13 @@ export namespace AddUserCommand {
password: z.string(),
cipherType: z.nativeEnum(CipherType),
ivCheck: z.boolean(),
level: z.number().default(0),
});

const BaseShadowsocks2022User = z.object({
type: z.literal('shadowsocks2022'),
tag: z.string(),
username: z.string(),
key: z.string(),
level: z.number().default(0),
});

const BaseSocksUser = z.object({
type: z.literal('socks'),
tag: z.string(),
username: z.string(),
socks_username: z.string(),
socks_password: z.string(),
level: z.number().default(0),
});

const BaseHttpUser = z.object({
type: z.literal('http'),
tag: z.string(),
username: z.string(),
http_username: z.string(),
http_password: z.string(),
level: z.number().default(0),
});

export const RequestSchema = z.object({
Expand All @@ -75,8 +53,6 @@ export namespace AddUserCommand {
BaseVlessUser,
BaseShadowsocksUser,
BaseShadowsocks2022User,
BaseSocksUser,
BaseHttpUser,
]),
),
hashData: z.object({
Expand Down
33 changes: 33 additions & 0 deletions libs/contract/commands/stats/get-combined-stats.command.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { z } from 'zod';

import { REST_API } from '../../api';
export namespace GetCombinedStatsCommand {
export const url = REST_API.STATS.GET_COMBINED_STATS;

export const RequestSchema = z.object({
reset: z.boolean(),
});

export type Request = z.infer<typeof RequestSchema>;

export const ResponseSchema = z.object({
response: z.object({
inbounds: z.array(
z.object({
inbound: z.string(),
downlink: z.number(),
uplink: z.number(),
}),
),
outbounds: z.array(
z.object({
outbound: z.string(),
downlink: z.number(),
uplink: z.number(),
}),
),
}),
});

export type Response = z.infer<typeof ResponseSchema>;
}
1 change: 1 addition & 0 deletions libs/contract/commands/stats/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from './get-all-inbounds-stats.command';
export * from './get-all-outbounds-stats.command';
export * from './get-combined-stats.command';
export * from './get-inbound-stats.command';
export * from './get-outbound-stats.command';
export * from './get-system-stats.command';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export namespace GetNodeHealthCheckCommand {
isAlive: z.boolean(),
xrayInternalStatusCached: z.boolean(),
xrayVersion: z.string().nullable(),
nodeVersion: z.string(),
}),
});

Expand Down
17 changes: 16 additions & 1 deletion libs/contract/commands/xray/start.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,22 @@ import { z } from 'zod';
import { REST_API } from '../../api';
export namespace StartXrayCommand {
export const url = REST_API.XRAY.START;
export const RequestSchema = z.record(z.unknown());
export const RequestSchema = z.object({
internals: z.object({
forceRestart: z.boolean().default(false),
hashes: z.object({
emptyConfig: z.string(),
inbounds: z.array(
z.object({
usersCount: z.number(),
hash: z.string(),
tag: z.string(),
}),
),
}),
}),
xrayConfig: z.record(z.unknown()),
});

export type Request = z.infer<typeof RequestSchema>;

Expand Down
5 changes: 5 additions & 0 deletions libs/contract/constants/errors/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,9 @@ export const ERRORS = {
message: 'Failed to get outbounds stats',
httpCode: 500,
},
FAILED_TO_GET_COMBINED_STATS: {
code: 'A017',
message: 'Failed to get combined stats',
httpCode: 500,
},
} as const;
8 changes: 0 additions & 8 deletions libs/contract/constants/hashes/hash-payload.ts

This file was deleted.

1 change: 0 additions & 1 deletion libs/contract/constants/hashes/index.ts

This file was deleted.

2 changes: 0 additions & 2 deletions libs/contract/constants/headers/headers.contants.ts

This file was deleted.

1 change: 0 additions & 1 deletion libs/contract/constants/headers/index.ts

This file was deleted.

2 changes: 0 additions & 2 deletions libs/contract/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
export * from './errors';
export * from './hashes';
export * from './headers';
export * from './internal';
export * from './roles';
export * from './xray';
1 change: 0 additions & 1 deletion libs/contract/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './api';
export * from './commands';
export * from './constants';
export * from './models';
5 changes: 0 additions & 5 deletions libs/contract/models/auth.schema.ts

This file was deleted.

1 change: 0 additions & 1 deletion libs/contract/models/index.ts

This file was deleted.

4 changes: 2 additions & 2 deletions libs/contract/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@remnawave/node-contract",
"version": "0.5.9",
"version": "0.6.1",
"description": "A node-contract library for Remnawave Panel",
"main": "build/index.js",
"types": "build/index.d.ts",
Expand All @@ -23,6 +23,6 @@
},
"license": "AGPL-3.0-only",
"dependencies": {
"zod": "^3.22.4"
"zod": "^3.25.76"
}
}
Loading