Skip to content

AP Port on restricted Networks #291

@pimmelkopter

Description

@pimmelkopter

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions