[PR #3212] [CLOSED] [Other] serve: support IPv6 bind addresses #4501

Closed
opened 2026-11-07 15:36:29 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3212
Author: @purrsec
Created: 10/19/2026
Status: ❌ Closed

Base: main ← Head: fix/ipv6-listen


📝 Commits (1)

  • 7aea86c serve: support IPv6 bind addresses

📊 Changes

6 files changed (+59 additions, -10 deletions)

View changed files

📝 README.fr.md (+2 -0)
📝 README.md (+2 -0)
📝 docs/DETAILS.md (+2 -0)
📝 serve/server.py (+11 -5)
📝 serve/test_security.py (+37 -1)
📝 setup.py (+5 -4)

📄 Description

Problem and result

Starting Strata with an IPv6 bind address such as --host :: failed before model loading because the HTTP server always used an IPv4 socket. Server now selects AF_INET6 when the bind address is an IPv6 literal, binds ::, serves requests through ::1, and formats IPv6 URLs with brackets. IPv4 behavior remains unchanged.

Supersedes closed PR #1326: https://github.com/Niko1221/Strata/pull/1326

Approach

Set self.address_family = socket.AF_INET6 directly in Server.__init__ when the bind address contains :, so both the startup preflight check and the running server use the right socket family without extra wrapper classes. Advertise the loopback URL as [::1] for --host ::, bracket IPv6 literals in printed URLs, and document the IPv6 option. No default or authentication behavior changes; an API key remains required when listening beyond loopback.

Validation

Passed:

  • python3 -m py_compile serve/server.py serve/test_security.py setup.py at 7aea86c1 on macOS.
  • python3 -m unittest serve.test_security -v: 28 tests passed, including Server address family selection and a real :: bind and /health request through ::1.
  • git diff --check origin/main...HEAD: passed.

Not run:

  • CUDA, HIP, SYCL and Metal builds; this change only touches the Python server, setup help, tests and documentation.

Limits

IPv6 support depends on the host OS having IPv6 enabled. Listening beyond loopback still requires an API key in normal startup.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/3212 **Author:** [@purrsec](https://github.com/purrsec) **Created:** 10/19/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/ipv6-listen` --- ### 📝 Commits (1) - [`7aea86c`](https://github.com/Niko1221/Strata/commit/7aea86c1adab6e9dacf1bafdf26e33664b13656b) serve: support IPv6 bind addresses ### 📊 Changes **6 files changed** (+59 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `README.fr.md` (+2 -0) 📝 `README.md` (+2 -0) 📝 `docs/DETAILS.md` (+2 -0) 📝 `serve/server.py` (+11 -5) 📝 `serve/test_security.py` (+37 -1) 📝 `setup.py` (+5 -4) </details> ### 📄 Description ## Problem and result Starting Strata with an IPv6 bind address such as `--host ::` failed before model loading because the HTTP server always used an IPv4 socket. `Server` now selects `AF_INET6` when the bind address is an IPv6 literal, binds `::`, serves requests through `::1`, and formats IPv6 URLs with brackets. IPv4 behavior remains unchanged. ## Related discussion Supersedes closed PR #1326: https://github.com/Niko1221/Strata/pull/1326 ## Approach Set `self.address_family = socket.AF_INET6` directly in `Server.__init__` when the bind address contains `:`, so both the startup preflight check and the running server use the right socket family without extra wrapper classes. Advertise the loopback URL as `[::1]` for `--host ::`, bracket IPv6 literals in printed URLs, and document the IPv6 option. No default or authentication behavior changes; an API key remains required when listening beyond loopback. ## Validation **Passed:** - `python3 -m py_compile serve/server.py serve/test_security.py setup.py` at `7aea86c1` on macOS. - `python3 -m unittest serve.test_security -v`: 28 tests passed, including `Server` address family selection and a real `::` bind and `/health` request through `::1`. - `git diff --check origin/main...HEAD`: passed. **Not run:** - CUDA, HIP, SYCL and Metal builds; this change only touches the Python server, setup help, tests and documentation. ## Limits IPv6 support depends on the host OS having IPv6 enabled. Listening beyond loopback still requires an API key in normal startup. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:36:29 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4501
No description provided.