feat: add support for proxies to use with IRC and Indexers (#1421)

* feat: add support for proxies

* fix(http): release handler

* fix(migrations): define proxy early

* fix(migrations): pg proxy

* fix(proxy): list update delete

* fix(proxy): remove log and imports

* feat(irc): use proxy

* feat(irc): tests

* fix(web): update imports for ProxyForms.tsx

* fix(database): migration

* feat(proxy): test

* feat(proxy): validate proxy type

* feat(proxy): validate and test

* feat(proxy): improve validate and test

* feat(proxy): fix db schema

* feat(proxy): add db tests

* feat(proxy): handle http errors

* fix(http): imports

* feat(proxy): use proxy for indexer downloads

* feat(proxy): indexerforms select proxy

* feat(proxy): handle torrent download

* feat(proxy): skip if disabled

* feat(proxy): imports

* feat(proxy): implement in Feeds

* feat(proxy): update helper text indexer proxy

* feat(proxy): add internal cache
This commit is contained in:
ze0s 2024-09-02 11:10:45 +02:00 committed by GitHub
parent 472d327308
commit bc0f4cc055
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
59 changed files with 2533 additions and 371 deletions

View file

@ -12,6 +12,7 @@ import (
"github.com/autobrr/autobrr/internal/domain"
"github.com/autobrr/autobrr/internal/download_client"
"github.com/autobrr/autobrr/internal/logger"
"github.com/autobrr/autobrr/internal/releasedownload"
"github.com/autobrr/autobrr/pkg/sharedhttp"
"github.com/asaskevich/EventBus"
@ -33,21 +34,23 @@ type Service interface {
}
type service struct {
log zerolog.Logger
subLogger *log.Logger
repo domain.ActionRepo
clientSvc download_client.Service
bus EventBus.Bus
log zerolog.Logger
subLogger *log.Logger
repo domain.ActionRepo
clientSvc download_client.Service
downloadSvc *releasedownload.DownloadService
bus EventBus.Bus
httpClient *http.Client
}
func NewService(log logger.Logger, repo domain.ActionRepo, clientSvc download_client.Service, bus EventBus.Bus) Service {
func NewService(log logger.Logger, repo domain.ActionRepo, clientSvc download_client.Service, downloadSvc *releasedownload.DownloadService, bus EventBus.Bus) Service {
s := &service{
log: log.With().Str("module", "action").Logger(),
repo: repo,
clientSvc: clientSvc,
bus: bus,
log: log.With().Str("module", "action").Logger(),
repo: repo,
clientSvc: clientSvc,
downloadSvc: downloadSvc,
bus: bus,
httpClient: &http.Client{
Timeout: time.Second * 120,