raiton 6.8.3-beta.19 → 6.8.6-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [6.8.6-beta.21](https://github.com/protorians/raiton/compare/v6.8.3-beta.19...v6.8.6-beta.21) (2026-10-22)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* fix:version ([3d9f1bf](https://github.com/protorians/raiton/commit/3d9f1bf1f64e58e729aa92696bc7a3868c621fdd))
|
|
6
|
+
* chore(release): v6.8.4-beta.20 [skip ci] ([3c6074e](https://github.com/protorians/raiton/commit/3c6074e47a6d399f67eebc624fc13275f88b5403))
|
|
7
|
+
* fix(framework): détecte la véritable adresse LAN du serveur ([c5583a6](https://github.com/protorians/raiton/commit/c5583a6b5083280a9c5fe9fa015286c7085a9453))
|
|
8
|
+
|
|
9
|
+
## [6.8.4-beta.20](https://github.com/protorians/raiton/compare/v6.8.3-beta.19...v6.8.4-beta.20) (2026-10-22)
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* fix(framework): détecte la véritable adresse LAN du serveur ([c5583a6](https://github.com/protorians/raiton/commit/c5583a6b5083280a9c5fe9fa015286c7085a9453))
|
|
14
|
+
|
|
1
15
|
## [6.8.3-beta.19](https://github.com/protorians/raiton/compare/v6.8.2-beta.18...v6.8.3-beta.19) (2026-10-10)
|
|
2
16
|
|
|
3
17
|
### Bug Fixes
|
package/build/bin/index.mjs
CHANGED
|
@@ -24827,9 +24827,37 @@ var init_constants2 = __esm(() => {
|
|
|
24827
24827
|
isNodeUsed = !isBunUsed && !isDenoUsed;
|
|
24828
24828
|
});
|
|
24829
24829
|
|
|
24830
|
-
// source/
|
|
24831
|
-
import os from "os";
|
|
24830
|
+
// source/framework/utilities/ip.util.ts
|
|
24831
|
+
import os from "node:os";
|
|
24832
|
+
var getRealIp = (headers, remoteAddress) => {
|
|
24833
|
+
const forwardedFor = headers.get("x-forwarded-for");
|
|
24834
|
+
if (forwardedFor) {
|
|
24835
|
+
return forwardedFor.split(",")[0].trim();
|
|
24836
|
+
}
|
|
24837
|
+
return headers.get("x-real-ip") || remoteAddress;
|
|
24838
|
+
}, getLanIp = () => {
|
|
24839
|
+
const candidates = [];
|
|
24840
|
+
for (const [name, addrs] of Object.entries(os.networkInterfaces())) {
|
|
24841
|
+
for (const addr of addrs || []) {
|
|
24842
|
+
if (addr.family !== "IPv4" || addr.internal)
|
|
24843
|
+
continue;
|
|
24844
|
+
if (addr.address.startsWith("169.254."))
|
|
24845
|
+
continue;
|
|
24846
|
+
let score = 0;
|
|
24847
|
+
if (/^(?:10\.|192\.168\.|172\.(?:1[6-9]|2\d|3[01])\.)/.test(addr.address))
|
|
24848
|
+
score += 4;
|
|
24849
|
+
if (/^(utun|awdl|llw|bridge|vmnet|docker|veth|tun|tap|ppp)/.test(name))
|
|
24850
|
+
score -= 2;
|
|
24851
|
+
if (/^(en|eth|wlan)/.test(name))
|
|
24852
|
+
score += 1;
|
|
24853
|
+
candidates.push({ name, address: addr.address, score });
|
|
24854
|
+
}
|
|
24855
|
+
}
|
|
24856
|
+
return candidates.sort((a, b) => b.score - a.score)[0]?.address;
|
|
24857
|
+
};
|
|
24858
|
+
var init_ip_util = () => {};
|
|
24832
24859
|
|
|
24860
|
+
// source/core/thread.ts
|
|
24833
24861
|
class RaitonThread {
|
|
24834
24862
|
builder;
|
|
24835
24863
|
_options;
|
|
@@ -24876,15 +24904,7 @@ class RaitonThread {
|
|
|
24876
24904
|
return await until(condition);
|
|
24877
24905
|
}
|
|
24878
24906
|
getNetworkIp() {
|
|
24879
|
-
|
|
24880
|
-
for (const name of Object.keys(interfaces)) {
|
|
24881
|
-
for (const iface of interfaces[name] || []) {
|
|
24882
|
-
if (iface.family === "IPv4" && !iface.internal) {
|
|
24883
|
-
return iface.address;
|
|
24884
|
-
}
|
|
24885
|
-
}
|
|
24886
|
-
}
|
|
24887
|
-
return null;
|
|
24907
|
+
return getLanIp() ?? null;
|
|
24888
24908
|
}
|
|
24889
24909
|
setup({ application, runtime }) {
|
|
24890
24910
|
const defaultRuntime = isBunUsed ? "bun" /* Bun */ : isDenoUsed ? "deno" /* Deno */ : "node" /* Node */;
|
|
@@ -24957,6 +24977,7 @@ var init_thread = __esm(() => {
|
|
|
24957
24977
|
init_injection();
|
|
24958
24978
|
init_exceptions();
|
|
24959
24979
|
init_constants2();
|
|
24980
|
+
init_ip_util();
|
|
24960
24981
|
});
|
|
24961
24982
|
|
|
24962
24983
|
// source/framework/mcp/protocol.ts
|
|
@@ -26754,17 +26775,10 @@ var init_openapi_utils = __esm(() => {
|
|
|
26754
26775
|
init_thread();
|
|
26755
26776
|
});
|
|
26756
26777
|
|
|
26757
|
-
// source/framework/utilities/ip.util.ts
|
|
26758
|
-
var getRealIp = (headers, remoteAddress) => {
|
|
26759
|
-
const forwardedFor = headers.get("x-forwarded-for");
|
|
26760
|
-
if (forwardedFor) {
|
|
26761
|
-
return forwardedFor.split(",")[0].trim();
|
|
26762
|
-
}
|
|
26763
|
-
return headers.get("x-real-ip") || remoteAddress;
|
|
26764
|
-
};
|
|
26765
|
-
|
|
26766
26778
|
// source/framework/utilities/https.util.ts
|
|
26767
|
-
var init_https_util = () => {
|
|
26779
|
+
var init_https_util = __esm(() => {
|
|
26780
|
+
init_ip_util();
|
|
26781
|
+
});
|
|
26768
26782
|
|
|
26769
26783
|
// source/framework/utilities/index.ts
|
|
26770
26784
|
var init_utilities = __esm(() => {
|
|
@@ -26772,6 +26786,7 @@ var init_utilities = __esm(() => {
|
|
|
26772
26786
|
init_json_util();
|
|
26773
26787
|
init_path_util();
|
|
26774
26788
|
init_openapi_utils();
|
|
26789
|
+
init_ip_util();
|
|
26775
26790
|
init_https_util();
|
|
26776
26791
|
init_csrf_util();
|
|
26777
26792
|
});
|
|
@@ -30082,7 +30097,7 @@ var {
|
|
|
30082
30097
|
// package.json
|
|
30083
30098
|
var package_default = {
|
|
30084
30099
|
name: "raiton",
|
|
30085
|
-
version: "6.8.
|
|
30100
|
+
version: "6.8.6-beta.21",
|
|
30086
30101
|
private: false,
|
|
30087
30102
|
type: "module",
|
|
30088
30103
|
description: "Modular TypeScript Backend Framework with Dependency Injection, Plugins, Controllers, Middleware and Hot Reloading",
|
package/package.json
CHANGED
package/source/core/thread.ts
CHANGED
|
@@ -21,7 +21,7 @@ import {bodyParserPlugin} from "../framework/plugins/body-parser.plugin.ts";
|
|
|
21
21
|
import {Injection} from "./injection/injection.ts";
|
|
22
22
|
import {Throwable} from "../framework/exceptions/index.ts";
|
|
23
23
|
import {isBunUsed, isDenoUsed, isNodeUsed} from "../bin/constants.ts";
|
|
24
|
-
import
|
|
24
|
+
import {getLanIp} from "../framework/utilities/ip.util.ts";
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
export class RaitonThread implements ThreadInterface {
|
|
@@ -80,15 +80,7 @@ export class RaitonThread implements ThreadInterface {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
protected getNetworkIp(): string | null {
|
|
83
|
-
|
|
84
|
-
for (const name of Object.keys(interfaces)) {
|
|
85
|
-
for (const iface of interfaces[name] || []) {
|
|
86
|
-
if (iface.family === 'IPv4' && !iface.internal) {
|
|
87
|
-
return iface.address;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return null;
|
|
83
|
+
return getLanIp() ?? null;
|
|
92
84
|
}
|
|
93
85
|
|
|
94
86
|
public setup({application, runtime}: ThreadSetupOptionsInterface): this {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs'
|
|
2
|
-
import os from 'node:os'
|
|
3
2
|
import {execSync, execFileSync} from 'node:child_process'
|
|
4
3
|
import path from 'node:path'
|
|
4
|
+
import {getLanIp} from './ip.util.ts'
|
|
5
5
|
|
|
6
6
|
export enum HttpsEnvironment {
|
|
7
7
|
Localhost = 'localhost',
|
|
@@ -77,15 +77,7 @@ function resolveCertFromPaths(
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
function getLanHostname(): string {
|
|
80
|
-
|
|
81
|
-
for (const name of Object.keys(interfaces)) {
|
|
82
|
-
for (const iface of interfaces[name] || []) {
|
|
83
|
-
if (iface.family === 'IPv4' && !iface.internal) {
|
|
84
|
-
return iface.address
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return 'localhost'
|
|
80
|
+
return getLanIp() ?? 'localhost'
|
|
89
81
|
}
|
|
90
82
|
|
|
91
83
|
function isCommandAvailable(command: string): boolean {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import os from 'node:os'
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Get the real IP address from headers or remote address
|
|
3
5
|
* @param headers
|
|
@@ -10,3 +12,35 @@ export const getRealIp = (headers: Headers, remoteAddress?: string): string | un
|
|
|
10
12
|
}
|
|
11
13
|
return headers.get('x-real-ip') || remoteAddress;
|
|
12
14
|
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Get the server's LAN IPv4 address.
|
|
18
|
+
*
|
|
19
|
+
* Prefers private (RFC1918) addresses on physical adapters and skips
|
|
20
|
+
* link-local (169.254.0.0/16) addresses exposed by interfaces without
|
|
21
|
+
* DHCP (en9, awdl0, llw0, utun*, bridges...) so that the first address
|
|
22
|
+
* found is the real one.
|
|
23
|
+
*/
|
|
24
|
+
export const getLanIp = (): string | undefined => {
|
|
25
|
+
const candidates: {name: string; address: string; score: number}[] = [];
|
|
26
|
+
|
|
27
|
+
for (const [name, addrs] of Object.entries(os.networkInterfaces())) {
|
|
28
|
+
for (const addr of addrs || []) {
|
|
29
|
+
if (addr.family !== 'IPv4' || addr.internal) continue;
|
|
30
|
+
// Skip link-local (APIPA) addresses: interfaces without DHCP
|
|
31
|
+
if (addr.address.startsWith('169.254.')) continue;
|
|
32
|
+
|
|
33
|
+
let score = 0;
|
|
34
|
+
// Prefer private (RFC1918) ranges: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
|
|
35
|
+
if (/^(?:10\.|192\.168\.|172\.(?:1[6-9]|2\d|3[01])\.)/.test(addr.address)) score += 4;
|
|
36
|
+
// Deprioritize well-known virtual interfaces
|
|
37
|
+
if (/^(utun|awdl|llw|bridge|vmnet|docker|veth|tun|tap|ppp)/.test(name)) score -= 2;
|
|
38
|
+
// Slightly prefer physical adapters (macOS en*, Linux eth/wlan)
|
|
39
|
+
if (/^(en|eth|wlan)/.test(name)) score += 1;
|
|
40
|
+
|
|
41
|
+
candidates.push({name, address: addr.address, score});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return candidates.sort((a, b) => b.score - a.score)[0]?.address;
|
|
46
|
+
}
|