feat: support proxy (#284)

This commit is contained in:
Levi authored and GitHub committed 2023-12-02 18:36:52 +08:00
1 parent ef97528114
commit 16b7a3d5b3
45 files changed
+1017 -1124

No files matched your search

+4
View File
@@ -9,6 +9,7 @@ import (
"github.com/GopeedLab/gopeed/pkg/util"
"github.com/anacrolix/torrent"
"github.com/anacrolix/torrent/metainfo"
"net/http"
"path/filepath"
"sync"
"sync/atomic"
@@ -63,6 +64,9 @@ func (f *Fetcher) initClient() (err error) {
cfg := torrent.NewDefaultClientConfig()
cfg.ListenPort = f.config.ListenPort
if f.ctl.ProxyUrl != nil {
cfg.HTTPProxy = http.ProxyURL(f.ctl.ProxyUrl)
}
cfg.DefaultStorage = newFileOpts(newFileClientOpts{
ClientBaseDir: cfg.DataDir,
HandleFileTorrent: func(infoHash metainfo.Hash, ft *fileTorrentImpl) {