feat: support ipv6, close #16513

This commit is contained in:
DIYgod 2024-08-26 16:52:35 +08:00
parent ef6448645e
commit 49df5559a1
No known key found for this signature in database
2 changed files with 2 additions and 1 deletions

View File

@ -18,7 +18,7 @@ if (config.listenInaddrAny) {
const server = serve({
fetch: app.fetch,
hostname: config.listenInaddrAny ? undefined : '127.0.0.1',
hostname: config.listenInaddrAny ? '::' : '127.0.0.1',
port,
});

View File

@ -39,6 +39,7 @@ const getLocalhostAddress = () => {
.filter((iface) => iface?.family === 'IPv4' && !iface.internal)
.map((iface) => iface?.address)
.filter(Boolean);
address.push('[::]');
return address;
};