From 60beeb6ccd7991da929c0cf10f2d5ff496965fa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=99=A5=EF=B8=8F?= <29625989+AnyMoe@users.noreply.github.com> Date: Thu, 7 Jan 2021 14:35:21 +0800 Subject: [PATCH] add useIPv4 option to two stage rsync (#150) --- worker/provider.go | 1 + worker/two_stage_rsync_provider.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/worker/provider.go b/worker/provider.go index b6477b2..cd89472 100644 --- a/worker/provider.go +++ b/worker/provider.go @@ -176,6 +176,7 @@ func newMirrorProvider(mirror mirrorConfig, cfg *Config) mirrorProvider { logDir: logDir, logFile: filepath.Join(logDir, "latest.log"), useIPv6: mirror.UseIPv6, + useIPv4: mirror.UseIPv4, interval: time.Duration(mirror.Interval) * time.Minute, retry: mirror.Retry, timeout: time.Duration(mirror.Timeout) * time.Second, diff --git a/worker/two_stage_rsync_provider.go b/worker/two_stage_rsync_provider.go index 4c1c0c0..c5721d1 100644 --- a/worker/two_stage_rsync_provider.go +++ b/worker/two_stage_rsync_provider.go @@ -19,7 +19,7 @@ type twoStageRsyncConfig struct { rsyncTimeoutValue int rsyncEnv map[string]string workingDir, logDir, logFile string - useIPv6 bool + useIPv6, useIPv4 bool interval time.Duration retry int timeout time.Duration @@ -137,6 +137,8 @@ func (p *twoStageRsyncProvider) Options(stage int) ([]string, error) { if p.useIPv6 { options = append(options, "-6") + } else if p.useIPv4 { + options = append(options, "-4") } if p.excludeFile != "" {