Remove preferred hosts
This commit is contained in:
@@ -1,9 +1,5 @@
|
|||||||
package config
|
package config
|
||||||
|
|
||||||
import (
|
|
||||||
"math/rand"
|
|
||||||
)
|
|
||||||
|
|
||||||
type ConfigInterface interface {
|
type ConfigInterface interface {
|
||||||
GetConfig() ZurgConfig
|
GetConfig() ZurgConfig
|
||||||
GetVersion() string
|
GetVersion() string
|
||||||
@@ -23,7 +19,6 @@ type ConfigInterface interface {
|
|||||||
EnableRetainFolderNameExtension() bool
|
EnableRetainFolderNameExtension() bool
|
||||||
EnableRetainRDTorrentName() bool
|
EnableRetainRDTorrentName() bool
|
||||||
ShouldIgnoreRenames() bool
|
ShouldIgnoreRenames() bool
|
||||||
GetRandomPreferredHost() string
|
|
||||||
ShouldServeFromRclone() bool
|
ShouldServeFromRclone() bool
|
||||||
ShouldVerifyDownloadLink() bool
|
ShouldVerifyDownloadLink() bool
|
||||||
ShouldForceIPv6() bool
|
ShouldForceIPv6() bool
|
||||||
@@ -57,7 +52,6 @@ type ZurgConfig struct {
|
|||||||
DownloadMount bool `yaml:"enable_download_mount" json:"enable_download_mount"`
|
DownloadMount bool `yaml:"enable_download_mount" json:"enable_download_mount"`
|
||||||
RateLimitSleepSeconds int `yaml:"rate_limit_sleep_secs" json:"rate_limit_sleep_secs"`
|
RateLimitSleepSeconds int `yaml:"rate_limit_sleep_secs" json:"rate_limit_sleep_secs"`
|
||||||
RetriesUntilFailed int `yaml:"retries_until_failed" json:"retries_until_failed"`
|
RetriesUntilFailed int `yaml:"retries_until_failed" json:"retries_until_failed"`
|
||||||
PreferredHosts []string `yaml:"preferred_hosts" json:"preferred_hosts"`
|
|
||||||
NetworkBufferSize int `yaml:"network_buffer_size" json:"network_buffer_size"`
|
NetworkBufferSize int `yaml:"network_buffer_size" json:"network_buffer_size"`
|
||||||
ServeFromRclone bool `yaml:"serve_from_rclone" json:"serve_from_rclone"`
|
ServeFromRclone bool `yaml:"serve_from_rclone" json:"serve_from_rclone"`
|
||||||
VerifyDownloadLink bool `yaml:"verify_download_link" json:"verify_download_link"`
|
VerifyDownloadLink bool `yaml:"verify_download_link" json:"verify_download_link"`
|
||||||
@@ -141,14 +135,6 @@ func (z *ZurgConfig) ShouldIgnoreRenames() bool {
|
|||||||
return !z.IgnoreRenames
|
return !z.IgnoreRenames
|
||||||
}
|
}
|
||||||
|
|
||||||
func (z *ZurgConfig) GetRandomPreferredHost() string {
|
|
||||||
if len(z.PreferredHosts) == 0 {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
randomIndex := rand.Intn(len(z.PreferredHosts))
|
|
||||||
return z.PreferredHosts[randomIndex]
|
|
||||||
}
|
|
||||||
|
|
||||||
func (z *ZurgConfig) ShouldServeFromRclone() bool {
|
func (z *ZurgConfig) ShouldServeFromRclone() bool {
|
||||||
return z.ServeFromRclone
|
return z.ServeFromRclone
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -214,10 +214,6 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) {
|
|||||||
<td>Retries Until Failed</td>
|
<td>Retries Until Failed</td>
|
||||||
<td>%d</td>
|
<td>%d</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td>Preferred Hosts</td>
|
|
||||||
<td>%s</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Network Buffer Size</td>
|
<td>Network Buffer Size</td>
|
||||||
<td>%d</td>
|
<td>%d</td>
|
||||||
@@ -283,7 +279,6 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) {
|
|||||||
response.Config.EnableDownloadMount(),
|
response.Config.EnableDownloadMount(),
|
||||||
response.Config.GetRateLimitSleepSeconds(),
|
response.Config.GetRateLimitSleepSeconds(),
|
||||||
response.Config.GetRetriesUntilFailed(),
|
response.Config.GetRetriesUntilFailed(),
|
||||||
strings.Join(response.Config.PreferredHosts, ", "),
|
|
||||||
response.Config.GetNetworkBufferSize(),
|
response.Config.GetNetworkBufferSize(),
|
||||||
response.Config.ShouldServeFromRclone(),
|
response.Config.ShouldServeFromRclone(),
|
||||||
response.Config.ShouldVerifyDownloadLink(),
|
response.Config.ShouldVerifyDownloadLink(),
|
||||||
|
|||||||
Reference in New Issue
Block a user