Skip to content

feat(cli): add a dev server bind address - #2022

Merged
houko merged 1 commit into
nsgo-dev:mainfrom
J4ck1e2000:fix/dev-bind-address-2001
Nov 22, 2026
Merged

houko merged 1 commit into
nsgo-dev:mainfrom
J4ck1e2000:fix/dev-bind-address-2001

Conversation

@J4ck1e2000

Copy link
Copy Markdown
Contributor

Summary

Fixes #2001.

go tool nsgo dev -target android -host 127.0.0.1 keeps the dev server on loopback while the app connects through adb reverse. Omitting -host retains the all-interface default. If the requested port is busy, the server tries another port on the same address, and reports URLs consistent with its listener.

Targets

  • Shared code (nsgo tool)
  • Android
  • Web

Screenshots

None; only the CLI and listener behavior change.

Verification

  • go tool nsgo check -target macos_arm64,windows_x64,linux_x64 -jobs 3 ./cmd/nsgo
  • go tool nsgo test -run '^(TestDevServerKeepsBindAddressWhenPortIsTaken|TestDevToolsServerPassesMessagesBothWays|TestDevServerTakesItsTokenOnly|TestDevServerRefusesForeignHosts)$' ./cmd/nsgo
  • go tool nsgo test -run '^TestSkills$' ./internal/moduletest
  • Web dev smoke with -host 127.0.0.1 -port 0: HTTP 200 and a loopback-only listening socket.
  • Native Android device and Windows Firewall behavior were not tested.

Checklist

  • Conventional Commit title.
  • Updated documentation, skill guidance, and a changelog.d/ fragment.
  • No new third-party code, assets, or dependencies.

- Keep wildcard listening by default and preserve the selected address when falling back to another port.
- Route Android dev connections through adb reverse and document the new flag.

Fixes nsgo-dev#2001
@github-actions github-actions Bot added enhancement New feature or request size/M documentation Improvements or additions to documentation cli labels Nov 22, 2026
@houko

houko commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

Reviewed. Checked the bind-address resolution and port retry on the same address, that adb reverse dials the bound address for a specific bind and plain loopback for a wildcard, that -automation rejects a non-loopback listener, and that every former devServer.port user moved to addr (no new users on main).

@houko
houko added this pull request to the merge queue Nov 22, 2026
@houko
houko merged commit f86d585 into nsgo-dev:main Nov 22, 2026
17 of 24 checks passed
@J4ck1e2000
J4ck1e2000 deleted the fix/dev-bind-address-2001 branch November 23, 2026 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli documentation Improvements or additions to documentation enhancement New feature or request size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a configurable bind address for the nsgo dev server

2 participants