[GH-ISSUE #291] AP Port on restricted Networks #175

Open
opened 2026-02-28 14:26:00 +03:00 by kerem · 0 comments
Owner

Originally created by @pimmelkopter on GitHub (Feb 24, 2026).
Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/291

Hello guys,

I've recently switched from GioF71/librespot-docker to go-librespot. I'm missing the "AP-PORT" config.
apresolve/resolve.go asks https://apresolve.spotify.com/ for aps - spotify answers with a json, that always puts Urls with Port "4070" first. This means when this port is not working on the network you have to wait for the connection to timeout before it tries contacting an Url with port 80 or 443.

A config variable setting the preferred AP-Port and then filtering or resorting the apresolve answer would help heaps!

Im not experienced in Go, vibecoding suggested adding a func:
func filterPort(addrs []string, port string) []string { var filtered []string for _, addr := range addrs { if _, p, err := net.SplitHostPort(addr); err == nil && p != port { filtered = append(filtered, addr) } } if len(filtered) == 0 { return addrs } return filtered }

and replacing the r.endpoints like that: "r.endpoints[endpointTypeAccesspoint] = filterPort(respJson.Accesspoint, "4070")"

But I'm pretty sure that not the best way

Would love if changing preferred Ap Port would get implemented once theres time for it. thank you so much!

Originally created by @pimmelkopter on GitHub (Feb 24, 2026). Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/291 Hello guys, I've recently switched from GioF71/librespot-docker to go-librespot. I'm missing the "AP-PORT" config. apresolve/resolve.go asks https://apresolve.spotify.com/ for aps - spotify answers with a json, that always puts Urls with Port "4070" first. This means when this port is not working on the network you have to wait for the connection to timeout before it tries contacting an Url with port 80 or 443. A config variable setting the preferred AP-Port and then filtering or resorting the apresolve answer would help heaps! Im not experienced in Go, vibecoding suggested adding a func: ` func filterPort(addrs []string, port string) []string { var filtered []string for _, addr := range addrs { if _, p, err := net.SplitHostPort(addr); err == nil && p != port { filtered = append(filtered, addr) } } if len(filtered) == 0 { return addrs } return filtered }` and replacing the r.endpoints like that: "r.endpoints[endpointTypeAccesspoint] = filterPort(respJson.Accesspoint, "4070")" But I'm pretty sure that not the best way Would love if changing preferred Ap Port would get implemented once theres time for it. thank you so much!
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
starred/go-librespot#175
No description provided.