[PR #74] [MERGED] Added support for AP proxy #193

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

📋 Pull Request Information

Original PR: https://github.com/devgianlu/go-librespot/pull/74
Author: @HirbodBehnam
Created: 8/27/2024
Status: Merged
Merged: 8/29/2024
Merged by: @devgianlu

Base: masterHead: master


📝 Commits (1)

  • 1adc78c feat: add support for AP proxy

📊 Changes

3 files changed (+11 additions, -9 deletions)

View changed files

📝 ap/ap.go (+5 -1)
📝 go.mod (+3 -3)
📝 go.sum (+3 -5)

📄 Description

Hi
Thanks for the great project! I found your project from librespot's issue regarding invalid credentials. When I was testing your project, I realized that although the HTTP requests are proxied based on HTTP_PROXY and HTTPS_PROXY environment variables, the access point does not. This is rooted in the fact that the access point dialing is done via net.Dial with does not obey any proxy variables.
It is done here:
github.com/devgianlu/go-librespot@9da1361be0/ap/ap.go (L72-L76)
However, if you use proxy package which is already in the indirect packages, you can proxy the access point connection as well through a socks5 proxy. This is done by using proxy.Dial function which automatically uses the ALL_PROXY environment variable. I also used an arbitrary timeout of 30 seconds which I think is reasonable.
In nutshell, now, you can set the following environment variables to fully proxy everything through a socks5 proxy server (proxy.Dial does not support HTTP proxies):

export ALL_PROXY=socks5://127.0.0.1:10808
export HTTP_PROXY=socks5://127.0.0.1:10808
export HTTPS_PROXY=socks5://127.0.0.1:10808

I also ran go mod tidy before pushing my changes that's why go.mod and go.sum are changed.
Let me know what you think!


🔄 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/devgianlu/go-librespot/pull/74 **Author:** [@HirbodBehnam](https://github.com/HirbodBehnam) **Created:** 8/27/2024 **Status:** ✅ Merged **Merged:** 8/29/2024 **Merged by:** [@devgianlu](https://github.com/devgianlu) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`1adc78c`](https://github.com/devgianlu/go-librespot/commit/1adc78c92bcc0691450e895c521846c8cad456d6) feat: add support for AP proxy ### 📊 Changes **3 files changed** (+11 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `ap/ap.go` (+5 -1) 📝 `go.mod` (+3 -3) 📝 `go.sum` (+3 -5) </details> ### 📄 Description Hi Thanks for the great project! I found your project from librespot's issue regarding invalid credentials. When I was testing your project, I realized that although the HTTP requests are proxied based on `HTTP_PROXY` and `HTTPS_PROXY` environment variables, the access point does not. This is rooted in the fact that the access point dialing is done via `net.Dial` with does not obey any proxy variables. It is done here: https://github.com/devgianlu/go-librespot/blob/9da1361be09db24eafc1a92285699709deaf5a19/ap/ap.go#L72-L76 However, if you use [proxy](https://pkg.go.dev/golang.org/x/net/proxy) package which is already in the indirect packages, you can proxy the access point connection as well through a socks5 proxy. This is done by using [proxy.Dial](https://pkg.go.dev/golang.org/x/net/proxy#Dial) function which automatically uses the `ALL_PROXY` environment variable. I also used an arbitrary timeout of 30 seconds which I think is reasonable. In nutshell, now, you can set the following environment variables to fully proxy everything through a socks5 proxy server (proxy.Dial does not support HTTP proxies): ```bash export ALL_PROXY=socks5://127.0.0.1:10808 export HTTP_PROXY=socks5://127.0.0.1:10808 export HTTPS_PROXY=socks5://127.0.0.1:10808 ``` I also ran `go mod tidy` before pushing my changes that's why `go.mod` and `go.sum` are changed. Let me know what you think! --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 14:26:12 +03: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
starred/go-librespot#193
No description provided.