anomalyco / anomalyco/opencode
`serve --hostname` binds only one resolved IP address
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
opencode serve --hostname zenbook
server listening on http://fe80::1802:80ac:95e8:f46f:4096
zenbook resolves to 12 IP addresses here - link-local, wifi, docker, tailscale etc, but since only the first is picked up, which happens to be the link-local one - I can't access the running instance.
bun -e 'require("dns").lookup("zenbook",{all:true},(e,r)=>console.log(r.map(x=>x.address).join("\n")))'
fe80::1802:80ac:95e8:f46f%3
fe80::d88b:2c05:15db:3736%4
fe80::70d2:f3ff:fe39:5bf7%7
fe80::f8d5:45ff:fe45:f25d%9
2401:4900:ad22:f710:49bb:3edc:5b07:7337
fd7a:115c:a1e0::1c37:8c16
10.198.131.185
100.71.140.22
172.17.0.1
172.20.0.1
172.18.0.1
172.19.0.1
As a temporary workaround I do opencode serve --hostname 0.0.0.0 but I'd rather not always have to do that.
I guess ideally we can bind to all IPs, and maybe skip link-local IPs?
Plugins
No response
OpenCode version
v2.0.8
Steps to reproduce
- Run
opencode serve --hostname hostnamewith a hostname that resolves to multiple IPs. - Observe it binding to the first IP, which can be a link-local IP
Screenshot and/or share link
No response
Operating System
Arch Linux
Terminal
Ghostty
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the opencode serve --hostname command and trace how the hostname is resolved and passed to the listener. Reproduce with a hostname resolving to multiple addresses, including a link-local address. Done means the server is reachable without the 0.0.0.0 workaround, with the intended handling of multiple and link-local addresses confirmed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bun, typescript
- Domain
- cli, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100